Skip to content

Commit

Permalink
net: phy: mscc: fix macsec key length
Browse files Browse the repository at this point in the history
[ Upstream commit c309217 ]

The key length used to store the macsec key was set to MACSEC_KEYID_LEN
(16), which is an issue as:
- This was never meant to be the key length.
- The key length can be > 16.

Fix this by using MACSEC_MAX_KEY_LEN instead (the max length accepted in
uAPI).

Fixes: 28c5107 ("net: phy: mscc: macsec support")
Reported-by: Lior Nahmanson <liorna@nvidia.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
atenart authored and gregkh committed Jul 14, 2021
1 parent 7052120 commit d22eadd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/phy/mscc/mscc_macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ static u32 vsc8584_macsec_flow_context_id(struct macsec_flow *flow)
}

/* Derive the AES key to get a key for the hash autentication */
static int vsc8584_macsec_derive_key(const u8 key[MACSEC_KEYID_LEN],
static int vsc8584_macsec_derive_key(const u8 key[MACSEC_MAX_KEY_LEN],
u16 key_len, u8 hkey[16])
{
const u8 input[AES_BLOCK_SIZE] = {0};
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/mscc/mscc_macsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct macsec_flow {
/* Highest takes precedence [0..15] */
u8 priority;

u8 key[MACSEC_KEYID_LEN];
u8 key[MACSEC_MAX_KEY_LEN];

union {
struct macsec_rx_sa *rx_sa;
Expand Down

0 comments on commit d22eadd

Please sign in to comment.