mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-20 19:12:33 +01:00
unit: Add another M1 parser test
This commit is contained in:
parent
038341edcd
commit
8e6c2cea65
@ -532,7 +532,7 @@ static void wsc_test_dh_generate_pubkey(const void *data)
|
||||
l_key_free(private);
|
||||
}
|
||||
|
||||
static const unsigned char eap_wsc_m1[] = {
|
||||
static const unsigned char eap_wsc_m1_1[] = {
|
||||
0x01, 0x00, 0x01, 0x78, 0x02, 0x01, 0x01, 0x78, 0xfe, 0x00, 0x37, 0x2a,
|
||||
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
||||
0x22, 0x00, 0x01, 0x04, 0x10, 0x47, 0x00, 0x10, 0x79, 0x0c, 0x1f, 0x80,
|
||||
@ -567,6 +567,41 @@ static const unsigned char eap_wsc_m1[] = {
|
||||
0x00, 0x06, 0x00, 0x37, 0x2a, 0x00, 0x01, 0x20,
|
||||
};
|
||||
|
||||
static const unsigned char eap_wsc_m1_2[] = {
|
||||
0x01, 0x00, 0x01, 0x78, 0x02, 0xa7, 0x01, 0x78, 0xfe, 0x00, 0x37, 0x2a,
|
||||
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
||||
0x22, 0x00, 0x01, 0x04, 0x10, 0x47, 0x00, 0x10, 0x79, 0x0c, 0x1f, 0x80,
|
||||
0x4f, 0x2b, 0x52, 0xb7, 0xbe, 0x30, 0xc0, 0xe9, 0x72, 0x92, 0x08, 0x8d,
|
||||
0x10, 0x20, 0x00, 0x06, 0xa0, 0xa8, 0xcd, 0x1c, 0x7e, 0xc9, 0x10, 0x1a,
|
||||
0x00, 0x10, 0x19, 0x8d, 0x0d, 0x25, 0x91, 0x2c, 0x37, 0x1c, 0xeb, 0x07,
|
||||
0x89, 0x33, 0xe1, 0x25, 0xd7, 0x43, 0x10, 0x32, 0x00, 0xc0, 0x42, 0x76,
|
||||
0x1f, 0xac, 0x65, 0x7b, 0x25, 0xd3, 0x59, 0xe8, 0x5d, 0xde, 0x22, 0xb1,
|
||||
0x74, 0x39, 0x7d, 0x0d, 0x6c, 0x56, 0xc9, 0x4f, 0xfc, 0xf2, 0x1f, 0xd0,
|
||||
0x4f, 0x70, 0xe9, 0xd5, 0x5c, 0xb6, 0x79, 0x07, 0x54, 0xb6, 0x8e, 0x67,
|
||||
0xe1, 0xb5, 0x35, 0x18, 0xc0, 0xe3, 0x36, 0xf9, 0x58, 0x15, 0x3f, 0x4e,
|
||||
0xed, 0x74, 0xb5, 0x46, 0xd4, 0x2f, 0x30, 0x22, 0xb2, 0xe1, 0xa9, 0x4d,
|
||||
0xf6, 0x3a, 0x00, 0x22, 0x34, 0xf0, 0x14, 0xc5, 0xa3, 0x53, 0x28, 0x78,
|
||||
0x91, 0x46, 0x1e, 0x80, 0x3d, 0x7e, 0x41, 0x4a, 0x44, 0x3a, 0xd0, 0x83,
|
||||
0x7e, 0xcf, 0xa4, 0x31, 0x0e, 0x0c, 0xfc, 0xcd, 0x63, 0x37, 0x05, 0x8b,
|
||||
0x7f, 0x0d, 0x65, 0xef, 0x52, 0x58, 0xb9, 0x9e, 0xb2, 0xfc, 0x77, 0x7b,
|
||||
0xdb, 0x79, 0x17, 0x3d, 0xb2, 0x84, 0x4a, 0xaf, 0x09, 0x93, 0x1c, 0x45,
|
||||
0x9d, 0x0a, 0x9f, 0xb9, 0x64, 0xec, 0x6f, 0x66, 0x01, 0x49, 0xb6, 0x00,
|
||||
0xf7, 0xff, 0x85, 0x4d, 0xa8, 0x60, 0x07, 0xf6, 0x33, 0x1f, 0xe6, 0x48,
|
||||
0x9e, 0x71, 0x88, 0x60, 0x88, 0x02, 0xbb, 0x1d, 0x07, 0x68, 0x7a, 0xa0,
|
||||
0xfa, 0x4f, 0xfb, 0x42, 0xde, 0x6f, 0x8e, 0x4e, 0x4a, 0xa8, 0xa7, 0xd3,
|
||||
0x5d, 0xcb, 0x38, 0x47, 0x16, 0xb6, 0xea, 0x99, 0x9f, 0x7d, 0xf6, 0xcd,
|
||||
0xd4, 0xe4, 0x5f, 0x9f, 0xb5, 0xb6, 0x61, 0x9d, 0x42, 0x78, 0x10, 0x04,
|
||||
0x00, 0x02, 0x00, 0x23, 0x10, 0x10, 0x00, 0x02, 0x00, 0x0d, 0x10, 0x0d,
|
||||
0x00, 0x01, 0x01, 0x10, 0x08, 0x00, 0x02, 0x21, 0x48, 0x10, 0x44, 0x00,
|
||||
0x01, 0x01, 0x10, 0x21, 0x00, 0x01, 0x20, 0x10, 0x23, 0x00, 0x01, 0x20,
|
||||
0x10, 0x24, 0x00, 0x01, 0x20, 0x10, 0x42, 0x00, 0x01, 0x20, 0x10, 0x54,
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11,
|
||||
0x00, 0x01, 0x20, 0x10, 0x3c, 0x00, 0x01, 0x01, 0x10, 0x02, 0x00, 0x02,
|
||||
0x00, 0x00, 0x10, 0x12, 0x00, 0x02, 0x00, 0x04, 0x10, 0x09, 0x00, 0x02,
|
||||
0x00, 0x00, 0x10, 0x2d, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x10, 0x49,
|
||||
0x00, 0x06, 0x00, 0x37, 0x2a, 0x00, 0x01, 0x20,
|
||||
};
|
||||
|
||||
struct m1_data {
|
||||
struct wsc_m1 expected;
|
||||
const void *pdu;
|
||||
@ -576,8 +611,8 @@ struct m1_data {
|
||||
};
|
||||
|
||||
static const struct m1_data m1_data_1 = {
|
||||
.pdu = eap_wsc_m1 + 18,
|
||||
.len = sizeof(eap_wsc_m1) - 18,
|
||||
.pdu = eap_wsc_m1_1 + 18,
|
||||
.len = sizeof(eap_wsc_m1_1) - 18,
|
||||
.expected = {
|
||||
.version2 = true,
|
||||
.uuid_e = { 0x79, 0x0c, 0x1f, 0x80, 0x4f, 0x2b, 0x52, 0xb7,
|
||||
@ -620,6 +655,51 @@ static const struct m1_data m1_data_1 = {
|
||||
.public_key_size = sizeof(dh_public_key_1),
|
||||
};
|
||||
|
||||
static const struct m1_data m1_data_2 = {
|
||||
.pdu = eap_wsc_m1_2 + 18,
|
||||
.len = sizeof(eap_wsc_m1_2) - 18,
|
||||
.expected = {
|
||||
.version2 = true,
|
||||
.uuid_e = { 0x79, 0x0c, 0x1f, 0x80, 0x4f, 0x2b, 0x52, 0xb7,
|
||||
0xbe, 0x30, 0xc0, 0xe9, 0x72, 0x92, 0x08, 0x8d },
|
||||
.addr = { 0xa0, 0xa8, 0xcd, 0x1c, 0x7e, 0xc9 },
|
||||
.enrollee_nonce = { 0x19, 0x8d, 0x0d, 0x25, 0x91, 0x2c, 0x37,
|
||||
0x1c, 0xeb, 0x07, 0x89, 0x33, 0xe1,
|
||||
0x25, 0xd7, 0x43 },
|
||||
.public_key = { }, /* Tested elsewhere */
|
||||
.auth_type_flags =
|
||||
WSC_AUTHENTICATION_TYPE_WPA2_PERSONAL |
|
||||
WSC_AUTHENTICATION_TYPE_WPA_PERSONAL |
|
||||
WSC_AUTHENTICATION_TYPE_OPEN,
|
||||
.encryption_type_flags = WSC_ENCRYPTION_TYPE_AES_TKIP |
|
||||
WSC_ENCRYPTION_TYPE_NONE,
|
||||
.connection_type_flags = WSC_CONNECTION_TYPE_ESS,
|
||||
.config_methods = WSC_CONFIGURATION_METHOD_VIRTUAL_DISPLAY_PIN |
|
||||
WSC_CONFIGURATION_METHOD_KEYPAD |
|
||||
WSC_CONFIGURATION_METHOD_DISPLAY |
|
||||
WSC_CONFIGURATION_METHOD_NFC_INTERFACE,
|
||||
.state = WSC_STATE_NOT_CONFIGURED,
|
||||
.manufacturer = " ",
|
||||
.model_name = " ",
|
||||
.model_number = " ",
|
||||
.serial_number = " ",
|
||||
.primary_device_type = {
|
||||
.category = 0,
|
||||
.oui = { 0x00, 0x00, 0x00 },
|
||||
.oui_type = 0x00,
|
||||
.subcategory = 0, },
|
||||
.device_name = " ",
|
||||
.rf_bands = WSC_RF_BAND_2_4_GHZ,
|
||||
.association_state = WSC_ASSOCIATION_STATE_NOT_ASSOCIATED,
|
||||
.device_password_id = WSC_DEVICE_PASSWORD_ID_PUSH_BUTTON,
|
||||
.configuration_error = WSC_CONFIGURATION_ERROR_NO_ERROR,
|
||||
.os_version = 0,
|
||||
.request_to_enroll = false,
|
||||
},
|
||||
.public_key = dh_public_key_2,
|
||||
.public_key_size = sizeof(dh_public_key_2),
|
||||
};
|
||||
|
||||
static void wsc_test_parse_m1(const void *data)
|
||||
{
|
||||
const struct m1_data *test = data;
|
||||
@ -879,6 +959,8 @@ int main(int argc, char *argv[])
|
||||
&dh_generate_pubkey_test_data_2);
|
||||
|
||||
l_test_add("/wsc/parse/m1 1", wsc_test_parse_m1, &m1_data_1);
|
||||
l_test_add("/wsc/parse/m1 2", wsc_test_parse_m1, &m1_data_2);
|
||||
|
||||
l_test_add("/wsc/build/m1 1", wsc_test_build_m1, &m1_data_1);
|
||||
|
||||
l_test_add("/wsc/parse/m2 1", wsc_test_parse_m2, &m2_data_1);
|
||||
|
Loading…
Reference in New Issue
Block a user