mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-20 19:12:33 +01:00
unit: Add test for wsc_parse_wsc_done
This commit is contained in:
parent
aa518811b3
commit
588f8a555d
@ -1802,6 +1802,51 @@ static void wsc_test_parse_m8_encrypted_settings(const void *data)
|
||||
assert(!memcmp(expected->authenticator, m8es.authenticator, 8));
|
||||
}
|
||||
|
||||
static const unsigned char eap_wsc_done[] = {
|
||||
0x01, 0x00, 0x00, 0x4a, 0x02, 0xab, 0x00, 0x4a, 0xfe, 0x00, 0x37, 0x2a,
|
||||
0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
||||
0x22, 0x00, 0x01, 0x0f, 0x10, 0x1a, 0x00, 0x10, 0x19, 0x8d, 0x0d, 0x25,
|
||||
0x91, 0x2c, 0x37, 0x1c, 0xeb, 0x07, 0x89, 0x33, 0xe1, 0x25, 0xd7, 0x43,
|
||||
0x10, 0x39, 0x00, 0x10, 0x67, 0xa5, 0x53, 0x61, 0xee, 0x72, 0xc2, 0x21,
|
||||
0x48, 0x78, 0xc5, 0x70, 0x89, 0x9f, 0xf2, 0xa0, 0x10, 0x49, 0x00, 0x06,
|
||||
0x00, 0x37, 0x2a, 0x00, 0x01, 0x20,
|
||||
};
|
||||
|
||||
struct wsc_done_data {
|
||||
struct wsc_done expected;
|
||||
const void *pdu;
|
||||
unsigned int len;
|
||||
};
|
||||
|
||||
static const struct wsc_done_data wsc_done_data_1 = {
|
||||
.pdu = eap_wsc_done + 18,
|
||||
.len = sizeof(eap_wsc_done) - 18,
|
||||
.expected = {
|
||||
.version2 = true,
|
||||
.enrollee_nonce = { 0x19, 0x8d, 0x0d, 0x25, 0x91, 0x2c, 0x37,
|
||||
0x1c, 0xeb, 0x07, 0x89, 0x33, 0xe1,
|
||||
0x25, 0xd7, 0x43 },
|
||||
.registrar_nonce = { 0x67, 0xa5, 0x53, 0x61, 0xee, 0x72, 0xc2,
|
||||
0x21, 0x48, 0x78, 0xc5, 0x70, 0x89,
|
||||
0x9f, 0xf2, 0xa0 },
|
||||
},
|
||||
};
|
||||
|
||||
static void wsc_test_parse_wsc_done(const void *data)
|
||||
{
|
||||
const struct wsc_done_data *test = data;
|
||||
struct wsc_done done;
|
||||
const struct wsc_done *expected = &test->expected;
|
||||
int r;
|
||||
|
||||
r = wsc_parse_wsc_done(test->pdu, test->len, &done);
|
||||
assert(r == 0);
|
||||
|
||||
assert(expected->version2 == done.version2);
|
||||
assert(!memcmp(expected->enrollee_nonce, done.enrollee_nonce, 16));
|
||||
assert(!memcmp(expected->registrar_nonce, done.registrar_nonce, 16));
|
||||
}
|
||||
|
||||
static const uint8_t eap_identity_req[] = {
|
||||
0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01
|
||||
};
|
||||
@ -2015,6 +2060,9 @@ int main(int argc, char *argv[])
|
||||
wsc_test_parse_m8_encrypted_settings,
|
||||
&m8_encrypted_settings_data_1);
|
||||
|
||||
l_test_add("/wsc/parse/wsc_done 1", wsc_test_parse_wsc_done,
|
||||
&wsc_done_data_1);
|
||||
|
||||
l_test_add("/wsc/handshake/PBC Handshake Test",
|
||||
wsc_test_pbc_handshake, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user