mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-02 01:02:34 +01:00
eap-wsc: Add utility to check KeyWrapAuthenticator
This commit is contained in:
parent
046c7b8994
commit
b78bef2be8
@ -118,6 +118,22 @@ static inline void authenticator_put(struct eap_wsc_state *wsc,
|
|||||||
l_checksum_get_digest(wsc->hmac_auth_key, cur_msg + cur_msg_len - 8, 8);
|
l_checksum_get_digest(wsc->hmac_auth_key, cur_msg + cur_msg_len - 8, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool keywrap_authenticator_check(struct eap_wsc_state *wsc,
|
||||||
|
const uint8_t *pdu, size_t len)
|
||||||
|
{
|
||||||
|
uint8_t authenticator[8];
|
||||||
|
|
||||||
|
/* We omit the included KeyWrapAuthenticator element from the hash */
|
||||||
|
l_checksum_update(wsc->hmac_auth_key, pdu, len - 12);
|
||||||
|
l_checksum_get_digest(wsc->hmac_auth_key, authenticator, 8);
|
||||||
|
|
||||||
|
/* KeyWrapAuthenticator is the last 8 bytes of the message */
|
||||||
|
if (memcmp(authenticator, pdu + len - 8, 8))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int eap_wsc_probe(struct eap_state *eap, const char *name)
|
static int eap_wsc_probe(struct eap_state *eap, const char *name)
|
||||||
{
|
{
|
||||||
struct eap_wsc_state *wsc;
|
struct eap_wsc_state *wsc;
|
||||||
|
Loading…
Reference in New Issue
Block a user