mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-12 19:32:36 +01:00
erp: Return const void * instead
This commit is contained in:
parent
8c11fdabcc
commit
f0de2516ea
@ -512,10 +512,12 @@ eap_failed:
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void erp_get_rmsk(struct erp_state *erp, void **rmsk, size_t *rmsk_len)
|
const void *erp_get_rmsk(struct erp_state *erp, size_t *rmsk_len)
|
||||||
{
|
{
|
||||||
*rmsk = erp->rmsk;
|
if (rmsk_len)
|
||||||
*rmsk_len = erp->cache->emsk_len;
|
*rmsk_len = erp->cache->emsk_len;
|
||||||
|
|
||||||
|
return erp->rmsk;
|
||||||
}
|
}
|
||||||
|
|
||||||
void erp_init(void)
|
void erp_init(void)
|
||||||
|
@ -39,7 +39,7 @@ void erp_free(struct erp_state *erp);
|
|||||||
bool erp_start(struct erp_state *erp);
|
bool erp_start(struct erp_state *erp);
|
||||||
int erp_rx_packet(struct erp_state *erp, const uint8_t *erp_data, size_t len);
|
int erp_rx_packet(struct erp_state *erp, const uint8_t *erp_data, size_t len);
|
||||||
|
|
||||||
void erp_get_rmsk(struct erp_state *erp, void **rmsk, size_t *rmsk_len);
|
const void *erp_get_rmsk(struct erp_state *erp, size_t *rmsk_len);
|
||||||
|
|
||||||
void erp_cache_add(const char *id, const void *session_id, size_t session_len,
|
void erp_cache_add(const char *id, const void *session_id, size_t session_len,
|
||||||
const void *emsk, size_t emsk_len,
|
const void *emsk, size_t emsk_len,
|
||||||
|
14
src/fils.c
14
src/fils.c
@ -119,9 +119,10 @@ static void fils_erp_tx_func(const uint8_t *eap_data, size_t len,
|
|||||||
fils->auth(data, ptr - data + tlv_len, fils->user_data);
|
fils->auth(data, ptr - data + tlv_len, fils->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fils_derive_key_data(struct fils_sm *fils, const void *rmsk,
|
static int fils_derive_key_data(struct fils_sm *fils)
|
||||||
size_t rmsk_len)
|
|
||||||
{
|
{
|
||||||
|
const void *rmsk;
|
||||||
|
size_t rmsk_len;
|
||||||
struct ie_tlv_builder builder;
|
struct ie_tlv_builder builder;
|
||||||
uint8_t key[FILS_NONCE_LEN * 2];
|
uint8_t key[FILS_NONCE_LEN * 2];
|
||||||
uint8_t key_data[64 + 48 + 16]; /* largest ICK, KEK, TK */
|
uint8_t key_data[64 + 48 + 16]; /* largest ICK, KEK, TK */
|
||||||
@ -133,6 +134,8 @@ static int fils_derive_key_data(struct fils_sm *fils, const void *rmsk,
|
|||||||
bool sha384;
|
bool sha384;
|
||||||
unsigned int ie_len;
|
unsigned int ie_len;
|
||||||
|
|
||||||
|
rmsk = erp_get_rmsk(fils->erp, &rmsk_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IEEE 802.11ai - Section 12.12.2.5.3
|
* IEEE 802.11ai - Section 12.12.2.5.3
|
||||||
*/
|
*/
|
||||||
@ -289,8 +292,6 @@ void fils_rx_authenticate(struct fils_sm *fils, const uint8_t *frame,
|
|||||||
const uint8_t *session = NULL;
|
const uint8_t *session = NULL;
|
||||||
const uint8_t *wrapped = NULL;
|
const uint8_t *wrapped = NULL;
|
||||||
size_t wrapped_len = 0;
|
size_t wrapped_len = 0;
|
||||||
void *rmsk;
|
|
||||||
size_t rmsk_len;
|
|
||||||
|
|
||||||
if (!hdr) {
|
if (!hdr) {
|
||||||
l_debug("Auth frame header did not validate");
|
l_debug("Auth frame header did not validate");
|
||||||
@ -353,10 +354,7 @@ void fils_rx_authenticate(struct fils_sm *fils, const uint8_t *frame,
|
|||||||
if (erp_rx_packet(fils->erp, wrapped, wrapped_len) < 0)
|
if (erp_rx_packet(fils->erp, wrapped, wrapped_len) < 0)
|
||||||
goto auth_failed;
|
goto auth_failed;
|
||||||
|
|
||||||
erp_get_rmsk(fils->erp, &rmsk, &rmsk_len);
|
fils_derive_key_data(fils);
|
||||||
|
|
||||||
fils_derive_key_data(fils, rmsk, rmsk_len);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auth_failed:
|
auth_failed:
|
||||||
|
Loading…
Reference in New Issue
Block a user