3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

wscutil: Add wsc_parse_m5_encrypted_settings

This commit is contained in:
Denis Kenzior 2016-08-30 14:07:53 -05:00
parent ba8e0cd6b7
commit 7bdb1a0225
2 changed files with 20 additions and 0 deletions

View File

@ -509,6 +509,8 @@ static attr_handler handler_for_type(enum wsc_attr type)
case WSC_ATTR_E_HASH1:
case WSC_ATTR_E_HASH2:
return extract_hash;
case WSC_ATTR_E_SNONCE1:
return extract_nonce;
case WSC_ATTR_ENCRYPTED_SETTINGS:
return extract_encrypted_settings;
case WSC_ATTR_ENCRYPTION_TYPE_FLAGS:
@ -1188,6 +1190,17 @@ int wsc_parse_m5(const uint8_t *pdu, uint32_t len, struct wsc_m5 *out,
return 0;
}
int wsc_parse_m5_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m5_encrypted_settings *out)
{
memset(out, 0, sizeof(*out));
return wsc_parse_attrs(pdu, len, NULL, NULL,
WSC_ATTR_KEY_WRAP_AUTHENTICATOR, out->authenticator,
REQUIRED(E_SNONCE1, out->e_snonce1),
WSC_ATTR_INVALID);
}
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out)
{
int r;

View File

@ -465,6 +465,11 @@ struct wsc_m5 {
uint8_t authenticator[8];
};
struct wsc_m5_encrypted_settings {
uint8_t e_snonce1[16];
uint8_t authenticator[8];
};
struct wsc_nack {
bool version2;
uint8_t enrollee_nonce[16];
@ -488,6 +493,8 @@ int wsc_parse_m4_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m4_encrypted_settings *out);
int wsc_parse_m5(const uint8_t *pdu, uint32_t len, struct wsc_m5 *out,
struct iovec *out_encrypted);
int wsc_parse_m5_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m5_encrypted_settings *out);
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out);