mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 20:12:37 +01:00
wscutil: Add M3 parser
This commit is contained in:
parent
dc310bfc49
commit
b6e7b7a4d6
@ -1065,6 +1065,32 @@ int wsc_parse_m2(const uint8_t *pdu, uint32_t len, struct wsc_m2 *out)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wsc_parse_m3(const uint8_t *pdu, uint32_t len, struct wsc_m3 *out)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct wsc_wfa_ext_iter iter;
|
||||||
|
uint8_t version;
|
||||||
|
enum wsc_message_type msg_type;
|
||||||
|
|
||||||
|
memset(out, 0, sizeof(struct wsc_m3));
|
||||||
|
|
||||||
|
r = wsc_parse_attrs(pdu, len, &out->version2, &iter, out->authenticator,
|
||||||
|
REQUIRED(VERSION, &version),
|
||||||
|
REQUIRED(MESSAGE_TYPE, &msg_type),
|
||||||
|
REQUIRED(REGISTRAR_NONCE, &out->registrar_nonce),
|
||||||
|
REQUIRED(E_HASH1, &out->e_hash1),
|
||||||
|
REQUIRED(E_HASH2, &out->e_hash2),
|
||||||
|
WSC_ATTR_INVALID);
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
if (msg_type != WSC_MESSAGE_TYPE_M3)
|
||||||
|
return -EBADMSG;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct wsc_attr_builder {
|
struct wsc_attr_builder {
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
|
@ -429,6 +429,14 @@ struct wsc_m2 {
|
|||||||
uint8_t authenticator[8];
|
uint8_t authenticator[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wsc_m3 {
|
||||||
|
bool version2;
|
||||||
|
uint8_t registrar_nonce[16];
|
||||||
|
uint8_t e_hash1[32];
|
||||||
|
uint8_t e_hash2[32];
|
||||||
|
uint8_t authenticator[8];
|
||||||
|
};
|
||||||
|
|
||||||
int wsc_parse_beacon(const unsigned char *pdu, unsigned int len,
|
int wsc_parse_beacon(const unsigned char *pdu, unsigned int len,
|
||||||
struct wsc_beacon *out);
|
struct wsc_beacon *out);
|
||||||
int wsc_parse_probe_response(const unsigned char *pdu, unsigned int len,
|
int wsc_parse_probe_response(const unsigned char *pdu, unsigned int len,
|
||||||
@ -438,6 +446,7 @@ int wsc_parse_probe_request(const unsigned char *pdu, unsigned int len,
|
|||||||
|
|
||||||
int wsc_parse_m1(const uint8_t *pdu, uint32_t len, struct wsc_m1 *out);
|
int wsc_parse_m1(const uint8_t *pdu, uint32_t len, struct wsc_m1 *out);
|
||||||
int wsc_parse_m2(const uint8_t *pdu, uint32_t len, struct wsc_m2 *out);
|
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);
|
||||||
|
|
||||||
uint8_t *wsc_build_probe_request(const struct wsc_probe_request *probe_request,
|
uint8_t *wsc_build_probe_request(const struct wsc_probe_request *probe_request,
|
||||||
size_t *out_len);
|
size_t *out_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user