mka: Support for 256-bit SAK generation
There is already partial support of GCM-AES-256. It is possible to enable this mode by setting 'kay->macsec_csindex = 1;' in ieee802_1x_kay_init() function, but the generated key contained only 128 bits of data while other 128 bits are in 0. Enables KaY to generate full 256-bit SAK from the same 128-bit CAK. Note that this does not support 256-bit CAK or AES-CMAC-256 -based KDF. Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
This commit is contained in:
parent
c9c93e7a24
commit
c1576d44a8
3 changed files with 12 additions and 9 deletions
|
@ -2073,12 +2073,13 @@ ieee802_1x_kay_generate_new_sak(struct ieee802_1x_mka_participant *participant)
|
||||||
ctx_offset += sizeof(participant->mi);
|
ctx_offset += sizeof(participant->mi);
|
||||||
os_memcpy(context + ctx_offset, &kay->dist_kn, sizeof(kay->dist_kn));
|
os_memcpy(context + ctx_offset, &kay->dist_kn, sizeof(kay->dist_kn));
|
||||||
|
|
||||||
if (key_len == 16) {
|
if (key_len == 16 || key_len == 32) {
|
||||||
ieee802_1x_sak_128bits_aes_cmac(participant->cak.key,
|
if (ieee802_1x_sak_128bits_aes_cmac(participant->cak.key,
|
||||||
context, ctx_len, key);
|
context, ctx_len,
|
||||||
} else if (key_len == 32) {
|
key, key_len)) {
|
||||||
ieee802_1x_sak_128bits_aes_cmac(participant->cak.key,
|
wpa_printf(MSG_ERROR, "KaY: Failed to generate SAK");
|
||||||
context, ctx_len, key);
|
goto fail;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
wpa_printf(MSG_ERROR, "KaY: SAK Length not support");
|
wpa_printf(MSG_ERROR, "KaY: SAK Length not support");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -183,7 +183,8 @@ int ieee802_1x_icv_128bits_aes_cmac(const u8 *ick, const u8 *msg,
|
||||||
* SAK = KDF(Key, Label, KS-nonce | MI-value list | KN, SAKLength)
|
* SAK = KDF(Key, Label, KS-nonce | MI-value list | KN, SAKLength)
|
||||||
*/
|
*/
|
||||||
int ieee802_1x_sak_128bits_aes_cmac(const u8 *cak, const u8 *ctx,
|
int ieee802_1x_sak_128bits_aes_cmac(const u8 *cak, const u8 *ctx,
|
||||||
size_t ctx_bytes, u8 *sak)
|
size_t ctx_bytes, u8 *sak, size_t sak_bytes)
|
||||||
{
|
{
|
||||||
return aes_kdf_128(cak, "IEEE8021 SAK", ctx, ctx_bytes * 8, 128, sak);
|
return aes_kdf_128(cak, "IEEE8021 SAK", ctx, ctx_bytes * 8,
|
||||||
|
sak_bytes * 8, sak);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ int ieee802_1x_ick_128bits_aes_cmac(const u8 *cak, const u8 *ckn,
|
||||||
int ieee802_1x_icv_128bits_aes_cmac(const u8 *ick, const u8 *msg,
|
int ieee802_1x_icv_128bits_aes_cmac(const u8 *ick, const u8 *msg,
|
||||||
size_t msg_bytes, u8 *icv);
|
size_t msg_bytes, u8 *icv);
|
||||||
int ieee802_1x_sak_128bits_aes_cmac(const u8 *cak, const u8 *ctx,
|
int ieee802_1x_sak_128bits_aes_cmac(const u8 *cak, const u8 *ctx,
|
||||||
size_t ctx_bytes, u8 *sak);
|
size_t ctx_bytes, u8 *sak,
|
||||||
|
size_t sak_bytes);
|
||||||
|
|
||||||
#endif /* IEEE802_1X_KEY_H */
|
#endif /* IEEE802_1X_KEY_H */
|
||||||
|
|
Loading…
Reference in a new issue