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
1 changed files with 17 additions and 0 deletions

View File

@ -1358,6 +1358,22 @@ static void wsc_test_parse_m5(const void *data)
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[] = {
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/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",
wsc_test_pbc_handshake, NULL);