From what I can find out there is no clear answer without being able to read James Key's contract.
In short, worst case is Red Bull might be able to keep Key to the end of his contract even if that is longer than 6 months, if the contract allows them to assign him to other working duties.
If the contract does not allow them to reassign Key then the maximum nonworking period of gardening leave is 6 months. Alternatively if there is not on a fixed period of employment in the contract then there will be a leave period which could be shorter than 6 months.
If Key breaches gardening leave then both McLaren and Key can be sued for damages.
Finally Red Bull and STR will probably not release Key early as this would be aiding a competitor, even in more friendly associations like Paddy Lowe leaving Mercedes for Williams he would have had to wait 6 months except that his release from contract became part of the negotiations for Valteri Bottas.