mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 05:39:24 +01:00
unit: Add another M2 parser test
This commit is contained in:
parent
a867076c3e
commit
b80254375b
@ -767,7 +767,7 @@ static void wsc_test_build_m1(const void *data)
|
|||||||
l_free(out);
|
l_free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char eap_wsc_m2[] = {
|
static const unsigned char eap_wsc_m2_1[] = {
|
||||||
0x01, 0x00, 0x01, 0xd6, 0x01, 0x02, 0x01, 0xd6, 0xfe, 0x00, 0x37, 0x2a,
|
0x01, 0x00, 0x01, 0xd6, 0x01, 0x02, 0x01, 0xd6, 0xfe, 0x00, 0x37, 0x2a,
|
||||||
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
||||||
0x22, 0x00, 0x01, 0x05, 0x10, 0x1a, 0x00, 0x10, 0xab, 0x84, 0x41, 0x2f,
|
0x22, 0x00, 0x01, 0x05, 0x10, 0x1a, 0x00, 0x10, 0xab, 0x84, 0x41, 0x2f,
|
||||||
@ -810,6 +810,49 @@ static const unsigned char eap_wsc_m2[] = {
|
|||||||
0x17, 0xac, 0xd9, 0x33, 0x84, 0x5f,
|
0x17, 0xac, 0xd9, 0x33, 0x84, 0x5f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const unsigned char eap_wsc_m2_2[] = {
|
||||||
|
0x01, 0x00, 0x01, 0xd3, 0x01, 0xa8, 0x01, 0xd3, 0xfe, 0x00, 0x37, 0x2a,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10,
|
||||||
|
0x22, 0x00, 0x01, 0x05, 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, 0x48, 0x00, 0x10,
|
||||||
|
0x8e, 0xd8, 0x32, 0x02, 0xa3, 0x24, 0x52, 0xc0, 0xb0, 0x3e, 0x0c, 0x95,
|
||||||
|
0x18, 0x27, 0xd6, 0xe7, 0x10, 0x32, 0x00, 0xc0, 0x29, 0xdd, 0x2e, 0x36,
|
||||||
|
0x97, 0xa4, 0x25, 0x1c, 0x93, 0x56, 0xef, 0xdd, 0x8c, 0xf4, 0x9e, 0x1c,
|
||||||
|
0xab, 0xbe, 0x42, 0xd1, 0xba, 0xc4, 0xb0, 0xa4, 0x2b, 0xaf, 0x9e, 0xcc,
|
||||||
|
0xe0, 0xfb, 0x94, 0x0c, 0xf1, 0xdf, 0x5d, 0x71, 0x2b, 0xcb, 0x24, 0xd7,
|
||||||
|
0x83, 0x9f, 0xf4, 0xa2, 0xa9, 0x88, 0x86, 0xa2, 0x7f, 0x4f, 0x42, 0xe2,
|
||||||
|
0x76, 0x4a, 0xac, 0x4e, 0x5d, 0x45, 0x15, 0x01, 0x4f, 0x29, 0xbe, 0xa2,
|
||||||
|
0x44, 0xdf, 0x36, 0xb9, 0xff, 0xe3, 0xdf, 0x14, 0x30, 0x21, 0xf2, 0x74,
|
||||||
|
0x9d, 0x57, 0x5b, 0x08, 0xe9, 0x78, 0xad, 0x5c, 0x28, 0x2c, 0x15, 0xcb,
|
||||||
|
0xa2, 0x0d, 0xdb, 0x8c, 0xc5, 0x0f, 0xda, 0x6f, 0x98, 0xd0, 0x84, 0x0b,
|
||||||
|
0x4c, 0xab, 0x0b, 0x1c, 0xd9, 0xee, 0x78, 0xa4, 0xfe, 0x8e, 0x51, 0x8d,
|
||||||
|
0xa1, 0xc5, 0xf1, 0xe1, 0x5e, 0xf1, 0x9b, 0xc4, 0x17, 0xa5, 0x41, 0xb1,
|
||||||
|
0x46, 0x75, 0x9b, 0x03, 0x4e, 0x6c, 0x0b, 0x3a, 0xb9, 0x25, 0xb4, 0x76,
|
||||||
|
0x79, 0x18, 0xdd, 0xba, 0x73, 0xca, 0x32, 0x33, 0x60, 0xd5, 0xb3, 0xef,
|
||||||
|
0xfe, 0x13, 0x3f, 0xfc, 0x91, 0xf3, 0x31, 0xd6, 0x4a, 0xbf, 0xfa, 0x3e,
|
||||||
|
0x89, 0x4d, 0xe6, 0xfa, 0x09, 0x71, 0x0f, 0x8a, 0xc8, 0x67, 0x1f, 0x7e,
|
||||||
|
0xc0, 0xae, 0xb8, 0x15, 0x4d, 0xb9, 0x20, 0xec, 0x40, 0xd2, 0xdf, 0x73,
|
||||||
|
0x09, 0x13, 0x5b, 0x06, 0xe0, 0xc1, 0xfa, 0xe8, 0x10, 0x04, 0x00, 0x02,
|
||||||
|
0x00, 0x3f, 0x10, 0x10, 0x00, 0x02, 0x00, 0x0c, 0x10, 0x0d, 0x00, 0x01,
|
||||||
|
0x01, 0x10, 0x08, 0x00, 0x02, 0x00, 0x00, 0x10, 0x21, 0x00, 0x0a, 0x41,
|
||||||
|
0x70, 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x10, 0x23, 0x00,
|
||||||
|
0x04, 0x4a, 0x32, 0x38, 0x45, 0x10, 0x24, 0x00, 0x19, 0x41, 0x70, 0x70,
|
||||||
|
0x6c, 0x65, 0x20, 0x42, 0x61, 0x73, 0x65, 0x20, 0x53, 0x74, 0x61, 0x74,
|
||||||
|
0x69, 0x6f, 0x6e, 0x20, 0x56, 0x37, 0x2e, 0x37, 0x2e, 0x33, 0x10, 0x42,
|
||||||
|
0x00, 0x0c, 0x43, 0x38, 0x36, 0x4d, 0x44, 0x38, 0x57, 0x48, 0x46, 0x4a,
|
||||||
|
0x31, 0x52, 0x10, 0x54, 0x00, 0x08, 0x00, 0x06, 0x00, 0x50, 0xf2, 0x04,
|
||||||
|
0x00, 0x01, 0x10, 0x11, 0x00, 0x17, 0x44, 0x65, 0x6e, 0x69, 0x73, 0x27,
|
||||||
|
0x73, 0x20, 0x41, 0x69, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x20, 0x45, 0x78,
|
||||||
|
0x74, 0x72, 0x65, 0x6d, 0x65, 0x10, 0x3c, 0x00, 0x01, 0x01, 0x10, 0x02,
|
||||||
|
0x00, 0x02, 0x00, 0x00, 0x10, 0x09, 0x00, 0x02, 0x00, 0x00, 0x10, 0x12,
|
||||||
|
0x00, 0x02, 0x00, 0x04, 0x10, 0x2d, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x49, 0x00, 0x0b, 0x00, 0x00, 0x3f, 0x00, 0x04, 0x00, 0x04, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x08, 0x45, 0x33, 0x07, 0x57, 0x77,
|
||||||
|
0x40, 0x50, 0x37,
|
||||||
|
};
|
||||||
|
|
||||||
struct m2_data {
|
struct m2_data {
|
||||||
struct wsc_m2 expected;
|
struct wsc_m2 expected;
|
||||||
const void *pdu;
|
const void *pdu;
|
||||||
@ -819,8 +862,8 @@ struct m2_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct m2_data m2_data_1 = {
|
static const struct m2_data m2_data_1 = {
|
||||||
.pdu = eap_wsc_m2 + 18,
|
.pdu = eap_wsc_m2_1 + 18,
|
||||||
.len = sizeof(eap_wsc_m2) - 18,
|
.len = sizeof(eap_wsc_m2_1) - 18,
|
||||||
.expected = {
|
.expected = {
|
||||||
.version2 = true,
|
.version2 = true,
|
||||||
.enrollee_nonce = { 0xab, 0x84, 0x41, 0x2f, 0xe7, 0xc3, 0xc9,
|
.enrollee_nonce = { 0xab, 0x84, 0x41, 0x2f, 0xe7, 0xc3, 0xc9,
|
||||||
@ -860,7 +903,53 @@ static const struct m2_data m2_data_1 = {
|
|||||||
.authenticator = { 0xec, 0xb1, 0x17, 0xac, 0xd9, 0x33, 0x84,
|
.authenticator = { 0xec, 0xb1, 0x17, 0xac, 0xd9, 0x33, 0x84,
|
||||||
0x5f },
|
0x5f },
|
||||||
},
|
},
|
||||||
.public_key = eap_wsc_m2 + 92,
|
.public_key = eap_wsc_m2_1 + 92,
|
||||||
|
.public_key_size = 192,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct m2_data m2_data_2 = {
|
||||||
|
.pdu = eap_wsc_m2_2 + 18,
|
||||||
|
.len = sizeof(eap_wsc_m2_2) - 18,
|
||||||
|
.expected = {
|
||||||
|
.version2 = false,
|
||||||
|
.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 },
|
||||||
|
.uuid_r = { 0x8e, 0xd8, 0x32, 0x02, 0xa3, 0x24, 0x52, 0xc0,
|
||||||
|
0xb0, 0x3e, 0x0c, 0x95, 0x18, 0x27, 0xd6, 0xe7, },
|
||||||
|
.public_key = { }, /* Tested elsewhere */
|
||||||
|
.auth_type_flags =
|
||||||
|
WSC_AUTHENTICATION_TYPE_OPEN |
|
||||||
|
WSC_AUTHENTICATION_TYPE_WPA_PERSONAL |
|
||||||
|
WSC_AUTHENTICATION_TYPE_SHARED |
|
||||||
|
WSC_AUTHENTICATION_TYPE_WPA_ENTERPRISE |
|
||||||
|
WSC_AUTHENTICATION_TYPE_WPA2_PERSONAL |
|
||||||
|
WSC_AUTHENTICATION_TYPE_WPA2_ENTERPRISE,
|
||||||
|
.encryption_type_flags = WSC_ENCRYPTION_TYPE_AES_TKIP,
|
||||||
|
.connection_type_flags = WSC_CONNECTION_TYPE_ESS,
|
||||||
|
.config_methods = 0,
|
||||||
|
.manufacturer = "Apple Inc.",
|
||||||
|
.model_name = "J28E",
|
||||||
|
.model_number = "Apple Base Station V7.7.3",
|
||||||
|
.serial_number = "C86MD8WHFJ1R",
|
||||||
|
.primary_device_type = {
|
||||||
|
.category = 6,
|
||||||
|
.oui = { 0x00, 0x50, 0xf2 },
|
||||||
|
.oui_type = 0x04,
|
||||||
|
.subcategory = 1, },
|
||||||
|
.device_name = "Denis's AirPort Extreme",
|
||||||
|
.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,
|
||||||
|
.authenticator = { 0x45, 0x33, 0x07, 0x57, 0x77, 0x40, 0x50,
|
||||||
|
0x37 },
|
||||||
|
},
|
||||||
|
.public_key = eap_wsc_m2_2 + 92,
|
||||||
.public_key_size = 192,
|
.public_key_size = 192,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -965,6 +1054,8 @@ int main(int argc, char *argv[])
|
|||||||
l_test_add("/wsc/build/m1 2", wsc_test_build_m1, &m1_data_2);
|
l_test_add("/wsc/build/m1 2", wsc_test_build_m1, &m1_data_2);
|
||||||
|
|
||||||
l_test_add("/wsc/parse/m2 1", wsc_test_parse_m2, &m2_data_1);
|
l_test_add("/wsc/parse/m2 1", wsc_test_parse_m2, &m2_data_1);
|
||||||
|
l_test_add("/wsc/parse/m2 2", wsc_test_parse_m2, &m2_data_2);
|
||||||
|
|
||||||
l_test_add("/wsc/build/m2 1", wsc_test_build_m2, &m2_data_1);
|
l_test_add("/wsc/build/m2 1", wsc_test_build_m2, &m2_data_1);
|
||||||
|
|
||||||
return l_test_run();
|
return l_test_run();
|
||||||
|
Loading…
Reference in New Issue
Block a user