3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-25 08:02:38 +01:00

unit: Add M5 builder unit test

This commit is contained in:
Denis Kenzior 2016-08-30 09:46:33 -05:00
parent 5c88de6e65
commit a4bf3f3280

View File

@ -1358,6 +1358,22 @@ static void wsc_test_parse_m5(const void *data)
encrypted.iov_base, encrypted.iov_len)); encrypted.iov_base, encrypted.iov_len));
} }
static void wsc_test_build_m5(const void *data)
{
const struct m5_data *test = data;
uint8_t *out;
size_t out_len;
out = wsc_build_m5(&test->expected, test->expected_encrypted,
test->expected_encrypted_size, &out_len);
assert(out);
assert(out_len == test->len);
assert(!memcmp(test->pdu, out, test->len));
l_free(out);
}
static const uint8_t eap_identity_req[] = { static const uint8_t eap_identity_req[] = {
0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01
}; };
@ -1551,6 +1567,7 @@ int main(int argc, char *argv[])
l_test_add("/wsc/build/m4 1", wsc_test_build_m4, &m4_data_1); l_test_add("/wsc/build/m4 1", wsc_test_build_m4, &m4_data_1);
l_test_add("/wsc/parse/m5 1", wsc_test_parse_m5, &m5_data_1); l_test_add("/wsc/parse/m5 1", wsc_test_parse_m5, &m5_data_1);
l_test_add("/wsc/build/m5 1", wsc_test_build_m5, &m5_data_1);
l_test_add("/wsc/handshake/PBC Handshake Test", l_test_add("/wsc/handshake/PBC Handshake Test",
wsc_test_pbc_handshake, NULL); wsc_test_pbc_handshake, NULL);