3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +01:00

wscutil: Add wsc_parse_wsc_ack

This commit is contained in:
Denis Kenzior 2016-09-08 21:33:20 -05:00
parent 8cd797dced
commit 9c9ecfa239
2 changed files with 32 additions and 0 deletions

View File

@ -1479,6 +1479,31 @@ int wsc_parse_m8_encrypted_settings(const uint8_t *pdu, uint32_t len,
return 0;
}
int wsc_parse_wsc_ack(const uint8_t *pdu, uint32_t len, struct wsc_ack *out)
{
int r;
struct wsc_wfa_ext_iter iter;
uint8_t version;
enum wsc_message_type msg_type;
memset(out, 0, sizeof(struct wsc_ack));
r = wsc_parse_attrs(pdu, len, &out->version2, &iter, 0, NULL,
REQUIRED(VERSION, &version),
REQUIRED(MESSAGE_TYPE, &msg_type),
REQUIRED(ENROLLEE_NONCE, &out->enrollee_nonce),
REQUIRED(REGISTRAR_NONCE, &out->registrar_nonce),
WSC_ATTR_INVALID);
if (r < 0)
return r;
if (msg_type != WSC_MESSAGE_TYPE_WSC_ACK)
return -EBADMSG;
return 0;
}
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out)
{
int r;

View File

@ -515,6 +515,12 @@ struct wsc_m8_encrypted_settings {
uint8_t authenticator[8];
};
struct wsc_ack {
bool version2;
uint8_t enrollee_nonce[16];
uint8_t registrar_nonce[16];
};
struct wsc_nack {
bool version2;
uint8_t enrollee_nonce[16];
@ -563,6 +569,7 @@ int wsc_parse_m8_encrypted_settings(const uint8_t *pdu, uint32_t len,
struct wsc_m8_encrypted_settings *out,
struct iovec *iov, size_t *iovcnt);
int wsc_parse_wsc_ack(const uint8_t *pdu, uint32_t len, struct wsc_ack *out);
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out);
int wsc_parse_wsc_done(const uint8_t *pdu, uint32_t len, struct wsc_done *out);