wscutil: Add wsc_parse_m8

This commit is contained in:
Denis Kenzior 2016-08-31 14:14:01 -05:00
parent 387af676cf
commit ead40f0431
2 changed files with 35 additions and 0 deletions

View File

@ -1279,6 +1279,33 @@ int wsc_parse_m7_encrypted_settings(const uint8_t *pdu, uint32_t len,
WSC_ATTR_INVALID);
}
int wsc_parse_m8(const uint8_t *pdu, uint32_t len, struct wsc_m8 *out,
struct iovec *out_encrypted)
{
int r;
struct wsc_wfa_ext_iter iter;
uint8_t version;
enum wsc_message_type msg_type;
memset(out, 0, sizeof(struct wsc_m8));
r = wsc_parse_attrs(pdu, len, &out->version2, &iter,
WSC_ATTR_AUTHENTICATOR, out->authenticator,
REQUIRED(VERSION, &version),
REQUIRED(MESSAGE_TYPE, &msg_type),
REQUIRED(ENROLLEE_NONCE, &out->enrollee_nonce),
REQUIRED(ENCRYPTED_SETTINGS, out_encrypted),
WSC_ATTR_INVALID);
if (r < 0)
return r;
if (msg_type != WSC_MESSAGE_TYPE_M8)
return -EBADMSG;
return 0;
}
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out)
{
int r;

View File

@ -492,6 +492,12 @@ struct wsc_m7_encrypted_settings {
uint8_t authenticator[8];
};
struct wsc_m8 {
bool version2;
uint8_t enrollee_nonce[16];
uint8_t authenticator[8];
};
struct wsc_nack {
bool version2;
uint8_t enrollee_nonce[16];
@ -525,6 +531,8 @@ 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_m8(const uint8_t *pdu, uint32_t len, struct wsc_m8 *out,
struct iovec *out_encrypted);
int wsc_parse_nack(const uint8_t *pdu, uint32_t len, struct wsc_nack *out);