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

wscutil: Add wsc_parse_m7_encrypted_settings

This commit is contained in:
Denis Kenzior 2016-08-31 11:38:52 -05:00
parent 9353da8bf3
commit 8df0f9fa28
2 changed files with 19 additions and 0 deletions

View File

@ -510,6 +510,7 @@ static attr_handler handler_for_type(enum wsc_attr type)
case WSC_ATTR_E_HASH2:
return extract_hash;
case WSC_ATTR_E_SNONCE1:
case WSC_ATTR_E_SNONCE2:
return extract_nonce;
case WSC_ATTR_ENCRYPTED_SETTINGS:
return extract_encrypted_settings;
@ -1267,6 +1268,17 @@ int wsc_parse_m7(const uint8_t *pdu, uint32_t len, struct wsc_m7 *out,
return 0;
}
int wsc_parse_m7_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m7_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_SNONCE2, out->e_snonce2),
WSC_ATTR_INVALID);
}
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out)
{
int r;

View File

@ -487,6 +487,11 @@ struct wsc_m7 {
uint8_t authenticator[8];
};
struct wsc_m7_encrypted_settings {
uint8_t e_snonce2[16];
uint8_t authenticator[8];
};
struct wsc_nack {
bool version2;
uint8_t enrollee_nonce[16];
@ -518,6 +523,8 @@ int wsc_parse_m6_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m6_encrypted_settings *out);
int wsc_parse_m7(const uint8_t *pdu, uint32_t len, struct wsc_m7 *out,
struct iovec *out_encrypted);
int wsc_parse_m7_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m7_encrypted_settings *out);
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out);