3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 06:02:39 +01:00

handshake: Add handshake_util_build_gtk_kde utility

This commit is contained in:
Andrew Zaborowski 2018-09-22 18:48:15 +02:00 committed by Denis Kenzior
parent 68e612573e
commit 7c779956ac
2 changed files with 18 additions and 0 deletions

View File

@ -651,6 +651,21 @@ const uint8_t *handshake_util_find_pmkid_kde(const uint8_t *data,
return pmkid;
}
/* Defined in 802.11-2016 12.7.2 j), Figure 12-34 */
void handshake_util_build_gtk_kde(enum crypto_cipher cipher, const uint8_t *key,
unsigned int key_index, uint8_t *to)
{
size_t key_len = crypto_cipher_key_len(cipher);
*to++ = IE_TYPE_VENDOR_SPECIFIC;
*to++ = 6 + key_len;
l_put_be32(HANDSHAKE_KDE_GTK, to);
to += 4;
*to++ = key_index;
*to++ = 0;
memcpy(to, key, key_len);
}
/*
* Unwrap a GTK / IGTK included in an FTE following 802.11-2012, Section 12.8.5:
*

View File

@ -26,6 +26,7 @@
#include <linux/types.h>
struct handshake_state;
enum crypto_cipher;
/* 802.11-2016 Table 12-6 in section 12.7.2 */
enum handshake_kde {
@ -194,6 +195,8 @@ const uint8_t *handshake_util_find_igtk_kde(const uint8_t *data,
size_t data_len, size_t *out_igtk_len);
const uint8_t *handshake_util_find_pmkid_kde(const uint8_t *data,
size_t data_len);
void handshake_util_build_gtk_kde(enum crypto_cipher cipher, const uint8_t *key,
unsigned int key_index, uint8_t *to);
void handshake_event(struct handshake_state *hs, enum handshake_event event,
void *event_data);