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

wscutil: Add wsc_parse_m4_encrypted_settings

This commit is contained in:
Denis Kenzior 2016-08-30 13:38:08 -05:00
parent 757e4dbb90
commit 11e56031c0
2 changed files with 20 additions and 0 deletions

View File

@ -546,6 +546,8 @@ static attr_handler handler_for_type(enum wsc_attr type)
case WSC_ATTR_R_HASH1:
case WSC_ATTR_R_HASH2:
return extract_hash;
case WSC_ATTR_R_SNONCE1:
return extract_nonce;
case WSC_ATTR_SELECTED_REGISTRAR:
return extract_bool;
case WSC_ATTR_SELECTED_REGISTRAR_CONFIGURATION_METHODS:
@ -1148,6 +1150,17 @@ int wsc_parse_m4(const uint8_t *pdu, uint32_t len, struct wsc_m4 *out,
return 0;
}
int wsc_parse_m4_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m4_encrypted_settings *out)
{
memset(out, 0, sizeof(*out));
return wsc_parse_attrs(pdu, len, NULL, NULL,
WSC_ATTR_KEY_WRAP_AUTHENTICATOR, out->authenticator,
REQUIRED(R_SNONCE1, out->r_snonce1),
WSC_ATTR_INVALID);
}
int wsc_parse_m5(const uint8_t *pdu, uint32_t len, struct wsc_m5 *out,
struct iovec *out_encrypted)
{

View File

@ -454,6 +454,11 @@ struct wsc_m4 {
uint8_t authenticator[8];
};
struct wsc_m4_encrypted_settings {
uint8_t r_snonce1[16];
uint8_t authenticator[8];
};
struct wsc_m5 {
bool version2;
uint8_t registrar_nonce[16];
@ -479,6 +484,8 @@ int wsc_parse_m2(const uint8_t *pdu, uint32_t len, struct wsc_m2 *out);
int wsc_parse_m3(const uint8_t *pdu, uint32_t len, struct wsc_m3 *out);
int wsc_parse_m4(const uint8_t *pdu, uint32_t len, struct wsc_m4 *out,
struct iovec *out_encrypted);
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);