3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-24 15:22:34 +01:00

unit: Add test for wsc_build_m6_encrypted_settings

This commit is contained in:
Denis Kenzior 2016-08-31 11:16:30 -05:00
parent 2f09fbc348
commit f8eb76a93a

View File

@ -1536,6 +1536,21 @@ static void wsc_test_parse_m6_encrypted_settings(const void *data)
assert(!memcmp(expected->authenticator, m6es.authenticator, 8)); assert(!memcmp(expected->authenticator, m6es.authenticator, 8));
} }
static void wsc_test_build_m6_encrypted_settings(const void *data)
{
const struct m6_encrypted_settings_data *test = data;
uint8_t *out;
size_t out_len;
out = wsc_build_m6_encrypted_settings(&test->expected, &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
}; };
@ -1768,6 +1783,9 @@ int main(int argc, char *argv[])
l_test_add("/wsc/parse/m6 encrypted settings 1", l_test_add("/wsc/parse/m6 encrypted settings 1",
wsc_test_parse_m6_encrypted_settings, wsc_test_parse_m6_encrypted_settings,
&m6_encrypted_settings_data_1); &m6_encrypted_settings_data_1);
l_test_add("/wsc/build/m6 encrypted settings 1",
wsc_test_build_m6_encrypted_settings,
&m6_encrypted_settings_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);