You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/06/15 02:03:14 UTC
[1/8] incubator-mynewt-core git commit: BLE Host - More SM SC unit
tests.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/upf54 3adbb4e7e -> a1de643d4
BLE Host - More SM SC unit tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/7c0d730c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7c0d730c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7c0d730c
Branch: refs/heads/upf54
Commit: 7c0d730c3c50ce6e28a1adb0eadd9395c7f623a8
Parents: 3adbb4e
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 11:27:38 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 11:27:38 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/test/ble_sm_sc_test.c | 1357 ++++++++++++++++++++++++
1 file changed, 1357 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7c0d730c/net/nimble/host/src/test/ble_sm_sc_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_sc_test.c b/net/nimble/host/src/test/ble_sm_sc_test.c
index 36597ce..7d8cd77 100644
--- a/net/nimble/host/src/test/ble_sm_sc_test.c
+++ b/net/nimble/host/src/test/ble_sm_sc_test.c
@@ -1669,6 +1669,1360 @@ TEST_CASE(ble_sm_sc_us_jw_iio3_rio4_b1_iat0_rat0_ik7_rk5)
ble_sm_test_util_us_sc_good(¶ms);
}
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: passkey entry
+ * Initiator IO capabilities: 2
+ * Responder IO capabilities: 4
+ * Bonding: true
+ * Initiator address type: 0
+ * Responder address type: 0
+ * Initiator key distribution: 7
+ * Responder key distribution: 5
+ */
+TEST_CASE(ble_sm_sc_us_pk_iio2_rio4_b1_iat0_rat0_ik7_rk5)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ .resp_addr = {
+ 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
+ },
+ .pair_req = {
+ .io_cap = 0x02,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x07,
+ },
+ .pair_rsp = {
+ .io_cap = 0x04,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x05,
+ },
+ .our_priv_key = {
+ 0xb1, 0x6b, 0x4f, 0x81, 0xbc, 0xe3, 0x60, 0x9e,
+ 0x00, 0x20, 0xf1, 0x73, 0x3e, 0xfb, 0xcc, 0x6e,
+ 0x8c, 0xb6, 0xd2, 0x51, 0xd9, 0x36, 0x8a, 0x6d,
+ 0xca, 0x8c, 0xd7, 0xbe, 0x96, 0x03, 0xdf, 0xd6,
+ },
+ .public_key_req = {
+ .x = {
+ 0xe5, 0x0f, 0x02, 0x0a, 0x37, 0x90, 0x94, 0x5a,
+ 0x06, 0x21, 0xf7, 0xbc, 0xd5, 0xbe, 0xb9, 0x24,
+ 0x8a, 0x35, 0xfd, 0xf8, 0x5e, 0xe2, 0x70, 0xd5,
+ 0x5a, 0xe8, 0xe7, 0xdd, 0x13, 0x90, 0xeb, 0xd4,
+ },
+ .y = {
+ 0x41, 0xc8, 0x51, 0x1a, 0x25, 0x44, 0x01, 0x53,
+ 0x42, 0x74, 0x07, 0x9c, 0x18, 0xe6, 0x3b, 0x8a,
+ 0xce, 0x7a, 0x37, 0x1f, 0x18, 0x5c, 0x02, 0x7c,
+ 0x67, 0x16, 0xf5, 0x30, 0x2b, 0x31, 0xa9, 0xc7,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1b, 0xd2, 0x03, 0x79, 0xb4, 0x9b, 0x0a, 0xd7,
+ 0x1b, 0x28, 0x73, 0x2a, 0xd7, 0xe6, 0xa0, 0xd4,
+ 0x2d, 0x95, 0x8d, 0x29, 0xaf, 0x6a, 0xab, 0xee,
+ 0xa0, 0x0d, 0x13, 0x4d, 0xe7, 0x16, 0x76, 0x91,
+ },
+ .y = {
+ 0x2a, 0x26, 0x2c, 0x50, 0x55, 0xd1, 0x2b, 0x83,
+ 0xf6, 0x5f, 0xdb, 0x99, 0x5f, 0x85, 0xf6, 0x78,
+ 0x1c, 0x14, 0xed, 0xd3, 0x70, 0x5e, 0xe5, 0x2c,
+ 0x05, 0x1e, 0x5c, 0xec, 0xf8, 0x65, 0x43, 0x49,
+ },
+ },
+ .confirm_req[0] = {
+ .value = {
+ 0x55, 0x2c, 0xaa, 0x41, 0x59, 0x42, 0x4d, 0xfe,
+ 0x47, 0x74, 0xcd, 0x2b, 0x11, 0xab, 0x21, 0xe6,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x6a, 0x3c, 0x45, 0xf5, 0xb2, 0xe2, 0x04, 0x30,
+ 0xde, 0xd6, 0x3c, 0x6d, 0x85, 0x00, 0x00, 0x2c,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0x78, 0x06, 0x04, 0x60, 0x76, 0xe9, 0xc4, 0x5a,
+ 0xfb, 0x34, 0x44, 0xae, 0x45, 0xa0, 0x84, 0xde,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x91, 0xc8, 0xfd, 0x1b, 0xb2, 0x85, 0x08, 0x76,
+ 0xd3, 0xf1, 0xc4, 0xa0, 0xfa, 0x92, 0x8c, 0x94,
+ },
+ },
+ .confirm_req[1] = {
+ .value = {
+ 0xb1, 0x2f, 0x68, 0x35, 0xa1, 0xa5, 0x84, 0xb1,
+ 0x4f, 0x1a, 0xb1, 0xb5, 0xf0, 0xb2, 0xbe, 0x61,
+ },
+ },
+ .confirm_rsp[1] = {
+ .value = {
+ 0x07, 0xd8, 0x43, 0x74, 0xe8, 0x42, 0xf3, 0xf1,
+ 0x87, 0x3d, 0x9e, 0x92, 0xea, 0x33, 0xe8, 0x54,
+ },
+ },
+ .random_req[1] = {
+ .value = {
+ 0x4c, 0xb7, 0xcc, 0x6d, 0x90, 0x9f, 0x1e, 0x2d,
+ 0x9d, 0x1e, 0x52, 0xa7, 0xe0, 0x0c, 0x7b, 0xf7,
+ },
+ },
+ .random_rsp[1] = {
+ .value = {
+ 0x5c, 0x32, 0x82, 0xc8, 0x76, 0x17, 0x3b, 0x18,
+ 0x66, 0xda, 0xbf, 0xc3, 0x13, 0x49, 0x05, 0xfb,
+ },
+ },
+ .confirm_req[2] = {
+ .value = {
+ 0x27, 0x61, 0x4d, 0x04, 0x64, 0xa9, 0x58, 0xf1,
+ 0xe0, 0xf9, 0xe5, 0x78, 0x0b, 0x54, 0x89, 0x0a,
+ },
+ },
+ .confirm_rsp[2] = {
+ .value = {
+ 0xe4, 0x8f, 0xdb, 0xc8, 0x35, 0xed, 0x4e, 0x7d,
+ 0xbc, 0x92, 0x7f, 0x58, 0x02, 0xaa, 0xbf, 0x6b,
+ },
+ },
+ .random_req[2] = {
+ .value = {
+ 0xfe, 0x85, 0x08, 0xe0, 0x35, 0x90, 0x13, 0xa9,
+ 0xd3, 0xcf, 0xb6, 0x6d, 0x36, 0xaf, 0xbd, 0x59,
+ },
+ },
+ .random_rsp[2] = {
+ .value = {
+ 0x47, 0x40, 0x8e, 0x97, 0xe3, 0xfe, 0x8f, 0x52,
+ 0x29, 0x5e, 0x6b, 0x44, 0xdf, 0x0d, 0x60, 0xf4,
+ },
+ },
+ .confirm_req[3] = {
+ .value = {
+ 0xac, 0xab, 0x13, 0x7c, 0x1a, 0x6e, 0x7a, 0xdb,
+ 0xf6, 0xe8, 0x72, 0x9f, 0xc5, 0xc3, 0x99, 0x1b,
+ },
+ },
+ .confirm_rsp[3] = {
+ .value = {
+ 0x79, 0xf2, 0xd1, 0x89, 0x5e, 0xa5, 0xa2, 0x90,
+ 0xee, 0x25, 0x36, 0x81, 0x5a, 0x87, 0x20, 0x82,
+ },
+ },
+ .random_req[3] = {
+ .value = {
+ 0xd4, 0x46, 0xa0, 0xc4, 0x3d, 0xae, 0x22, 0x06,
+ 0xaf, 0x5d, 0x93, 0x96, 0xb7, 0x06, 0xc3, 0x61,
+ },
+ },
+ .random_rsp[3] = {
+ .value = {
+ 0x5f, 0x81, 0x97, 0x8b, 0x52, 0x87, 0x1c, 0x67,
+ 0xe0, 0x04, 0xcc, 0x50, 0xd9, 0x2b, 0x16, 0xb5,
+ },
+ },
+ .confirm_req[4] = {
+ .value = {
+ 0x6c, 0x51, 0xc3, 0x61, 0x77, 0x7f, 0xf1, 0x05,
+ 0x9e, 0x0f, 0xba, 0xfd, 0x32, 0x02, 0x09, 0x45,
+ },
+ },
+ .confirm_rsp[4] = {
+ .value = {
+ 0x54, 0xe5, 0x24, 0x81, 0x62, 0x68, 0xe2, 0x45,
+ 0x86, 0x2c, 0x11, 0x28, 0x15, 0xa8, 0x8e, 0x5b,
+ },
+ },
+ .random_req[4] = {
+ .value = {
+ 0xbb, 0x29, 0x3a, 0xba, 0xe6, 0x4f, 0x06, 0xcf,
+ 0xa3, 0x13, 0x27, 0xf2, 0xcb, 0xe4, 0xd2, 0xe6,
+ },
+ },
+ .random_rsp[4] = {
+ .value = {
+ 0x50, 0xba, 0xd0, 0x0e, 0x26, 0xab, 0x04, 0xf8,
+ 0xa2, 0x03, 0x1e, 0x63, 0x9a, 0xf7, 0x15, 0xdc,
+ },
+ },
+ .confirm_req[5] = {
+ .value = {
+ 0x12, 0x3e, 0xfe, 0x5a, 0xb1, 0x09, 0x6f, 0x17,
+ 0xb7, 0x77, 0x7e, 0x65, 0x88, 0xd4, 0x95, 0x56,
+ },
+ },
+ .confirm_rsp[5] = {
+ .value = {
+ 0xc6, 0x9b, 0xac, 0xde, 0x7e, 0x03, 0x7a, 0xd3,
+ 0xf1, 0xff, 0x3c, 0x4f, 0x4a, 0x85, 0xba, 0x73,
+ },
+ },
+ .random_req[5] = {
+ .value = {
+ 0x17, 0xd5, 0x5e, 0x69, 0x30, 0x2c, 0x1f, 0x01,
+ 0x87, 0x9c, 0xd6, 0xd2, 0xe4, 0x48, 0x8c, 0x84,
+ },
+ },
+ .random_rsp[5] = {
+ .value = {
+ 0x9d, 0x54, 0x83, 0x4a, 0xcd, 0x93, 0x7c, 0x1e,
+ 0x5b, 0xaf, 0xd2, 0x66, 0x8c, 0x2d, 0xaa, 0xc3,
+ },
+ },
+ .confirm_req[6] = {
+ .value = {
+ 0xdc, 0x24, 0x69, 0xa8, 0xd3, 0xa9, 0x17, 0x11,
+ 0x08, 0x37, 0x1a, 0x1e, 0x92, 0x03, 0xee, 0x36,
+ },
+ },
+ .confirm_rsp[6] = {
+ .value = {
+ 0x98, 0xf8, 0x72, 0x71, 0x99, 0xa0, 0xbd, 0xcd,
+ 0xb1, 0x97, 0x4c, 0x8a, 0xb8, 0xa8, 0x1a, 0x52,
+ },
+ },
+ .random_req[6] = {
+ .value = {
+ 0xbf, 0xb1, 0x8e, 0xa5, 0x14, 0xe3, 0xeb, 0x9e,
+ 0x29, 0x27, 0xe0, 0x19, 0xb1, 0xb2, 0x5c, 0xfe,
+ },
+ },
+ .random_rsp[6] = {
+ .value = {
+ 0xae, 0x8a, 0x92, 0x78, 0x53, 0x7b, 0xdb, 0x8c,
+ 0xec, 0x3a, 0x99, 0x2b, 0x94, 0xf1, 0x17, 0xfe,
+ },
+ },
+ .confirm_req[7] = {
+ .value = {
+ 0xcf, 0xaf, 0x70, 0x73, 0x53, 0x65, 0x89, 0x57,
+ 0x36, 0x98, 0xd2, 0x28, 0x86, 0x79, 0xfe, 0x85,
+ },
+ },
+ .confirm_rsp[7] = {
+ .value = {
+ 0x0d, 0x2d, 0x77, 0x8a, 0x21, 0x11, 0xd9, 0x61,
+ 0x9f, 0x80, 0x32, 0x8a, 0x32, 0x09, 0x42, 0x42,
+ },
+ },
+ .random_req[7] = {
+ .value = {
+ 0x8b, 0xd2, 0x53, 0xcd, 0x96, 0xd1, 0x14, 0xb5,
+ 0xea, 0x17, 0xb1, 0xa3, 0xa8, 0xfc, 0x3c, 0x2b,
+ },
+ },
+ .random_rsp[7] = {
+ .value = {
+ 0xc2, 0x4f, 0x84, 0x60, 0x54, 0x79, 0x16, 0xed,
+ 0x1a, 0x6e, 0x78, 0xa0, 0x99, 0x58, 0xf2, 0x94,
+ },
+ },
+ .confirm_req[8] = {
+ .value = {
+ 0x9a, 0x4c, 0xbc, 0x9c, 0x55, 0x15, 0xa2, 0x4f,
+ 0xa2, 0x5d, 0x3b, 0xa7, 0x43, 0xb3, 0x9c, 0x63,
+ },
+ },
+ .confirm_rsp[8] = {
+ .value = {
+ 0xa3, 0xb1, 0x88, 0xa5, 0x70, 0xca, 0xa3, 0xa9,
+ 0x67, 0x2a, 0xac, 0x99, 0x5e, 0x61, 0x68, 0xa0,
+ },
+ },
+ .random_req[8] = {
+ .value = {
+ 0xcf, 0xcf, 0x5b, 0x94, 0xe0, 0xb2, 0x9d, 0x5a,
+ 0x86, 0x71, 0x45, 0xce, 0xd9, 0xce, 0x13, 0xba,
+ },
+ },
+ .random_rsp[8] = {
+ .value = {
+ 0x10, 0x96, 0x8a, 0x50, 0xa4, 0xd0, 0xaa, 0x5f,
+ 0xd6, 0x32, 0xdb, 0x09, 0x7e, 0x22, 0x96, 0x42,
+ },
+ },
+ .confirm_req[9] = {
+ .value = {
+ 0xf0, 0x90, 0x61, 0x25, 0x04, 0x29, 0x4f, 0xb6,
+ 0x8b, 0xd5, 0x73, 0x49, 0xbd, 0xf7, 0x9b, 0xe7,
+ },
+ },
+ .confirm_rsp[9] = {
+ .value = {
+ 0x5b, 0xe6, 0xb4, 0x3f, 0x1b, 0x77, 0x12, 0x75,
+ 0x84, 0x94, 0xc6, 0x07, 0xfa, 0xa1, 0x41, 0x94,
+ },
+ },
+ .random_req[9] = {
+ .value = {
+ 0x3d, 0x1a, 0xa3, 0x95, 0xec, 0x72, 0x84, 0xf4,
+ 0xc5, 0xcd, 0xaa, 0x48, 0xe9, 0x0c, 0x0f, 0xe3,
+ },
+ },
+ .random_rsp[9] = {
+ .value = {
+ 0x8a, 0x5a, 0x53, 0xfc, 0x07, 0x52, 0x01, 0xb9,
+ 0xe9, 0x2d, 0xe7, 0x9d, 0x8c, 0x7c, 0xc7, 0xb3,
+ },
+ },
+ .confirm_req[10] = {
+ .value = {
+ 0xe7, 0x8e, 0xc5, 0x08, 0x7f, 0x7e, 0xb8, 0xdc,
+ 0x05, 0x88, 0x3a, 0x92, 0x5a, 0xf5, 0x9b, 0xa9,
+ },
+ },
+ .confirm_rsp[10] = {
+ .value = {
+ 0xf7, 0xa2, 0xb6, 0xec, 0xcd, 0xef, 0xcb, 0xb7,
+ 0x6f, 0xc3, 0xac, 0x17, 0xe2, 0xfd, 0xfa, 0x42,
+ },
+ },
+ .random_req[10] = {
+ .value = {
+ 0x0d, 0xd1, 0xa2, 0x1d, 0xff, 0x74, 0xc5, 0x99,
+ 0xe0, 0x67, 0x07, 0x99, 0x95, 0x75, 0x39, 0x76,
+ },
+ },
+ .random_rsp[10] = {
+ .value = {
+ 0x2f, 0x13, 0xd1, 0x59, 0xfe, 0x20, 0x60, 0xf0,
+ 0x02, 0x0c, 0xea, 0x79, 0xd7, 0x40, 0x86, 0x85,
+ },
+ },
+ .confirm_req[11] = {
+ .value = {
+ 0x8b, 0x57, 0x87, 0xdd, 0xb1, 0xcc, 0x2d, 0x65,
+ 0xc1, 0xba, 0xac, 0x88, 0x48, 0x23, 0xda, 0xe7,
+ },
+ },
+ .confirm_rsp[11] = {
+ .value = {
+ 0xb3, 0xc4, 0x2e, 0xea, 0x33, 0xaf, 0x12, 0x9c,
+ 0xb5, 0xab, 0xa1, 0x95, 0x30, 0xca, 0x46, 0x48,
+ },
+ },
+ .random_req[11] = {
+ .value = {
+ 0x35, 0x57, 0xcd, 0xd5, 0xd2, 0xf8, 0xd7, 0xf2,
+ 0x7b, 0xe3, 0xd7, 0xba, 0x31, 0xa5, 0xca, 0xfd,
+ },
+ },
+ .random_rsp[11] = {
+ .value = {
+ 0xe2, 0x3b, 0x20, 0xbe, 0xec, 0xa5, 0x34, 0x3b,
+ 0x76, 0x23, 0x53, 0x28, 0x36, 0xc4, 0x60, 0x13,
+ },
+ },
+ .confirm_req[12] = {
+ .value = {
+ 0xc9, 0xfe, 0x03, 0x49, 0xe4, 0xff, 0x7e, 0xf7,
+ 0x00, 0xd1, 0x2b, 0x13, 0xb1, 0x15, 0x6e, 0x92,
+ },
+ },
+ .confirm_rsp[12] = {
+ .value = {
+ 0xbc, 0xa2, 0xf2, 0x03, 0x5c, 0xfd, 0x20, 0x7b,
+ 0xd0, 0x1f, 0xd6, 0x50, 0xec, 0xc6, 0x7b, 0x31,
+ },
+ },
+ .random_req[12] = {
+ .value = {
+ 0x04, 0x50, 0xea, 0xb8, 0xca, 0x36, 0x1a, 0x61,
+ 0x92, 0xed, 0xa0, 0x67, 0x78, 0x15, 0x10, 0xb5,
+ },
+ },
+ .random_rsp[12] = {
+ .value = {
+ 0x0c, 0x8e, 0x9d, 0x7b, 0x9d, 0x7e, 0xda, 0x23,
+ 0xbb, 0x61, 0xd9, 0xff, 0x46, 0x77, 0x33, 0x1b,
+ },
+ },
+ .confirm_req[13] = {
+ .value = {
+ 0x9a, 0xff, 0xd6, 0xe5, 0x1a, 0xc3, 0xd3, 0x37,
+ 0x34, 0xeb, 0x3e, 0x3a, 0x8e, 0x0b, 0x86, 0xb4,
+ },
+ },
+ .confirm_rsp[13] = {
+ .value = {
+ 0xf6, 0x32, 0x19, 0xb4, 0x08, 0x6b, 0x8a, 0x0f,
+ 0xc9, 0x9c, 0x1b, 0x68, 0xb8, 0xa0, 0xd0, 0xc9,
+ },
+ },
+ .random_req[13] = {
+ .value = {
+ 0x86, 0xeb, 0x5c, 0xf9, 0x33, 0x54, 0x7d, 0xe4,
+ 0xa4, 0xe2, 0xe1, 0xf6, 0x6b, 0xea, 0x34, 0xed,
+ },
+ },
+ .random_rsp[13] = {
+ .value = {
+ 0xad, 0x53, 0xa0, 0x6e, 0xde, 0x1d, 0xda, 0x99,
+ 0x31, 0x45, 0xe5, 0x3a, 0x73, 0xa1, 0x5e, 0xe1,
+ },
+ },
+ .confirm_req[14] = {
+ .value = {
+ 0x93, 0xd4, 0xe0, 0xaa, 0x0c, 0x91, 0xba, 0xde,
+ 0xc9, 0x5c, 0x68, 0xb0, 0xce, 0xb6, 0x84, 0xcd,
+ },
+ },
+ .confirm_rsp[14] = {
+ .value = {
+ 0x85, 0xc7, 0x05, 0x02, 0x21, 0x9d, 0x4c, 0x4c,
+ 0x16, 0xf7, 0x8f, 0x7b, 0xaa, 0xb4, 0x8f, 0x37,
+ },
+ },
+ .random_req[14] = {
+ .value = {
+ 0x84, 0xfd, 0xf1, 0x39, 0x1a, 0x9a, 0xa5, 0xb8,
+ 0x49, 0xc0, 0x66, 0xdc, 0x33, 0x71, 0x32, 0x87,
+ },
+ },
+ .random_rsp[14] = {
+ .value = {
+ 0x5d, 0xaf, 0x38, 0xcd, 0xb5, 0x83, 0xaa, 0xa0,
+ 0xab, 0x30, 0x82, 0xed, 0x6f, 0xd2, 0x75, 0xe7,
+ },
+ },
+ .confirm_req[15] = {
+ .value = {
+ 0x88, 0x12, 0xe8, 0x89, 0xd4, 0x52, 0x6d, 0xac,
+ 0x61, 0x2a, 0x85, 0x85, 0x1e, 0x9c, 0x82, 0x21,
+ },
+ },
+ .confirm_rsp[15] = {
+ .value = {
+ 0xc1, 0xe9, 0xcd, 0x21, 0x29, 0x6a, 0x78, 0xe4,
+ 0x7b, 0x7d, 0x73, 0x25, 0x9e, 0x9b, 0x95, 0x8b,
+ },
+ },
+ .random_req[15] = {
+ .value = {
+ 0x95, 0x87, 0x9d, 0x5a, 0x10, 0x14, 0xa0, 0xdf,
+ 0x5e, 0x02, 0x22, 0x39, 0x23, 0xc9, 0xbc, 0xba,
+ },
+ },
+ .random_rsp[15] = {
+ .value = {
+ 0x1b, 0x91, 0xe2, 0xdf, 0xca, 0xfe, 0x2b, 0x61,
+ 0x33, 0x8c, 0x83, 0xbf, 0xcf, 0xc3, 0x72, 0xcc,
+ },
+ },
+ .confirm_req[16] = {
+ .value = {
+ 0xce, 0xc9, 0x68, 0xf7, 0xea, 0x41, 0x18, 0x5c,
+ 0x16, 0x6a, 0x98, 0x13, 0x0c, 0x10, 0xc2, 0xa3,
+ },
+ },
+ .confirm_rsp[16] = {
+ .value = {
+ 0x97, 0x73, 0xc9, 0x72, 0x68, 0x99, 0x63, 0xed,
+ 0x81, 0x3b, 0x5c, 0xee, 0x37, 0xfc, 0xca, 0xae,
+ },
+ },
+ .random_req[16] = {
+ .value = {
+ 0x5b, 0x85, 0xb0, 0x1b, 0xc3, 0xde, 0x18, 0xba,
+ 0xc1, 0xc7, 0x89, 0x99, 0xfe, 0xcd, 0xdb, 0x6a,
+ },
+ },
+ .random_rsp[16] = {
+ .value = {
+ 0x5e, 0x1a, 0xcb, 0xbc, 0xda, 0x41, 0x06, 0x5a,
+ 0x14, 0x34, 0x3a, 0xb1, 0xa1, 0x6f, 0xb2, 0xd8,
+ },
+ },
+ .confirm_req[17] = {
+ .value = {
+ 0x1d, 0x59, 0x8a, 0xb0, 0x19, 0xe5, 0xff, 0x45,
+ 0xb6, 0xc3, 0x33, 0x64, 0xd1, 0x6e, 0xee, 0xdd,
+ },
+ },
+ .confirm_rsp[17] = {
+ .value = {
+ 0x4c, 0x9b, 0xe8, 0x68, 0x52, 0x34, 0xef, 0xe1,
+ 0x84, 0xbd, 0x37, 0x85, 0x53, 0x0d, 0xd5, 0xc1,
+ },
+ },
+ .random_req[17] = {
+ .value = {
+ 0xa6, 0xf7, 0x97, 0x18, 0x9a, 0x3e, 0x9d, 0xcf,
+ 0x91, 0xa3, 0xa3, 0x8e, 0xda, 0x8f, 0x8f, 0x90,
+ },
+ },
+ .random_rsp[17] = {
+ .value = {
+ 0x94, 0x10, 0x19, 0x17, 0x8d, 0x0a, 0x72, 0xfd,
+ 0x24, 0x9d, 0xfd, 0x37, 0x4e, 0xdf, 0x4c, 0x30,
+ },
+ },
+ .confirm_req[18] = {
+ .value = {
+ 0xfc, 0x64, 0x8a, 0x8b, 0x37, 0x17, 0x90, 0x6d,
+ 0x25, 0x0e, 0xc6, 0x18, 0xc9, 0xc9, 0xc2, 0x2a,
+ },
+ },
+ .confirm_rsp[18] = {
+ .value = {
+ 0x50, 0x98, 0x86, 0xf5, 0xc0, 0xda, 0x45, 0x2d,
+ 0xea, 0xc8, 0x9d, 0x28, 0x04, 0xd8, 0x73, 0x6f,
+ },
+ },
+ .random_req[18] = {
+ .value = {
+ 0x13, 0x10, 0x38, 0xe8, 0x17, 0x6d, 0x72, 0xd5,
+ 0x94, 0xaf, 0xed, 0x4f, 0x23, 0xa0, 0x41, 0xfc,
+ },
+ },
+ .random_rsp[18] = {
+ .value = {
+ 0xdf, 0xed, 0xf7, 0x08, 0xce, 0x64, 0xbc, 0x11,
+ 0x41, 0x7a, 0xd9, 0xf7, 0x4a, 0xd9, 0x4a, 0x15,
+ },
+ },
+ .confirm_req[19] = {
+ .value = {
+ 0xae, 0x24, 0x8f, 0xdf, 0xb0, 0x57, 0xc4, 0x9c,
+ 0xe6, 0xae, 0x9b, 0xc2, 0x4d, 0x3d, 0x1c, 0xcb,
+ },
+ },
+ .confirm_rsp[19] = {
+ .value = {
+ 0xcc, 0x5c, 0xa3, 0xbe, 0xd7, 0x83, 0xee, 0x60,
+ 0x80, 0xff, 0x5f, 0x1a, 0x07, 0xbf, 0x4c, 0x33,
+ },
+ },
+ .random_req[19] = {
+ .value = {
+ 0x93, 0xc3, 0x62, 0x06, 0xcb, 0xe5, 0xb0, 0x01,
+ 0x02, 0x18, 0xa2, 0x50, 0x4c, 0x73, 0xa2, 0x27,
+ },
+ },
+ .random_rsp[19] = {
+ .value = {
+ 0x11, 0x2a, 0xd3, 0x06, 0x28, 0x9c, 0xdf, 0x73,
+ 0xa5, 0xa4, 0xe5, 0x1e, 0x07, 0xcf, 0xee, 0x71,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x73, 0xa0, 0x40, 0x58, 0x78, 0x20, 0x5f, 0x2c,
+ 0xf4, 0x19, 0x23, 0xa8, 0x74, 0xbd, 0xc2, 0x3e,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x5a, 0x30, 0xbc, 0xce, 0xec, 0xdf, 0xf0, 0x32,
+ 0x3c, 0x18, 0xa3, 0xd3, 0x3f, 0x20, 0x87, 0x10,
+ },
+ },
+ .sign_info_req = {
+ .sig_key = {
+ 0x2e, 0x81, 0x09, 0xde, 0x32, 0xc5, 0x28, 0x34,
+ 0xe1, 0x45, 0x4a, 0x35, 0x49, 0xef, 0xa2, 0xed,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xef, 0x8d, 0xe2, 0x16, 0x4f, 0xec, 0x43, 0x0d,
+ 0xbf, 0x5b, 0xdd, 0x34, 0xc0, 0x53, 0x1e, 0xb8,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0x90, 0x3d, 0x26, 0x65, 0xc1, 0xd1, 0x5a, 0x9d,
+ 0xda, 0xab, 0x0d, 0x00, 0x05, 0x0e, 0x6c, 0x5d,
+ },
+ },
+ .ltk = {
+ 0xf1, 0x41, 0x1a, 0x5b, 0x60, 0xc1, 0x43, 0xc6,
+ 0x80, 0x34, 0x5e, 0x7f, 0xd8, 0x0c, 0x75, 0xdc,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_PASSKEY,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_INPUT,
+ .passkey = 516645,
+ },
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: passkey entry
+ * Initiator IO capabilities: 0
+ * Responder IO capabilities: 4
+ * Bonding: true
+ * Initiator address type: 0
+ * Responder address type: 0
+ * Initiator key distribution: 7
+ * Responder key distribution: 5
+ */
+TEST_CASE(ble_sm_sc_us_pk_iio0_rio4_b1_iat0_rat0_ik7_rk5)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ .resp_addr = {
+ 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
+ },
+ .pair_req = {
+ .io_cap = 0x00,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x07,
+ },
+ .pair_rsp = {
+ .io_cap = 0x04,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x05,
+ },
+ .our_priv_key = {
+ 0xb1, 0x6b, 0x4f, 0x81, 0xbc, 0xe3, 0x60, 0x9e,
+ 0x00, 0x20, 0xf1, 0x73, 0x3e, 0xfb, 0xcc, 0x6e,
+ 0x8c, 0xb6, 0xd2, 0x51, 0xd9, 0x36, 0x8a, 0x6d,
+ 0xca, 0x8c, 0xd7, 0xbe, 0x96, 0x03, 0xdf, 0xd6,
+ },
+ .public_key_req = {
+ .x = {
+ 0xe5, 0x0f, 0x02, 0x0a, 0x37, 0x90, 0x94, 0x5a,
+ 0x06, 0x21, 0xf7, 0xbc, 0xd5, 0xbe, 0xb9, 0x24,
+ 0x8a, 0x35, 0xfd, 0xf8, 0x5e, 0xe2, 0x70, 0xd5,
+ 0x5a, 0xe8, 0xe7, 0xdd, 0x13, 0x90, 0xeb, 0xd4,
+ },
+ .y = {
+ 0x41, 0xc8, 0x51, 0x1a, 0x25, 0x44, 0x01, 0x53,
+ 0x42, 0x74, 0x07, 0x9c, 0x18, 0xe6, 0x3b, 0x8a,
+ 0xce, 0x7a, 0x37, 0x1f, 0x18, 0x5c, 0x02, 0x7c,
+ 0x67, 0x16, 0xf5, 0x30, 0x2b, 0x31, 0xa9, 0xc7,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x03, 0x0d, 0x13, 0x55, 0xd9, 0xee, 0x3f, 0xac,
+ 0x8e, 0x8a, 0xa6, 0x2a, 0xcb, 0x60, 0x35, 0xb9,
+ 0xb2, 0x4d, 0x63, 0x91, 0x5e, 0xa1, 0xdd, 0xdf,
+ 0x60, 0xdc, 0x6e, 0x09, 0xb9, 0x9e, 0xf1, 0x4d,
+ },
+ .y = {
+ 0xa8, 0x09, 0x31, 0x1e, 0x39, 0x96, 0x74, 0x41,
+ 0xea, 0x19, 0x4f, 0x24, 0x36, 0x57, 0x7c, 0x9f,
+ 0x21, 0xa3, 0xad, 0xa1, 0x3d, 0xe2, 0x1c, 0x6a,
+ 0xd6, 0xc9, 0xdb, 0xff, 0xce, 0x0a, 0x94, 0x12,
+ },
+ },
+ .confirm_req[0] = {
+ .value = {
+ 0x3b, 0x3d, 0xb2, 0x2f, 0x72, 0x0f, 0x93, 0x19,
+ 0x95, 0xdb, 0x88, 0xdf, 0x5d, 0x58, 0x95, 0x37,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x98, 0xab, 0x20, 0x8d, 0x51, 0x3b, 0x6c, 0x29,
+ 0x2d, 0x73, 0x15, 0xf6, 0x6d, 0x6d, 0xb9, 0xb3,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0xc1, 0xdf, 0x20, 0x3d, 0x7b, 0xcb, 0x5f, 0xe2,
+ 0x9a, 0x23, 0x9c, 0xba, 0x2f, 0x42, 0x3c, 0xb8,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x7d, 0x82, 0xb4, 0xae, 0x41, 0xdb, 0x67, 0x8f,
+ 0x54, 0x01, 0x21, 0x64, 0x31, 0xd4, 0xfc, 0xb5,
+ },
+ },
+ .confirm_req[1] = {
+ .value = {
+ 0xc3, 0xa5, 0xd0, 0xdd, 0xd5, 0xec, 0x1d, 0xc3,
+ 0x14, 0x95, 0x79, 0xb2, 0x61, 0x4d, 0x4f, 0x36,
+ },
+ },
+ .confirm_rsp[1] = {
+ .value = {
+ 0xe2, 0x20, 0xf4, 0x4d, 0xa1, 0x9c, 0x83, 0x51,
+ 0x18, 0xf9, 0x35, 0x2a, 0x51, 0x50, 0xdf, 0xe7,
+ },
+ },
+ .random_req[1] = {
+ .value = {
+ 0x71, 0xcb, 0x01, 0xb4, 0x83, 0xdc, 0xd8, 0x54,
+ 0x0f, 0xe5, 0xd5, 0x6b, 0x6a, 0x0d, 0x98, 0xb6,
+ },
+ },
+ .random_rsp[1] = {
+ .value = {
+ 0x30, 0xbf, 0xd3, 0xfd, 0xf4, 0xc2, 0xa1, 0xd0,
+ 0xba, 0x4b, 0x27, 0x7c, 0x29, 0x98, 0x54, 0xa2,
+ },
+ },
+ .confirm_req[2] = {
+ .value = {
+ 0xf0, 0x92, 0xc4, 0xda, 0x8a, 0x17, 0x7c, 0xc6,
+ 0x14, 0x05, 0x7d, 0xbb, 0xfc, 0x7c, 0xcd, 0x0a,
+ },
+ },
+ .confirm_rsp[2] = {
+ .value = {
+ 0xf3, 0x89, 0xca, 0xe0, 0xfb, 0xbe, 0x8c, 0xc3,
+ 0x4c, 0x6c, 0x6e, 0x11, 0x36, 0x4e, 0xaa, 0x25,
+ },
+ },
+ .random_req[2] = {
+ .value = {
+ 0x78, 0x5a, 0xf0, 0x1e, 0x2a, 0x0d, 0x16, 0xb3,
+ 0x03, 0x4b, 0x4b, 0x68, 0x17, 0xe0, 0xf0, 0x82,
+ },
+ },
+ .random_rsp[2] = {
+ .value = {
+ 0xbf, 0x96, 0xdd, 0xf5, 0x30, 0x2a, 0xe9, 0x8c,
+ 0xb9, 0x13, 0xc5, 0xb7, 0x15, 0x1f, 0xa3, 0x9b,
+ },
+ },
+ .confirm_req[3] = {
+ .value = {
+ 0x36, 0xe4, 0x4c, 0x00, 0xe7, 0x0d, 0xee, 0xe4,
+ 0x95, 0xb8, 0x6a, 0xf9, 0xf7, 0x24, 0xef, 0xea,
+ },
+ },
+ .confirm_rsp[3] = {
+ .value = {
+ 0x2e, 0x90, 0x87, 0x85, 0xb8, 0x29, 0x93, 0x9e,
+ 0x38, 0xa6, 0xdb, 0x17, 0xb2, 0xa8, 0x32, 0x65,
+ },
+ },
+ .random_req[3] = {
+ .value = {
+ 0x0a, 0xee, 0x93, 0xf6, 0x56, 0x35, 0x8e, 0xed,
+ 0x3f, 0x45, 0xa5, 0x01, 0x59, 0xeb, 0xea, 0xa8,
+ },
+ },
+ .random_rsp[3] = {
+ .value = {
+ 0x38, 0xd0, 0xf8, 0x11, 0x5e, 0x47, 0x72, 0x66,
+ 0xce, 0x56, 0x9c, 0x81, 0x5f, 0x52, 0xd4, 0x9a,
+ },
+ },
+ .confirm_req[4] = {
+ .value = {
+ 0x2c, 0x98, 0x9b, 0x71, 0xe4, 0xde, 0x6d, 0x20,
+ 0x84, 0x30, 0xab, 0x7a, 0xfc, 0x43, 0x82, 0xc6,
+ },
+ },
+ .confirm_rsp[4] = {
+ .value = {
+ 0x76, 0xfe, 0x1f, 0x78, 0xaa, 0x42, 0xd5, 0xc6,
+ 0x9f, 0xe4, 0xa7, 0xc7, 0xb8, 0xd2, 0x1e, 0x59,
+ },
+ },
+ .random_req[4] = {
+ .value = {
+ 0x61, 0x5e, 0x47, 0xb1, 0x77, 0x6f, 0x04, 0xee,
+ 0x94, 0xc4, 0x6c, 0xa9, 0xf5, 0xf8, 0x11, 0x6e,
+ },
+ },
+ .random_rsp[4] = {
+ .value = {
+ 0xa5, 0xad, 0x98, 0x65, 0x28, 0xfc, 0x6b, 0x02,
+ 0x6d, 0x9a, 0x29, 0x61, 0x1c, 0x02, 0x0a, 0x6b,
+ },
+ },
+ .confirm_req[5] = {
+ .value = {
+ 0x4d, 0x55, 0x3e, 0x1f, 0x87, 0x12, 0xc7, 0x6c,
+ 0xd7, 0x9a, 0xa6, 0xf1, 0x6e, 0x48, 0xd3, 0x7d,
+ },
+ },
+ .confirm_rsp[5] = {
+ .value = {
+ 0xff, 0x77, 0x6e, 0xba, 0x1f, 0xb7, 0xbd, 0x0b,
+ 0x3f, 0xce, 0xd5, 0x39, 0x81, 0x17, 0x51, 0xfc,
+ },
+ },
+ .random_req[5] = {
+ .value = {
+ 0xf9, 0x2c, 0x77, 0x41, 0xcd, 0x9a, 0x10, 0x99,
+ 0xc6, 0x70, 0x5a, 0xc8, 0x24, 0x26, 0xb2, 0xc8,
+ },
+ },
+ .random_rsp[5] = {
+ .value = {
+ 0xa0, 0x44, 0x0a, 0x8b, 0xda, 0x6a, 0x74, 0x90,
+ 0x5f, 0x89, 0x44, 0xa5, 0x9a, 0x58, 0xd5, 0x08,
+ },
+ },
+ .confirm_req[6] = {
+ .value = {
+ 0x7e, 0x6e, 0x89, 0xc8, 0xbe, 0xde, 0x1c, 0xc3,
+ 0x45, 0xb6, 0x4c, 0x83, 0x71, 0xe2, 0xd6, 0xda,
+ },
+ },
+ .confirm_rsp[6] = {
+ .value = {
+ 0x4a, 0x29, 0x7b, 0x88, 0x97, 0xc1, 0x60, 0x85,
+ 0x32, 0x7d, 0xf1, 0xaa, 0x04, 0x13, 0x89, 0x11,
+ },
+ },
+ .random_req[6] = {
+ .value = {
+ 0x2a, 0xaf, 0x7d, 0x21, 0x4e, 0x14, 0xf5, 0x7e,
+ 0xcc, 0x39, 0xf7, 0x56, 0x45, 0x87, 0x23, 0x64,
+ },
+ },
+ .random_rsp[6] = {
+ .value = {
+ 0x74, 0xd2, 0xff, 0xf0, 0x19, 0xf7, 0x87, 0xe7,
+ 0x0d, 0x65, 0x27, 0x61, 0xea, 0x9e, 0x05, 0x3d,
+ },
+ },
+ .confirm_req[7] = {
+ .value = {
+ 0x4f, 0x77, 0x22, 0x08, 0x58, 0xed, 0x8c, 0x60,
+ 0xbf, 0xbc, 0x78, 0x0c, 0x80, 0xc9, 0xb7, 0x60,
+ },
+ },
+ .confirm_rsp[7] = {
+ .value = {
+ 0xd2, 0x47, 0xfd, 0xea, 0xa3, 0x32, 0x53, 0xc1,
+ 0x06, 0xcd, 0x64, 0xeb, 0x88, 0x64, 0x0e, 0xe5,
+ },
+ },
+ .random_req[7] = {
+ .value = {
+ 0xc8, 0xd0, 0x45, 0xa8, 0x29, 0xdb, 0x5a, 0x42,
+ 0xfe, 0x68, 0xa8, 0x7a, 0x0a, 0x13, 0x22, 0xa4,
+ },
+ },
+ .random_rsp[7] = {
+ .value = {
+ 0x78, 0x14, 0x46, 0xe2, 0x47, 0x0e, 0xd4, 0xb4,
+ 0xde, 0x35, 0x4a, 0x82, 0x4b, 0x32, 0x9b, 0x46,
+ },
+ },
+ .confirm_req[8] = {
+ .value = {
+ 0x24, 0x96, 0xe5, 0x50, 0xfa, 0xff, 0xba, 0xdf,
+ 0x6b, 0x76, 0x40, 0x60, 0x56, 0x5e, 0x5a, 0x66,
+ },
+ },
+ .confirm_rsp[8] = {
+ .value = {
+ 0x09, 0xfe, 0x15, 0x3e, 0x55, 0xe5, 0xbe, 0xb7,
+ 0x8d, 0xaa, 0x04, 0x59, 0xe6, 0x8b, 0x2c, 0x4e,
+ },
+ },
+ .random_req[8] = {
+ .value = {
+ 0x02, 0x25, 0xbe, 0x88, 0x37, 0xb4, 0x6e, 0xcb,
+ 0xbc, 0xa9, 0xef, 0x5a, 0xfd, 0x1a, 0x5f, 0x5f,
+ },
+ },
+ .random_rsp[8] = {
+ .value = {
+ 0x0b, 0x35, 0xdc, 0x9b, 0x3d, 0xf7, 0xa6, 0x99,
+ 0xf3, 0xb9, 0x3c, 0x73, 0x67, 0x0e, 0xcc, 0x12,
+ },
+ },
+ .confirm_req[9] = {
+ .value = {
+ 0x38, 0x1c, 0xf7, 0xf0, 0x31, 0xb1, 0x20, 0xa0,
+ 0x51, 0x1c, 0xf1, 0xbd, 0x67, 0xfa, 0x84, 0xb4,
+ },
+ },
+ .confirm_rsp[9] = {
+ .value = {
+ 0x8e, 0xa1, 0xc1, 0xf5, 0x39, 0xf0, 0x00, 0x49,
+ 0xfb, 0xfc, 0xdc, 0xdf, 0x87, 0x0e, 0x96, 0x7e,
+ },
+ },
+ .random_req[9] = {
+ .value = {
+ 0xd0, 0xed, 0x6c, 0x52, 0x20, 0x4b, 0x7b, 0x24,
+ 0xdd, 0x28, 0x53, 0x2d, 0x71, 0x76, 0xfb, 0x8f,
+ },
+ },
+ .random_rsp[9] = {
+ .value = {
+ 0xac, 0xd7, 0x34, 0x6b, 0x7b, 0x59, 0x9e, 0x9b,
+ 0x5b, 0x37, 0xc6, 0x5c, 0x3e, 0x9d, 0xe2, 0x13,
+ },
+ },
+ .confirm_req[10] = {
+ .value = {
+ 0xa6, 0xd7, 0xb6, 0xd6, 0xb5, 0x01, 0x4a, 0x02,
+ 0x0d, 0xf0, 0x22, 0xcb, 0x68, 0xad, 0x7d, 0x73,
+ },
+ },
+ .confirm_rsp[10] = {
+ .value = {
+ 0x01, 0xcc, 0x5f, 0xbc, 0xd0, 0x22, 0xa1, 0xb2,
+ 0x71, 0x9d, 0x5c, 0x97, 0xfa, 0xd3, 0x6a, 0xc7,
+ },
+ },
+ .random_req[10] = {
+ .value = {
+ 0x9f, 0x3a, 0x25, 0xc7, 0x9b, 0xb7, 0xb3, 0x51,
+ 0xff, 0xde, 0x3b, 0x1c, 0xdd, 0xf5, 0x08, 0x21,
+ },
+ },
+ .random_rsp[10] = {
+ .value = {
+ 0x75, 0x1e, 0x8d, 0xa4, 0x5b, 0x35, 0xec, 0xae,
+ 0x17, 0xda, 0xa5, 0x43, 0x76, 0x3c, 0x6a, 0x67,
+ },
+ },
+ .confirm_req[11] = {
+ .value = {
+ 0xfc, 0x0c, 0x3f, 0x86, 0xbf, 0xbe, 0x96, 0x0f,
+ 0x99, 0x11, 0xa5, 0x36, 0x03, 0xcd, 0xbd, 0x7f,
+ },
+ },
+ .confirm_rsp[11] = {
+ .value = {
+ 0x48, 0xcd, 0xc8, 0x89, 0xd6, 0x1c, 0x0d, 0xb1,
+ 0x90, 0x01, 0x0e, 0xea, 0x80, 0xbc, 0xff, 0xb3,
+ },
+ },
+ .random_req[11] = {
+ .value = {
+ 0xec, 0xfc, 0xe3, 0x0a, 0x97, 0xed, 0xe8, 0x51,
+ 0x5d, 0x64, 0x3c, 0x73, 0x59, 0x2e, 0x62, 0xac,
+ },
+ },
+ .random_rsp[11] = {
+ .value = {
+ 0x81, 0x74, 0x44, 0xca, 0xec, 0x38, 0x20, 0x6d,
+ 0x52, 0x27, 0x49, 0x55, 0x61, 0x97, 0x01, 0x34,
+ },
+ },
+ .confirm_req[12] = {
+ .value = {
+ 0x27, 0x8c, 0x88, 0x09, 0xcb, 0xd6, 0x45, 0xb7,
+ 0x30, 0x4b, 0x1b, 0xcd, 0xc3, 0xac, 0x83, 0xd6,
+ },
+ },
+ .confirm_rsp[12] = {
+ .value = {
+ 0xea, 0xbc, 0xe2, 0x43, 0xc8, 0xe0, 0x06, 0xd8,
+ 0x7b, 0x3e, 0xa4, 0x55, 0x95, 0xa2, 0x23, 0x9b,
+ },
+ },
+ .random_req[12] = {
+ .value = {
+ 0x68, 0x8f, 0xb6, 0x7b, 0x91, 0x0d, 0xc9, 0x30,
+ 0xe7, 0xb7, 0xb7, 0x7a, 0x79, 0x29, 0x59, 0x7d,
+ },
+ },
+ .random_rsp[12] = {
+ .value = {
+ 0xfd, 0xa1, 0x3d, 0xaf, 0x8d, 0xd2, 0xa0, 0x02,
+ 0x82, 0x92, 0xeb, 0x2e, 0x4d, 0x6c, 0x8d, 0x69,
+ },
+ },
+ .confirm_req[13] = {
+ .value = {
+ 0x6f, 0xa8, 0x20, 0x81, 0x1c, 0x4b, 0xe8, 0xe3,
+ 0xdc, 0xea, 0x39, 0xbd, 0xfb, 0xbf, 0x79, 0xc4,
+ },
+ },
+ .confirm_rsp[13] = {
+ .value = {
+ 0x2a, 0x09, 0xec, 0x32, 0x63, 0x3d, 0x38, 0x5d,
+ 0x28, 0xb2, 0xb1, 0x62, 0xee, 0x6c, 0x0a, 0x6c,
+ },
+ },
+ .random_req[13] = {
+ .value = {
+ 0x35, 0xb5, 0xc5, 0xc0, 0x74, 0x1f, 0x40, 0xac,
+ 0x23, 0x52, 0x02, 0x68, 0xdf, 0x62, 0x73, 0xca,
+ },
+ },
+ .random_rsp[13] = {
+ .value = {
+ 0xb8, 0xe2, 0x65, 0xdc, 0x22, 0xcb, 0xc2, 0xdb,
+ 0x00, 0x60, 0x37, 0xe2, 0xcc, 0xc0, 0x41, 0x72,
+ },
+ },
+ .confirm_req[14] = {
+ .value = {
+ 0x05, 0x0b, 0x5c, 0xa7, 0x58, 0x9c, 0x08, 0x81,
+ 0x4a, 0x6b, 0x12, 0xae, 0xaa, 0xe5, 0x81, 0xf3,
+ },
+ },
+ .confirm_rsp[14] = {
+ .value = {
+ 0xdd, 0x2b, 0xd1, 0xdd, 0x49, 0x92, 0xf3, 0xe1,
+ 0xae, 0xf3, 0x6d, 0x89, 0xfd, 0x77, 0xf9, 0xaa,
+ },
+ },
+ .random_req[14] = {
+ .value = {
+ 0xbc, 0x27, 0x29, 0x1b, 0xc4, 0xbc, 0x0e, 0x88,
+ 0x95, 0x50, 0xf7, 0x92, 0xe6, 0xf7, 0x29, 0xe8,
+ },
+ },
+ .random_rsp[14] = {
+ .value = {
+ 0xe7, 0x15, 0xfe, 0x53, 0x77, 0xd9, 0x98, 0x1d,
+ 0x5b, 0x4e, 0x37, 0xa3, 0x1f, 0xc9, 0x47, 0x5d,
+ },
+ },
+ .confirm_req[15] = {
+ .value = {
+ 0x75, 0x70, 0x9f, 0x84, 0x3e, 0x6b, 0x88, 0xcb,
+ 0x66, 0xda, 0x8f, 0x79, 0xbc, 0xf8, 0x44, 0x99,
+ },
+ },
+ .confirm_rsp[15] = {
+ .value = {
+ 0x13, 0xe4, 0x43, 0xb2, 0x61, 0x72, 0xfd, 0x33,
+ 0xba, 0x87, 0x44, 0x27, 0x6f, 0x9a, 0xea, 0x19,
+ },
+ },
+ .random_req[15] = {
+ .value = {
+ 0xda, 0x90, 0x59, 0x72, 0xed, 0x67, 0xde, 0x65,
+ 0x21, 0xab, 0x7d, 0x9d, 0x72, 0x8c, 0x88, 0x8e,
+ },
+ },
+ .random_rsp[15] = {
+ .value = {
+ 0x94, 0x92, 0x0f, 0x6c, 0x08, 0xde, 0xae, 0xa7,
+ 0xfd, 0x36, 0xe0, 0x02, 0xc8, 0xfd, 0xdd, 0x69,
+ },
+ },
+ .confirm_req[16] = {
+ .value = {
+ 0x35, 0x68, 0x1e, 0x80, 0x37, 0xc4, 0x91, 0xe8,
+ 0xbf, 0x5e, 0x27, 0x0c, 0xaa, 0x8e, 0x85, 0x7b,
+ },
+ },
+ .confirm_rsp[16] = {
+ .value = {
+ 0x1e, 0x42, 0x47, 0x29, 0x06, 0xdc, 0x2b, 0x45,
+ 0xec, 0x95, 0x23, 0x31, 0x29, 0x24, 0x95, 0xf0,
+ },
+ },
+ .random_req[16] = {
+ .value = {
+ 0x4e, 0x9f, 0x5d, 0x5a, 0x8f, 0xf7, 0x28, 0xc9,
+ 0x29, 0x62, 0x0a, 0x67, 0x19, 0x17, 0x5e, 0xa7,
+ },
+ },
+ .random_rsp[16] = {
+ .value = {
+ 0x7c, 0xd4, 0x13, 0xba, 0x27, 0x16, 0x39, 0xe7,
+ 0xf0, 0xbf, 0xec, 0x1e, 0xe5, 0xcc, 0x20, 0x0b,
+ },
+ },
+ .confirm_req[17] = {
+ .value = {
+ 0xb9, 0xcd, 0xf5, 0xf9, 0x2b, 0x4f, 0x6d, 0x08,
+ 0x51, 0xe0, 0x92, 0x99, 0x15, 0xca, 0x15, 0x2a,
+ },
+ },
+ .confirm_rsp[17] = {
+ .value = {
+ 0xb8, 0xf2, 0xf9, 0x61, 0x4f, 0x0e, 0xfd, 0x19,
+ 0xcb, 0x5d, 0x7e, 0x93, 0x87, 0x7a, 0x0a, 0x6e,
+ },
+ },
+ .random_req[17] = {
+ .value = {
+ 0x8b, 0xf8, 0xc8, 0xeb, 0xe5, 0xdb, 0xcf, 0xfe,
+ 0x68, 0x70, 0x1f, 0xbe, 0x1e, 0x3c, 0x94, 0x7d,
+ },
+ },
+ .random_rsp[17] = {
+ .value = {
+ 0x0d, 0xfc, 0x68, 0x2e, 0x50, 0x31, 0x9f, 0x60,
+ 0xe6, 0x12, 0x72, 0x24, 0x7c, 0xad, 0xf7, 0x48,
+ },
+ },
+ .confirm_req[18] = {
+ .value = {
+ 0x27, 0x68, 0x07, 0xaa, 0xa6, 0x33, 0x13, 0x49,
+ 0x65, 0x4c, 0x80, 0x54, 0xfb, 0x69, 0xcb, 0x0e,
+ },
+ },
+ .confirm_rsp[18] = {
+ .value = {
+ 0xc5, 0x8d, 0x45, 0x81, 0xb0, 0x5a, 0x69, 0x0f,
+ 0x6c, 0x89, 0x0b, 0x60, 0x1e, 0x27, 0x9b, 0x9e,
+ },
+ },
+ .random_req[18] = {
+ .value = {
+ 0x97, 0x46, 0x95, 0xb5, 0x86, 0xa1, 0xc1, 0x86,
+ 0x3a, 0x8a, 0x1f, 0x29, 0x38, 0xe0, 0x69, 0x7f,
+ },
+ },
+ .random_rsp[18] = {
+ .value = {
+ 0x8f, 0x0e, 0x56, 0x17, 0x1c, 0x4b, 0x78, 0x1f,
+ 0xd1, 0x8a, 0x69, 0xbd, 0x65, 0xe3, 0xde, 0x3c,
+ },
+ },
+ .confirm_req[19] = {
+ .value = {
+ 0xd2, 0xa5, 0x4e, 0x31, 0x34, 0xde, 0x68, 0xf0,
+ 0x69, 0x88, 0x6f, 0x28, 0xa2, 0xdd, 0xba, 0xe1,
+ },
+ },
+ .confirm_rsp[19] = {
+ .value = {
+ 0xf8, 0x5e, 0x4f, 0x4d, 0x56, 0xf6, 0x22, 0xc0,
+ 0x57, 0x04, 0x04, 0x45, 0x24, 0x83, 0x09, 0x80,
+ },
+ },
+ .random_req[19] = {
+ .value = {
+ 0x64, 0xe1, 0x5a, 0x76, 0x71, 0x94, 0xc0, 0x64,
+ 0x2b, 0xea, 0x9d, 0xaf, 0xbd, 0x10, 0x25, 0x9b,
+ },
+ },
+ .random_rsp[19] = {
+ .value = {
+ 0x1e, 0x38, 0x6e, 0x66, 0x55, 0xf1, 0x7f, 0x55,
+ 0x7c, 0x00, 0xff, 0xad, 0x07, 0x13, 0x25, 0x97,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x98, 0xf1, 0x5a, 0x24, 0x81, 0x5d, 0xb5, 0xac,
+ 0x04, 0x4e, 0x3a, 0x31, 0x8b, 0x7d, 0xf6, 0x09,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x1a, 0xb4, 0xf4, 0xf3, 0xc0, 0x5a, 0xf3, 0x13,
+ 0x8d, 0x6e, 0x01, 0x16, 0x1e, 0x54, 0xf3, 0xe1,
+ },
+ },
+ .sign_info_req = {
+ .sig_key = {
+ 0x4b, 0x01, 0x33, 0x5f, 0x4b, 0xfe, 0x12, 0x8b,
+ 0x9f, 0x81, 0x44, 0x78, 0x90, 0x03, 0x9e, 0x53,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xef, 0x8d, 0xe2, 0x16, 0x4f, 0xec, 0x43, 0x0d,
+ 0xbf, 0x5b, 0xdd, 0x34, 0xc0, 0x53, 0x1e, 0xb8,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0xd2, 0xa1, 0x2c, 0xf0, 0xa6, 0xeb, 0x97, 0x5e,
+ 0xac, 0x53, 0xa1, 0x3d, 0x41, 0x40, 0x36, 0x2f,
+ },
+ },
+ .ltk = {
+ 0xce, 0x28, 0x91, 0xa9, 0x36, 0xb7, 0xe1, 0xda,
+ 0x3c, 0x66, 0xd9, 0x33, 0x3d, 0x03, 0x8e, 0x31,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_PASSKEY,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_DISP,
+ .passkey = 866744,
+ },
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: numeric comparison
+ * Initiator IO capabilities: 1
+ * Responder IO capabilities: 4
+ * Bonding: true
+ * Initiator address type: 0
+ * Responder address type: 0
+ * Initiator key distribution: 7
+ * Responder key distribution: 5
+ */
+TEST_CASE(ble_sm_sc_us_nc_iio1_rio4_b1_iat0_rat0_ik7_rk5)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ .resp_addr = {
+ 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
+ },
+ .pair_req = {
+ .io_cap = 0x01,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x07,
+ },
+ .pair_rsp = {
+ .io_cap = 0x04,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x05,
+ },
+ .our_priv_key = {
+ 0xb1, 0x6b, 0x4f, 0x81, 0xbc, 0xe3, 0x60, 0x9e,
+ 0x00, 0x20, 0xf1, 0x73, 0x3e, 0xfb, 0xcc, 0x6e,
+ 0x8c, 0xb6, 0xd2, 0x51, 0xd9, 0x36, 0x8a, 0x6d,
+ 0xca, 0x8c, 0xd7, 0xbe, 0x96, 0x03, 0xdf, 0xd6,
+ },
+ .public_key_req = {
+ .x = {
+ 0xe5, 0x0f, 0x02, 0x0a, 0x37, 0x90, 0x94, 0x5a,
+ 0x06, 0x21, 0xf7, 0xbc, 0xd5, 0xbe, 0xb9, 0x24,
+ 0x8a, 0x35, 0xfd, 0xf8, 0x5e, 0xe2, 0x70, 0xd5,
+ 0x5a, 0xe8, 0xe7, 0xdd, 0x13, 0x90, 0xeb, 0xd4,
+ },
+ .y = {
+ 0x41, 0xc8, 0x51, 0x1a, 0x25, 0x44, 0x01, 0x53,
+ 0x42, 0x74, 0x07, 0x9c, 0x18, 0xe6, 0x3b, 0x8a,
+ 0xce, 0x7a, 0x37, 0x1f, 0x18, 0x5c, 0x02, 0x7c,
+ 0x67, 0x16, 0xf5, 0x30, 0x2b, 0x31, 0xa9, 0xc7,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x7c, 0x27, 0x39, 0xdc, 0x10, 0xfa, 0x57, 0x97,
+ 0x4a, 0x18, 0xdc, 0x0e, 0xfc, 0x4b, 0xd0, 0xac,
+ 0x3a, 0xa4, 0x4c, 0x65, 0xb5, 0xbe, 0x7b, 0xd8,
+ 0xd1, 0xfd, 0x9d, 0xf8, 0xe3, 0x00, 0x4e, 0xf3,
+ },
+ .y = {
+ 0xae, 0xfd, 0x8e, 0x93, 0xb4, 0xa9, 0x4d, 0xd3,
+ 0xb6, 0xbd, 0x4c, 0x1d, 0xc1, 0x7e, 0x67, 0x57,
+ 0x07, 0x10, 0x4e, 0xd0, 0x0f, 0x23, 0x23, 0xab,
+ 0x09, 0x86, 0xc3, 0xb9, 0x63, 0x14, 0xe4, 0xe5,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x40, 0x35, 0x6d, 0xa1, 0x19, 0xa6, 0x8b, 0xff,
+ 0x4f, 0x0c, 0x86, 0x7e, 0x95, 0x7c, 0xb8, 0xc1,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0x95, 0x84, 0x0d, 0x2d, 0x7a, 0xfd, 0x5a, 0xa6,
+ 0xea, 0xfd, 0x7b, 0xf0, 0x68, 0x95, 0xeb, 0x77,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x25, 0x41, 0xda, 0xdf, 0xdd, 0xca, 0xcd, 0x2e,
+ 0x49, 0x79, 0xb0, 0xaa, 0x7a, 0x23, 0x28, 0x7f,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x49, 0xbb, 0x89, 0x9e, 0xa1, 0x10, 0x26, 0x7a,
+ 0xe7, 0x42, 0x51, 0xcd, 0x1f, 0x3b, 0x22, 0x1d,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x59, 0x51, 0xc8, 0x7b, 0x4f, 0xae, 0xfe, 0xb8,
+ 0x0c, 0x41, 0xe8, 0xe0, 0xf9, 0x4c, 0x2b, 0xc7,
+ },
+ },
+ .sign_info_req = {
+ .sig_key = {
+ 0x37, 0x26, 0xc0, 0x79, 0x59, 0xcd, 0xb7, 0x0f,
+ 0xa6, 0xd8, 0xe4, 0x02, 0xc9, 0xe6, 0x02, 0x71,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xef, 0x8d, 0xe2, 0x16, 0x4f, 0xec, 0x43, 0x0d,
+ 0xbf, 0x5b, 0xdd, 0x34, 0xc0, 0x53, 0x1e, 0xb8,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0x45, 0x69, 0x05, 0xe3, 0x0c, 0x9e, 0x01, 0xb3,
+ 0xe8, 0xea, 0xa0, 0x5b, 0x70, 0xd9, 0x62, 0x0e,
+ },
+ },
+ .ltk = {
+ 0xf5, 0x60, 0x02, 0x97, 0x2f, 0xbb, 0x3c, 0xe9,
+ 0x97, 0xd7, 0xd5, 0x58, 0x04, 0x96, 0xa6, 0xe7,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_NUMCMP,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_NUMCMP,
+ .numcmp_accept = 1,
+ },
+ .exp_numcmp = 344302,
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
TEST_SUITE(ble_sm_sc_test_suite)
{
/* Peer as initiator. */
@@ -1679,6 +3033,9 @@ TEST_SUITE(ble_sm_sc_test_suite)
/* Us as initiator. */
ble_sm_sc_us_jw_iio3_rio4_b1_iat0_rat0_ik7_rk5();
+ ble_sm_sc_us_pk_iio2_rio4_b1_iat0_rat0_ik7_rk5();
+ ble_sm_sc_us_pk_iio0_rio4_b1_iat0_rat0_ik7_rk5();
+ ble_sm_sc_us_nc_iio1_rio4_b1_iat0_rat0_ik7_rk5();
}
#endif /* NIMBLE_OPT_SM */
[5/8] incubator-mynewt-core git commit: BLE Host - Include
our_id_addr/type in conn desc.
Posted by cc...@apache.org.
BLE Host - Include our_id_addr/type in conn desc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/714cc01d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/714cc01d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/714cc01d
Branch: refs/heads/upf54
Commit: 714cc01d0a72cd8ba7b564dcbd74706de62aaf81
Parents: 12ab7cb
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 18:32:55 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 18:32:55 2016 -0700
----------------------------------------------------------------------
apps/bletiny/src/misc.c | 3 +++
net/nimble/host/include/host/ble_gap.h | 2 ++
net/nimble/host/src/ble_gap.c | 2 ++
net/nimble/host/src/ble_hs_misc.c | 2 +-
net/nimble/host/src/ble_hs_priv.h | 2 +-
net/nimble/host/src/ble_sm.c | 2 +-
6 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/apps/bletiny/src/misc.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/misc.c b/apps/bletiny/src/misc.c
index b0c3ddb..e9f8eee 100644
--- a/apps/bletiny/src/misc.c
+++ b/apps/bletiny/src/misc.c
@@ -99,6 +99,9 @@ print_conn_desc(struct ble_gap_conn_desc *desc)
console_printf("handle=%d our_ota_addr_type=%d our_ota_addr=",
desc->conn_handle, desc->our_ota_addr_type);
print_addr(desc->our_ota_addr);
+ console_printf(" our_id_addr_type=%d our_id_addr=",
+ desc->our_id_addr_type);
+ print_addr(desc->our_id_addr);
console_printf(" peer_ota_addr_type=%d peer_ota_addr=",
desc->peer_ota_addr_type);
print_addr(desc->peer_ota_addr);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/net/nimble/host/include/host/ble_gap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h
index da4af64..9e65cf4 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -120,6 +120,7 @@ struct ble_gap_conn_desc {
struct ble_gap_sec_state sec_state;
uint8_t peer_ota_addr[6];
uint8_t peer_id_addr[6];
+ uint8_t our_id_addr[6];
uint8_t our_ota_addr[6];
uint16_t conn_handle;
uint16_t conn_itvl;
@@ -127,6 +128,7 @@ struct ble_gap_conn_desc {
uint16_t supervision_timeout;
uint8_t peer_ota_addr_type;
uint8_t peer_id_addr_type;
+ uint8_t our_id_addr_type;
uint8_t our_ota_addr_type;
};
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index 7aca181..530ec5d 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -279,6 +279,8 @@ ble_gap_fill_conn_desc(struct ble_hs_conn *conn,
desc->our_ota_addr_type = addrs.our_ota_addr_type;
memcpy(desc->our_ota_addr, addrs.our_ota_addr, 6);
+ desc->our_id_addr_type = addrs.our_id_addr_type;
+ memcpy(desc->our_id_addr, addrs.our_id_addr, 6);
desc->peer_ota_addr_type = addrs.peer_ota_addr_type;
memcpy(desc->peer_ota_addr, addrs.peer_ota_addr, 6);
desc->peer_id_addr_type = addrs.peer_id_addr_type;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/net/nimble/host/src/ble_hs_misc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_misc.c b/net/nimble/host/src/ble_hs_misc.c
index 29438ea..9575ae3 100644
--- a/net/nimble/host/src/ble_hs_misc.c
+++ b/net/nimble/host/src/ble_hs_misc.c
@@ -163,7 +163,7 @@ ble_hs_misc_conn_chan_find_reqd(uint16_t conn_handle, uint16_t cid,
}
uint8_t
-ble_hs_misc_addr_type_to_ident(uint8_t addr_type)
+ble_hs_misc_addr_type_to_id(uint8_t addr_type)
{
switch (addr_type) {
case BLE_ADDR_TYPE_PUBLIC:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index 11a34b6..d8e99f2 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -85,7 +85,7 @@ int ble_hs_misc_conn_chan_find(uint16_t conn_handle, uint16_t cid,
int ble_hs_misc_conn_chan_find_reqd(uint16_t conn_handle, uint16_t cid,
struct ble_hs_conn **out_conn,
struct ble_l2cap_chan **out_chan);
-uint8_t ble_hs_misc_addr_type_to_ident(uint8_t addr_type);
+uint8_t ble_hs_misc_addr_type_to_id(uint8_t addr_type);
void ble_hs_cfg_init(struct ble_hs_cfg *cfg);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/714cc01d/net/nimble/host/src/ble_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c
index ceed1cd..601611e 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -562,7 +562,7 @@ ble_sm_persist_keys(struct ble_sm_proc *proc)
peer_addr_type = proc->peer_keys.addr_type;
memcpy(peer_addr, proc->peer_keys.addr, sizeof peer_addr);
} else {
- peer_addr_type = ble_hs_misc_addr_type_to_ident(conn->bhc_addr_type);
+ peer_addr_type = ble_hs_misc_addr_type_to_id(conn->bhc_addr_type);
memcpy(peer_addr, conn->bhc_addr, sizeof peer_addr);
}
[2/8] incubator-mynewt-core git commit: BLE Host - Search DB when
initiating security.
Posted by cc...@apache.org.
BLE Host - Search DB when initiating security.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/fc6c9cf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fc6c9cf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fc6c9cf2
Branch: refs/heads/upf54
Commit: fc6c9cf217d7b1072a50cafbf5835d80c1c51dd3
Parents: 7c0d730
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 12:36:57 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 12:36:57 2016 -0700
----------------------------------------------------------------------
apps/bletiny/src/bletiny.h | 1 +
apps/bletiny/src/cmd.c | 27 ++++++++++++++++++++++++---
apps/bletiny/src/main.c | 13 +++++++++++++
net/nimble/host/src/ble_gap.c | 32 +++++++++++++++++++++++++++-----
4 files changed, 65 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fc6c9cf2/apps/bletiny/src/bletiny.h
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/bletiny.h b/apps/bletiny/src/bletiny.h
index b66a301..60c80c7 100644
--- a/apps/bletiny/src/bletiny.h
+++ b/apps/bletiny/src/bletiny.h
@@ -172,6 +172,7 @@ int bletiny_datalen(uint16_t conn_handle, uint16_t tx_octets,
int bletiny_l2cap_update(uint16_t conn_handle,
struct ble_l2cap_sig_update_params *params);
int bletiny_sec_start(uint16_t conn_handle);
+int bletiny_sec_pair(uint16_t conn_handle);
int bletiny_sec_restart(uint16_t conn_handle, uint8_t *ltk, uint16_t ediv,
uint64_t rand_val, int auth);
int bletiny_tx_start(uint16_t handle, uint16_t len, uint16_t rate,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fc6c9cf2/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index 3598bb3..3ac8592 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -1022,6 +1022,26 @@ cmd_show(int argc, char **argv)
*****************************************************************************/
static int
+cmd_sec_pair(int argc, char **argv)
+{
+ uint16_t conn_handle;
+ int rc;
+
+ conn_handle = parse_arg_uint16("conn", &rc);
+ if (rc != 0) {
+ return rc;
+ }
+
+ rc = bletiny_sec_pair(conn_handle);
+ if (rc != 0) {
+ console_printf("error initiating pairing; rc=%d\n", rc);
+ return rc;
+ }
+
+ return 0;
+}
+
+static int
cmd_sec_start(int argc, char **argv)
{
uint16_t conn_handle;
@@ -1042,7 +1062,7 @@ cmd_sec_start(int argc, char **argv)
}
static int
-cmd_sec_restart(int argc, char **argv)
+cmd_sec_enc(int argc, char **argv)
{
uint16_t conn_handle;
uint16_t ediv;
@@ -1079,7 +1099,7 @@ cmd_sec_restart(int argc, char **argv)
}
if (rc != 0) {
- console_printf("error starting encryption; rc=%d\n", rc);
+ console_printf("error initiating encryption; rc=%d\n", rc);
return rc;
}
@@ -1087,8 +1107,9 @@ cmd_sec_restart(int argc, char **argv)
}
static struct cmd_entry cmd_sec_entries[] = {
+ { "pair", cmd_sec_pair },
{ "start", cmd_sec_start },
- { "restart", cmd_sec_restart },
+ { "enc", cmd_sec_enc },
};
static int
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fc6c9cf2/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index 75d7aec..de633e9 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -1351,6 +1351,19 @@ bletiny_l2cap_update(uint16_t conn_handle,
}
int
+bletiny_sec_pair(uint16_t conn_handle)
+{
+#if !NIMBLE_OPT(SM)
+ return BLE_HS_ENOTSUP;
+#endif
+
+ int rc;
+
+ rc = ble_sm_pair_initiate(conn_handle);
+ return rc;
+}
+
+int
bletiny_sec_start(uint16_t conn_handle)
{
#if !NIMBLE_OPT(SM)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fc6c9cf2/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index de396ea..2d0edce 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2110,20 +2110,42 @@ done:
int
ble_gap_security_initiate(uint16_t conn_handle)
{
+ struct ble_store_value_sec value_sec;
+ struct ble_store_key_sec key_sec;
+ struct ble_hs_conn_addrs addrs;
ble_hs_conn_flags_t conn_flags;
+ struct ble_hs_conn *conn;
int rc;
- rc = ble_hs_atomic_conn_flags(conn_handle, &conn_flags);
- if (rc != 0) {
- return rc;
+ ble_hs_lock();
+ conn = ble_hs_conn_find(conn_handle);
+ if (conn != NULL) {
+ conn_flags = conn->bhc_flags;
+ ble_hs_conn_addrs(conn, &addrs);
+
+ memset(&key_sec, 0, sizeof key_sec);
+ key_sec.peer_addr_type = addrs.peer_id_addr_type;
+ memcpy(key_sec.peer_addr, addrs.peer_id_addr, 6);
+ }
+ ble_hs_unlock();
+
+ if (conn == NULL) {
+ return BLE_HS_ENOTCONN;
}
if (conn_flags & BLE_HS_CONN_F_MASTER) {
- /* XXX: Search the security database for an LTK for this peer. If one
+ /* Search the security database for an LTK for this peer. If one
* is found, perform the encryption procedure rather than the pairing
* procedure.
*/
- rc = ble_sm_pair_initiate(conn_handle);
+ rc = ble_store_read_peer_sec(&key_sec, &value_sec);
+ if (rc == 0 && value_sec.ltk_present) {
+ rc = ble_sm_enc_initiate(conn_handle, value_sec.ltk,
+ value_sec.ediv, value_sec.rand_num,
+ value_sec.authenticated);
+ } else {
+ rc = ble_sm_pair_initiate(conn_handle);
+ }
} else {
rc = ble_sm_slave_initiate(conn_handle);
}
[4/8] incubator-mynewt-core git commit: bletiny - Separate pairing
from encryption.
Posted by cc...@apache.org.
bletiny - Separate pairing from encryption.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/12ab7cbc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/12ab7cbc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/12ab7cbc
Branch: refs/heads/upf54
Commit: 12ab7cbc52bd607fdc180b0883e8f6f6be58a254
Parents: 5a2c445
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 16:19:39 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 16:19:39 2016 -0700
----------------------------------------------------------------------
apps/bletiny/src/cmd.c | 7 ++++++-
apps/bletiny/src/main.c | 2 +-
net/nimble/host/include/host/ble_gap.h | 6 +++---
net/nimble/host/src/ble_gap.c | 10 ++++++++++
4 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index 3ac8592..fc05aa2 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -388,7 +388,12 @@ cmd_conn(int argc, char **argv)
}
if (addr_type != BLE_GAP_ADDR_TYPE_WL) {
- rc = parse_arg_mac("addr", peer_addr);
+ rc = parse_arg_mac("peer_addr", peer_addr);
+ if (rc == ENOENT) {
+ /* Allow "addr" for backwards compatibility. */
+ rc = parse_arg_mac("addr", peer_addr);
+ }
+
if (rc != 0) {
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index de633e9..1c0ffa7 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -1359,7 +1359,7 @@ bletiny_sec_pair(uint16_t conn_handle)
int rc;
- rc = ble_sm_pair_initiate(conn_handle);
+ rc = ble_gap_pair_initiate(conn_handle);
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/net/nimble/host/include/host/ble_gap.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h
index df9ae64..da4af64 100644
--- a/net/nimble/host/include/host/ble_gap.h
+++ b/net/nimble/host/include/host/ble_gap.h
@@ -268,9 +268,9 @@ int ble_gap_wl_set(struct ble_gap_white_entry *white_list,
int ble_gap_update_params(uint16_t conn_handle,
struct ble_gap_upd_params *params);
int ble_gap_security_initiate(uint16_t conn_handle);
-int
-ble_gap_encryption_initiate(uint16_t conn_handle, uint8_t *ltk,
- uint16_t ediv, uint64_t rand_val, int auth);
+int ble_gap_pair_initiate(uint16_t conn_handle);
+int ble_gap_encryption_initiate(uint16_t conn_handle, uint8_t *ltk,
+ uint16_t ediv, uint64_t rand_val, int auth);
int ble_gap_provide_ltk(uint16_t conn_handle, uint8_t *ltk);
void ble_gap_init_identity_addr(uint8_t *addr);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ab7cbc/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index 2d0edce..7aca181 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2154,6 +2154,16 @@ ble_gap_security_initiate(uint16_t conn_handle)
}
int
+ble_gap_pair_initiate(uint16_t conn_handle)
+{
+ int rc;
+
+ rc = ble_sm_pair_initiate(conn_handle);
+
+ return rc;
+}
+
+int
ble_gap_encryption_initiate(uint16_t conn_handle,
uint8_t *ltk,
uint16_t ediv,
[6/8] incubator-mynewt-core git commit: BLE Host - unit tests for
combined priv/sc.
Posted by cc...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_sm_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test_util.c b/net/nimble/host/src/test/ble_sm_test_util.c
index 28c2a2a..0dcd8af 100644
--- a/net/nimble/host/src/test/ble_sm_test_util.c
+++ b/net/nimble/host/src/test/ble_sm_test_util.c
@@ -533,6 +533,10 @@ ble_sm_test_util_verify_tx_id_addr_info(struct ble_sm_id_addr_info *exp_cmd)
{
struct ble_sm_id_addr_info cmd;
struct os_mbuf *om;
+ uint8_t *our_id_addr;
+ uint8_t our_id_addr_type;
+
+ our_id_addr = bls_hs_priv_get_local_identity_addr(&our_id_addr_type);
ble_hs_test_util_tx_all();
om = ble_sm_test_util_verify_tx_hdr(BLE_SM_OP_IDENTITY_ADDR_INFO,
@@ -541,6 +545,9 @@ ble_sm_test_util_verify_tx_id_addr_info(struct ble_sm_id_addr_info *exp_cmd)
TEST_ASSERT(cmd.addr_type == exp_cmd->addr_type);
TEST_ASSERT(memcmp(cmd.bd_addr, exp_cmd->bd_addr, 6) == 0);
+
+ TEST_ASSERT(cmd.addr_type == our_id_addr_type);
+ TEST_ASSERT(memcmp(cmd.bd_addr, our_id_addr, 6) == 0);
}
static void
@@ -691,6 +698,30 @@ ble_sm_test_util_verify_tx_start_enc(uint16_t conn_handle,
TEST_ASSERT(memcmp(param + 12, ltk, 16) == 0);
}
+static void
+ble_sm_test_util_verify_tx_add_resolve_list(uint8_t peer_id_addr_type,
+ uint8_t *peer_id_addr,
+ uint8_t *peer_irk,
+ uint8_t *our_irk)
+{
+ uint8_t buf[16];
+ uint8_t param_len;
+ uint8_t *param;
+
+ param = ble_hs_test_util_verify_tx_hci(BLE_HCI_OGF_LE,
+ BLE_HCI_OCF_LE_ADD_RESOLV_LIST,
+ ¶m_len);
+ TEST_ASSERT(param_len == BLE_HCI_ADD_TO_RESOLV_LIST_LEN);
+ TEST_ASSERT(param[0] == peer_id_addr_type);
+ TEST_ASSERT(memcmp(param + 1, peer_id_addr, 6) == 0);
+
+ /* Ensure IRKs are sent in little endian. */
+ memcpy(buf, peer_irk, 16);
+ TEST_ASSERT(memcmp(param + 7, buf, 16) == 0);
+ memcpy(buf, our_irk, 16);
+ TEST_ASSERT(memcmp(param + 23, buf, 16) == 0);
+}
+
void
ble_sm_test_util_io_inject(struct ble_sm_test_passkey_info *passkey_info,
uint8_t cur_sm_state)
@@ -818,7 +849,7 @@ ble_sm_test_util_verify_lgcy_persist(struct ble_sm_test_lgcy_params *params)
rc = ble_store_read_peer_sec(&key_sec, &value_sec);
TEST_ASSERT_FATAL(rc == 0);
TEST_ASSERT(value_sec.peer_addr_type == 0);
- TEST_ASSERT(memcmp(value_sec.peer_addr, params->init_addr, 6) == 0);
+ TEST_ASSERT(memcmp(value_sec.peer_addr, params->init_id_addr, 6) == 0);
TEST_ASSERT(value_sec.ediv == params->ediv);
TEST_ASSERT(value_sec.rand_num == params->r);
TEST_ASSERT(value_sec.authenticated == params->authenticated);
@@ -843,7 +874,7 @@ ble_sm_test_util_verify_lgcy_persist(struct ble_sm_test_lgcy_params *params)
rc = ble_store_read_our_sec(&key_sec, &value_sec);
TEST_ASSERT_FATAL(rc == 0);
TEST_ASSERT(value_sec.peer_addr_type == 0);
- TEST_ASSERT(memcmp(value_sec.peer_addr, params->init_addr, 6) == 0);
+ TEST_ASSERT(memcmp(value_sec.peer_addr, params->init_id_addr, 6) == 0);
TEST_ASSERT(value_sec.ediv == params->ediv);
TEST_ASSERT(value_sec.rand_num == params->r);
TEST_ASSERT(value_sec.authenticated == params->authenticated);
@@ -865,16 +896,18 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
{
struct ble_store_value_sec value_sec;
struct ble_store_key_sec key_sec;
- uint8_t *peer_addr;
- uint8_t *mst_csrk;
- uint8_t *slv_csrk;
- uint8_t *mst_irk;
- uint8_t *slv_irk;
+ uint8_t *peer_id_addr;
+ uint8_t *peer_csrk;
+ uint8_t *our_csrk;
+ uint8_t *peer_irk;
+ uint8_t *our_irk;
+ uint8_t peer_id_addr_type;
uint8_t peer_addr_type;
uint8_t peer_key_dist;
uint8_t our_key_dist;
int csrk_expected;
- int irk_expected;
+ int peer_irk_expected;
+ int our_irk_expected;
int bonding;
int rc;
@@ -882,25 +915,26 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
our_key_dist = params->pair_rsp.init_key_dist;
peer_key_dist = params->pair_rsp.resp_key_dist;
- peer_addr_type = 0;
- peer_addr = params->resp_addr;
+ peer_addr_type = params->resp_addr_type;
+ peer_id_addr = params->resp_id_addr;
- mst_irk = params->id_info_req.irk;
- mst_csrk = params->sign_info_req.sig_key;
- slv_irk = params->id_info_rsp.irk;
- slv_csrk = params->sign_info_rsp.sig_key;
+ peer_irk = params->id_info_req.irk;
+ peer_csrk = params->sign_info_req.sig_key;
+ our_irk = params->id_info_rsp.irk;
+ our_csrk = params->sign_info_rsp.sig_key;
} else {
our_key_dist = params->pair_rsp.resp_key_dist;
peer_key_dist = params->pair_rsp.init_key_dist;
- peer_addr_type = 0;
- peer_addr = params->init_addr;
+ peer_addr_type = params->init_addr_type;
+ peer_id_addr = params->init_id_addr;
- mst_irk = params->id_info_rsp.irk;
- mst_csrk = params->sign_info_rsp.sig_key;
- slv_irk = params->id_info_req.irk;
- slv_csrk = params->sign_info_req.sig_key;
+ peer_irk = params->id_info_rsp.irk;
+ peer_csrk = params->sign_info_rsp.sig_key;
+ our_irk = params->id_info_req.irk;
+ our_csrk = params->sign_info_req.sig_key;
}
+ peer_id_addr_type = ble_hs_misc_addr_type_to_id(peer_addr_type);
memset(&key_sec, 0, sizeof key_sec);
key_sec.peer_addr_type = BLE_STORE_ADDR_TYPE_NONE;
@@ -911,14 +945,15 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
rc = ble_store_read_peer_sec(&key_sec, &value_sec);
if (!bonding) {
TEST_ASSERT(rc == BLE_HS_ENOENT);
+ peer_irk_expected = 0;
} else {
TEST_ASSERT_FATAL(rc == 0);
- irk_expected = !!(peer_key_dist & BLE_SM_PAIR_KEY_DIST_ID);
+ peer_irk_expected = !!(peer_key_dist & BLE_SM_PAIR_KEY_DIST_ID);
csrk_expected = !!(peer_key_dist & BLE_SM_PAIR_KEY_DIST_SIGN);
- TEST_ASSERT(value_sec.peer_addr_type == peer_addr_type);
- TEST_ASSERT(memcmp(value_sec.peer_addr, peer_addr, 6) == 0);
+ TEST_ASSERT(value_sec.peer_addr_type == peer_id_addr_type);
+ TEST_ASSERT(memcmp(value_sec.peer_addr, peer_id_addr, 6) == 0);
TEST_ASSERT(value_sec.ediv == 0);
TEST_ASSERT(value_sec.rand_num == 0);
TEST_ASSERT(value_sec.authenticated == params->authenticated);
@@ -928,14 +963,14 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
TEST_ASSERT(value_sec.ltk_present == 1);
TEST_ASSERT(memcmp(value_sec.ltk, params->ltk, 16) == 0);
- TEST_ASSERT(value_sec.irk_present == irk_expected);
- if (irk_expected) {
- TEST_ASSERT(memcmp(value_sec.irk, mst_irk, 16) == 0);
+ TEST_ASSERT(value_sec.irk_present == peer_irk_expected);
+ if (peer_irk_expected) {
+ TEST_ASSERT(memcmp(value_sec.irk, peer_irk, 16) == 0);
}
TEST_ASSERT(value_sec.csrk_present == csrk_expected);
if (csrk_expected) {
- TEST_ASSERT(memcmp(value_sec.csrk, mst_csrk, 16) == 0);
+ TEST_ASSERT(memcmp(value_sec.csrk, peer_csrk, 16) == 0);
}
}
@@ -945,11 +980,11 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
} else {
TEST_ASSERT_FATAL(rc == 0);
- irk_expected = !!(our_key_dist & BLE_SM_PAIR_KEY_DIST_ID);
+ our_irk_expected = !!(our_key_dist & BLE_SM_PAIR_KEY_DIST_ID);
csrk_expected = !!(our_key_dist & BLE_SM_PAIR_KEY_DIST_SIGN);
- TEST_ASSERT(value_sec.peer_addr_type == peer_addr_type);
- TEST_ASSERT(memcmp(value_sec.peer_addr, peer_addr, 6) == 0);
+ TEST_ASSERT(value_sec.peer_addr_type == peer_id_addr_type);
+ TEST_ASSERT(memcmp(value_sec.peer_addr, peer_id_addr, 6) == 0);
TEST_ASSERT(value_sec.ediv == 0);
TEST_ASSERT(value_sec.rand_num == 0);
TEST_ASSERT(value_sec.authenticated == params->authenticated);
@@ -957,14 +992,14 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
TEST_ASSERT(value_sec.ltk_present == 1);
TEST_ASSERT(memcmp(value_sec.ltk, params->ltk, 16) == 0);
- TEST_ASSERT(value_sec.irk_present == irk_expected);
- if (irk_expected) {
- TEST_ASSERT(memcmp(value_sec.irk, slv_irk, 16) == 0);
+ TEST_ASSERT(value_sec.irk_present == our_irk_expected);
+ if (our_irk_expected) {
+ TEST_ASSERT(memcmp(value_sec.irk, our_irk, 16) == 0);
}
TEST_ASSERT(value_sec.csrk_present == csrk_expected);
if (csrk_expected) {
- TEST_ASSERT(memcmp(value_sec.csrk, slv_csrk, 16) == 0);
+ TEST_ASSERT(memcmp(value_sec.csrk, our_csrk, 16) == 0);
}
}
@@ -974,6 +1009,13 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
TEST_ASSERT_FATAL(rc == BLE_HS_ENOENT);
rc = ble_store_read_peer_sec(&key_sec, &value_sec);
TEST_ASSERT_FATAL(rc == BLE_HS_ENOENT);
+
+ /* Verify we sent the peer's IRK to the controller. */
+ if (peer_irk_expected) {
+ ble_sm_test_util_verify_tx_add_resolve_list(peer_id_addr_type,
+ peer_id_addr,
+ peer_irk, our_irk);
+ }
}
void
@@ -984,7 +1026,7 @@ ble_sm_test_util_us_lgcy_good(
int rc;
ble_sm_test_util_init();
- ble_hs_test_util_set_public_addr(params->init_addr);
+ ble_hs_test_util_set_public_addr(params->init_id_addr);
ble_sm_dbg_set_next_pair_rand(params->random_req.value);
ble_sm_dbg_set_next_ediv(params->ediv);
ble_sm_dbg_set_next_start_rand(params->r);
@@ -993,7 +1035,7 @@ ble_sm_test_util_us_lgcy_good(
ble_sm_dbg_set_next_ltk(params->enc_info_req.ltk);
}
- ble_hs_test_util_create_conn(2, params->resp_addr,
+ ble_hs_test_util_create_conn(2, params->resp_id_addr,
ble_sm_test_util_conn_cb,
NULL);
@@ -1096,7 +1138,7 @@ ble_sm_test_util_us_lgcy_good(
void
ble_sm_test_util_peer_fail_inval(
int we_are_master,
- uint8_t *init_addr,
+ uint8_t *init_id_addr,
uint8_t *resp_addr,
struct ble_sm_pair_cmd *pair_req,
struct ble_sm_pair_fail *pair_fail)
@@ -1106,7 +1148,7 @@ ble_sm_test_util_peer_fail_inval(
ble_sm_test_util_init();
ble_hs_test_util_set_public_addr(resp_addr);
- ble_hs_test_util_create_conn(2, init_addr, ble_sm_test_util_conn_cb,
+ ble_hs_test_util_create_conn(2, init_id_addr, ble_sm_test_util_conn_cb,
NULL);
/* This test inspects and modifies the connection object after unlocking
@@ -1148,7 +1190,7 @@ ble_sm_test_util_peer_fail_inval(
void
ble_sm_test_util_peer_lgcy_fail_confirm(
- uint8_t *init_addr,
+ uint8_t *init_id_addr,
uint8_t *resp_addr,
struct ble_sm_pair_cmd *pair_req,
struct ble_sm_pair_cmd *pair_rsp,
@@ -1164,7 +1206,7 @@ ble_sm_test_util_peer_lgcy_fail_confirm(
ble_hs_test_util_set_public_addr(resp_addr);
ble_sm_dbg_set_next_pair_rand(random_rsp->value);
- ble_hs_test_util_create_conn(2, init_addr, ble_sm_test_util_conn_cb,
+ ble_hs_test_util_create_conn(2, init_id_addr, ble_sm_test_util_conn_cb,
NULL);
/* This test inspects and modifies the connection object after unlocking
@@ -1248,7 +1290,7 @@ ble_sm_test_util_peer_lgcy_good_once(struct ble_sm_test_lgcy_params *params)
ble_hs_cfg.sm_our_key_dist = params->pair_rsp.resp_key_dist;
ble_hs_cfg.sm_their_key_dist = params->pair_rsp.init_key_dist;
- ble_hs_test_util_set_public_addr(params->resp_addr);
+ ble_hs_test_util_set_public_addr(params->resp_id_addr);
ble_sm_dbg_set_next_pair_rand(params->random_rsp.value);
ble_sm_dbg_set_next_ediv(params->ediv);
ble_sm_dbg_set_next_start_rand(params->r);
@@ -1257,7 +1299,7 @@ ble_sm_test_util_peer_lgcy_good_once(struct ble_sm_test_lgcy_params *params)
ble_sm_dbg_set_next_ltk(params->enc_info_req.ltk);
}
- ble_hs_test_util_create_conn(2, params->init_addr,
+ ble_hs_test_util_create_conn(2, params->init_id_addr,
ble_sm_test_util_conn_cb,
NULL);
@@ -1599,7 +1641,7 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
ble_hs_cfg.sm_our_key_dist = params->pair_rsp.resp_key_dist;
ble_hs_cfg.sm_their_key_dist = params->pair_rsp.init_key_dist;
- ble_hs_test_util_set_public_addr(params->resp_addr);
+ ble_hs_test_util_set_public_addr(params->resp_id_addr);
ble_sm_dbg_set_next_pair_rand(params->random_rsp[0].value);
ble_sm_dbg_set_sc_keys(params->public_key_rsp.x, params->our_priv_key);
@@ -1609,9 +1651,12 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
ble_sm_dbg_set_next_csrk(params->sign_info_req.sig_key);
}
- ble_hs_test_util_create_conn(2, params->init_addr,
- ble_sm_test_util_conn_cb,
- NULL);
+ ble_hs_test_util_create_rpa_conn(2, params->resp_rpa,
+ params->init_addr_type,
+ params->init_id_addr,
+ params->init_rpa,
+ ble_sm_test_util_conn_cb,
+ NULL);
/* This test inspects and modifies the connection object after unlocking
* the host mutex. It is not OK for real code to do this, but this test
@@ -1765,6 +1810,9 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
/* Receive key material from peer. */
if (params->pair_rsp.init_key_dist & BLE_SM_PAIR_KEY_DIST_ID) {
+ ble_hs_test_util_set_ack(
+ host_hci_opcode_join(BLE_HCI_OGF_LE,
+ BLE_HCI_OCF_LE_ADD_RESOLV_LIST), 0);
ble_sm_test_util_rx_id_info(2, ¶ms->id_info_rsp, 0);
ble_sm_test_util_rx_id_addr_info(2, ¶ms->id_addr_info_rsp, 0);
}
@@ -1810,22 +1858,22 @@ ble_sm_test_util_peer_sc_good(struct ble_sm_test_sc_params *params)
/*** Verify link can be restored via the encryption procedure. */
/* Peer is master; peer initiates procedure. */
- ble_sm_test_util_peer_bonding_good(0, 0, params->init_addr,
+ ble_sm_test_util_peer_bonding_good(0, 0, params->init_id_addr,
params->ltk, params->authenticated,
0, 0);
/* Peer is master; we initiate procedure via security request. */
- ble_sm_test_util_peer_bonding_good(1, 0, params->init_addr,
+ ble_sm_test_util_peer_bonding_good(1, 0, params->init_id_addr,
params->ltk, params->authenticated,
0, 0);
/* We are master; we initiate procedure. */
- ble_sm_test_util_us_bonding_good(0, 0, params->init_addr,
+ ble_sm_test_util_us_bonding_good(0, 0, params->init_id_addr,
params->ltk, params->authenticated,
0, 0);
/* We are master; peer initiates procedure via security request. */
- ble_sm_test_util_us_bonding_good(1, 0, params->init_addr,
+ ble_sm_test_util_us_bonding_good(1, 0, params->init_id_addr,
params->ltk, params->authenticated,
0, 0);
}
@@ -1852,7 +1900,7 @@ ble_sm_test_util_us_sc_good(struct ble_sm_test_sc_params *params)
ble_hs_cfg.sm_our_key_dist = params->pair_req.init_key_dist;
ble_hs_cfg.sm_their_key_dist = params->pair_req.resp_key_dist;
- ble_hs_test_util_set_public_addr(params->init_addr);
+ ble_hs_test_util_set_public_addr(params->init_id_addr);
ble_sm_dbg_set_next_pair_rand(params->random_req[0].value);
ble_sm_dbg_set_sc_keys(params->public_key_req.x, params->our_priv_key);
@@ -1862,9 +1910,12 @@ ble_sm_test_util_us_sc_good(struct ble_sm_test_sc_params *params)
ble_sm_dbg_set_next_csrk(params->sign_info_rsp.sig_key);
}
- ble_hs_test_util_create_conn(2, params->resp_addr,
- ble_sm_test_util_conn_cb,
- NULL);
+ ble_hs_test_util_create_rpa_conn(2, params->init_rpa,
+ params->resp_addr_type,
+ params->resp_id_addr,
+ params->resp_rpa,
+ ble_sm_test_util_conn_cb,
+ NULL);
/* This test inspects and modifies the connection object after unlocking
* the host mutex. It is not OK for real code to do this, but this test
@@ -2037,11 +2088,11 @@ ble_sm_test_util_us_fail_inval(
int rc;
ble_sm_test_util_init();
- ble_hs_test_util_set_public_addr(params->resp_addr);
+ ble_hs_test_util_set_public_addr(params->resp_id_addr);
ble_sm_dbg_set_next_pair_rand(((uint8_t[16]){0}));
- ble_hs_test_util_create_conn(2, params->init_addr,
+ ble_hs_test_util_create_conn(2, params->init_id_addr,
ble_sm_test_util_conn_cb,
NULL);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_sm_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test_util.h b/net/nimble/host/src/test/ble_sm_test_util.h
index b9dac79..9d95c92 100644
--- a/net/nimble/host/src/test/ble_sm_test_util.h
+++ b/net/nimble/host/src/test/ble_sm_test_util.h
@@ -27,8 +27,12 @@ struct ble_sm_test_passkey_info {
};
struct ble_sm_test_lgcy_params {
- uint8_t init_addr[6];
- uint8_t resp_addr[6];
+ uint8_t init_addr_type;
+ uint8_t init_id_addr[6];
+ uint8_t init_rpa[6];
+ uint8_t resp_addr_type;
+ uint8_t resp_id_addr[6];
+ uint8_t resp_rpa[6];
struct ble_sm_sec_req sec_req;
struct ble_sm_pair_cmd pair_req;
struct ble_sm_pair_cmd pair_rsp;
@@ -58,8 +62,12 @@ struct ble_sm_test_lgcy_params {
};
struct ble_sm_test_sc_params {
- uint8_t init_addr[6];
- uint8_t resp_addr[6];
+ uint8_t init_addr_type;
+ uint8_t init_id_addr[6];
+ uint8_t init_rpa[6];
+ uint8_t resp_addr_type;
+ uint8_t resp_id_addr[6];
+ uint8_t resp_rpa[6];
struct ble_sm_sec_req sec_req;
struct ble_sm_pair_cmd pair_req;
struct ble_sm_pair_cmd pair_rsp;
[8/8] incubator-mynewt-core git commit: BLE Host - Clean up
endianness confusion.
Posted by cc...@apache.org.
BLE Host - Clean up endianness confusion.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a1de643d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a1de643d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a1de643d
Branch: refs/heads/upf54
Commit: a1de643d4e761b481bc3e76d22009b10685e5e01
Parents: ec61a04
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 19:02:54 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 19:02:54 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/ble_sm.c | 24 ++++++++++++------------
net/nimble/host/src/ble_sm_cmd.c | 11 +++++------
net/nimble/host/src/ble_sm_priv.h | 2 +-
net/nimble/host/src/test/ble_sm_test_util.c | 21 ++++++---------------
4 files changed, 24 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1de643d/net/nimble/host/src/ble_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c
index 601611e..083a1ae 100644
--- a/net/nimble/host/src/ble_sm.c
+++ b/net/nimble/host/src/ble_sm.c
@@ -1700,9 +1700,9 @@ ble_sm_key_exch_exec(struct ble_sm_proc *proc, struct ble_sm_result *res,
{
struct ble_sm_id_addr_info addr_info;
struct ble_sm_sign_info sign_info;
- struct ble_sm_master_id master_iden;
- struct ble_sm_id_info iden_info;
+ struct ble_sm_master_id master_id;
struct ble_sm_enc_info enc_info;
+ struct ble_sm_id_info id_info;
uint8_t init_key_dist;
uint8_t resp_key_dist;
uint8_t our_key_dist;
@@ -1730,30 +1730,30 @@ ble_sm_key_exch_exec(struct ble_sm_proc *proc, struct ble_sm_result *res,
memcpy(proc->our_keys.ltk, enc_info.ltk, 16);
/* Send master identification. */
- rc = ble_sm_gen_ediv(&master_iden.ediv);
+ rc = ble_sm_gen_ediv(&master_id.ediv);
if (rc != 0) {
goto err;
}
- rc = ble_sm_gen_start_rand(&master_iden.rand_val);
+ rc = ble_sm_gen_start_rand(&master_id.rand_val);
if (rc != 0) {
goto err;
}
- rc = ble_sm_master_id_tx(proc->conn_handle, &master_iden);
+ rc = ble_sm_master_id_tx(proc->conn_handle, &master_id);
if (rc != 0) {
goto err;
}
proc->our_keys.ediv_rand_valid = 1;
- proc->our_keys.rand_val = master_iden.rand_val;
- proc->our_keys.ediv = master_iden.ediv;
+ proc->our_keys.rand_val = master_id.rand_val;
+ proc->our_keys.ediv = master_id.ediv;
}
if (our_key_dist & BLE_SM_PAIR_KEY_DIST_ID) {
/* Send identity information. */
irk = ble_hs_priv_get_local_irk();
- memcpy(iden_info.irk, irk, 16);
+ memcpy(id_info.irk, irk, 16);
- rc = ble_sm_id_info_tx(proc->conn_handle, &iden_info);
+ rc = ble_sm_id_info_tx(proc->conn_handle, &id_info);
if (rc != 0) {
goto err;
}
@@ -1917,10 +1917,9 @@ ble_sm_id_info_rx(uint16_t conn_handle, uint8_t op, struct os_mbuf **om,
res->sm_err = BLE_SM_ERR_UNSPECIFIED;
} else {
proc->rx_key_flags &= ~BLE_SM_KE_F_ID_INFO;
- proc->peer_keys.irk_valid = 1;
- /* Store IRK in big endian. */
memcpy(proc->peer_keys.irk, cmd.irk, 16);
+ proc->peer_keys.irk_valid = 1;
ble_sm_key_rxed(proc, res);
}
@@ -1993,8 +1992,9 @@ ble_sm_sign_info_rx(uint16_t conn_handle, uint8_t op, struct os_mbuf **om,
res->sm_err = BLE_SM_ERR_UNSPECIFIED;
} else {
proc->rx_key_flags &= ~BLE_SM_KE_F_SIGN_INFO;
- proc->peer_keys.csrk_valid = 1;
+
memcpy(proc->peer_keys.csrk, cmd.sig_key, 16);
+ proc->peer_keys.csrk_valid = 1;
ble_sm_key_rxed(proc, res);
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1de643d/net/nimble/host/src/ble_sm_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_cmd.c b/net/nimble/host/src/ble_sm_cmd.c
index f3a6f13..6ff4806 100644
--- a/net/nimble/host/src/ble_sm_cmd.c
+++ b/net/nimble/host/src/ble_sm_cmd.c
@@ -344,8 +344,7 @@ ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd)
void
ble_sm_enc_info_parse(void *payload, int len, struct ble_sm_enc_info *cmd)
{
- uint8_t *u8ptr = payload;
- memcpy(cmd->ltk, u8ptr, 16);
+ memcpy(cmd->ltk, payload, sizeof cmd->ltk);
}
int
@@ -423,7 +422,7 @@ ble_sm_master_id_log(struct ble_sm_master_id *cmd)
void
ble_sm_id_info_parse(void *payload, int len, struct ble_sm_id_info *cmd)
{
- swap_buf(cmd->irk, payload, 16);
+ memcpy(cmd->irk, payload, 16);
}
void
@@ -436,7 +435,7 @@ ble_sm_id_info_write(void *payload, int len, struct ble_sm_id_info *cmd)
u8ptr = payload;
u8ptr[0] = BLE_SM_OP_IDENTITY_INFO;
- swap_buf(u8ptr + BLE_SM_HDR_SZ, cmd->irk, sizeof cmd->irk);
+ memcpy(u8ptr + BLE_SM_HDR_SZ, cmd->irk, sizeof cmd->irk);
}
int
@@ -529,7 +528,7 @@ ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd)
void
ble_sm_sign_info_parse(void *payload, int len, struct ble_sm_sign_info *cmd)
{
- swap_buf(cmd->sig_key, payload, 16);
+ memcpy(cmd->sig_key, payload, 16);
}
void
@@ -542,7 +541,7 @@ ble_sm_sign_info_write(void *payload, int len, struct ble_sm_sign_info *cmd)
u8ptr = payload;
u8ptr[0] = BLE_SM_OP_SIGN_INFO;
- swap_buf(u8ptr + BLE_SM_HDR_SZ, cmd->sig_key, sizeof cmd->sig_key);
+ memcpy(u8ptr + BLE_SM_HDR_SZ, cmd->sig_key, sizeof cmd->sig_key);
}
int
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1de643d/net/nimble/host/src/ble_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_priv.h b/net/nimble/host/src/ble_sm_priv.h
index 9daed07..9b9c53f 100644
--- a/net/nimble/host/src/ble_sm_priv.h
+++ b/net/nimble/host/src/ble_sm_priv.h
@@ -133,7 +133,7 @@ struct ble_sm_master_id {
*/
#define BLE_SM_ID_INFO_SZ 16
struct ble_sm_id_info {
- /* Stored in little-endian. */
+ /* Sent and stored in little-endian. */
uint8_t irk[16];
};
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1de643d/net/nimble/host/src/test/ble_sm_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test_util.c b/net/nimble/host/src/test/ble_sm_test_util.c
index 0dcd8af..7d51e7e 100644
--- a/net/nimble/host/src/test/ble_sm_test_util.c
+++ b/net/nimble/host/src/test/ble_sm_test_util.c
@@ -514,7 +514,6 @@ ble_sm_test_util_verify_tx_id_info(struct ble_sm_id_info *exp_cmd)
{
struct ble_sm_id_info cmd;
struct os_mbuf *om;
- uint8_t irk[16];
ble_hs_test_util_tx_all();
om = ble_sm_test_util_verify_tx_hdr(BLE_SM_OP_IDENTITY_INFO,
@@ -523,9 +522,8 @@ ble_sm_test_util_verify_tx_id_info(struct ble_sm_id_info *exp_cmd)
TEST_ASSERT(memcmp(cmd.irk, exp_cmd->irk, 16) == 0);
- /* Ensure IRK is sent in big endian. */
- swap_buf(irk, om->om_data, 16);
- TEST_ASSERT(memcmp(irk, cmd.irk, 16) == 0);
+ /* Ensure IRK is sent in little endian. */
+ TEST_ASSERT(memcmp(om->om_data, cmd.irk, 16) == 0);
}
static void
@@ -555,7 +553,6 @@ ble_sm_test_util_verify_tx_sign_info(struct ble_sm_sign_info *exp_cmd)
{
struct ble_sm_sign_info cmd;
struct os_mbuf *om;
- uint8_t csrk[16];
ble_hs_test_util_tx_all();
om = ble_sm_test_util_verify_tx_hdr(BLE_SM_OP_SIGN_INFO,
@@ -564,9 +561,8 @@ ble_sm_test_util_verify_tx_sign_info(struct ble_sm_sign_info *exp_cmd)
TEST_ASSERT(memcmp(cmd.sig_key, exp_cmd->sig_key, 16) == 0);
- /* Ensure CSRK is sent in big endian. */
- swap_buf(csrk, om->om_data, 16);
- TEST_ASSERT(memcmp(csrk, cmd.sig_key, 16) == 0);
+ /* Ensure CSRK is sent in little endian. */
+ TEST_ASSERT(memcmp(om->om_data, cmd.sig_key, 16) == 0);
}
static void
@@ -704,7 +700,6 @@ ble_sm_test_util_verify_tx_add_resolve_list(uint8_t peer_id_addr_type,
uint8_t *peer_irk,
uint8_t *our_irk)
{
- uint8_t buf[16];
uint8_t param_len;
uint8_t *param;
@@ -716,10 +711,8 @@ ble_sm_test_util_verify_tx_add_resolve_list(uint8_t peer_id_addr_type,
TEST_ASSERT(memcmp(param + 1, peer_id_addr, 6) == 0);
/* Ensure IRKs are sent in little endian. */
- memcpy(buf, peer_irk, 16);
- TEST_ASSERT(memcmp(param + 7, buf, 16) == 0);
- memcpy(buf, our_irk, 16);
- TEST_ASSERT(memcmp(param + 23, buf, 16) == 0);
+ TEST_ASSERT(memcmp(param + 7, peer_irk, 16) == 0);
+ TEST_ASSERT(memcmp(param + 23, our_irk, 16) == 0);
}
void
@@ -958,8 +951,6 @@ ble_sm_test_util_verify_sc_persist(struct ble_sm_test_sc_params *params,
TEST_ASSERT(value_sec.rand_num == 0);
TEST_ASSERT(value_sec.authenticated == params->authenticated);
- /*** All keys get persisted in big endian. */
-
TEST_ASSERT(value_sec.ltk_present == 1);
TEST_ASSERT(memcmp(value_sec.ltk, params->ltk, 16) == 0);
[7/8] incubator-mynewt-core git commit: BLE Host - unit tests for
combined priv/sc.
Posted by cc...@apache.org.
BLE Host - unit tests for combined priv/sc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/ec61a048
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ec61a048
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ec61a048
Branch: refs/heads/upf54
Commit: ec61a048d7e71adef004f55e70f3cd1e4d4fb5e7
Parents: 714cc01
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 18:33:23 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 18:33:23 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/test/ble_hs_test_util.c | 25 +-
net/nimble/host/src/test/ble_hs_test_util.h | 5 +
net/nimble/host/src/test/ble_sm_sc_test.c | 1900 +++++++++++++++++++++-
net/nimble/host/src/test/ble_sm_test.c | 72 +-
net/nimble/host/src/test/ble_sm_test_util.c | 163 +-
net/nimble/host/src/test/ble_sm_test_util.h | 16 +-
6 files changed, 2064 insertions(+), 117 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index 8f99ddd..957ad91 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -307,15 +307,17 @@ ble_hs_test_util_set_ack_seq(struct ble_hs_test_util_phony_ack *acks)
}
void
-ble_hs_test_util_create_conn(uint16_t handle, uint8_t *addr,
- ble_gap_event_fn *cb, void *cb_arg)
+ble_hs_test_util_create_rpa_conn(uint16_t handle, uint8_t *our_rpa,
+ uint8_t peer_addr_type, uint8_t *peer_id_addr,
+ uint8_t *peer_rpa,
+ ble_gap_event_fn *cb, void *cb_arg)
{
struct hci_le_conn_complete evt;
int rc;
ble_hs_test_util_set_ack(
BLE_HS_TEST_UTIL_LE_OPCODE(BLE_HCI_OCF_LE_CREATE_CONN), 0);
- rc = ble_gap_conn_initiate(0, addr, NULL, cb, cb_arg);
+ rc = ble_gap_conn_initiate(peer_addr_type, peer_id_addr, NULL, cb, cb_arg);
TEST_ASSERT(rc == 0);
memset(&evt, 0, sizeof evt);
@@ -323,17 +325,30 @@ ble_hs_test_util_create_conn(uint16_t handle, uint8_t *addr,
evt.status = BLE_ERR_SUCCESS;
evt.connection_handle = handle;
evt.role = BLE_HCI_LE_CONN_COMPLETE_ROLE_MASTER;
- evt.peer_addr_type = BLE_ADDR_TYPE_PUBLIC;
- memcpy(evt.peer_addr, addr, 6);
+ evt.peer_addr_type = peer_addr_type;
+ memcpy(evt.peer_addr, peer_id_addr, 6);
evt.conn_itvl = BLE_GAP_INITIAL_CONN_ITVL_MAX;
evt.conn_latency = BLE_GAP_INITIAL_CONN_LATENCY;
evt.supervision_timeout = BLE_GAP_INITIAL_SUPERVISION_TIMEOUT;
+ memcpy(evt.local_rpa, our_rpa, 6);
+ memcpy(evt.peer_rpa, peer_rpa, 6);
+
rc = ble_gap_rx_conn_complete(&evt);
TEST_ASSERT(rc == 0);
ble_hs_test_util_prev_hci_tx_clear();
}
+void
+ble_hs_test_util_create_conn(uint16_t handle, uint8_t *peer_id_addr,
+ ble_gap_event_fn *cb, void *cb_arg)
+{
+ static uint8_t null_addr[6];
+
+ ble_hs_test_util_create_rpa_conn(handle, null_addr, BLE_ADDR_TYPE_PUBLIC,
+ peer_id_addr, null_addr, cb, cb_arg);
+}
+
int
ble_hs_test_util_conn_initiate(int addr_type, uint8_t *addr,
struct ble_gap_crt_params *params,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_hs_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.h b/net/nimble/host/src/test/ble_hs_test_util.h
index 55dcb21..9203252 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.h
+++ b/net/nimble/host/src/test/ble_hs_test_util.h
@@ -54,6 +54,11 @@ void ble_hs_test_util_build_cmd_complete(uint8_t *dst, int len,
void ble_hs_test_util_build_cmd_status(uint8_t *dst, int len,
uint8_t status, uint8_t num_pkts,
uint16_t opcode);
+void ble_hs_test_util_create_rpa_conn(uint16_t handle, uint8_t *our_rpa,
+ uint8_t peer_addr_type,
+ uint8_t *peer_id_addr,
+ uint8_t *peer_rpa,
+ ble_gap_event_fn *cb, void *cb_arg);
void ble_hs_test_util_create_conn(uint16_t handle, uint8_t *addr,
ble_gap_event_fn *cb, void *cb_arg);
int ble_hs_test_util_conn_initiate(int addr_type, uint8_t *addr,
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_sm_sc_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_sc_test.c b/net/nimble/host/src/test/ble_sm_sc_test.c
index 7d8cd77..a237510 100644
--- a/net/nimble/host/src/test/ble_sm_sc_test.c
+++ b/net/nimble/host/src/test/ble_sm_sc_test.c
@@ -48,10 +48,10 @@ TEST_CASE(ble_sm_sc_peer_jw_iio3_rio3_b1_iat0_rat0_ik5_rk7)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
- .resp_addr = {
+ .resp_id_addr = {
0x33, 0x22, 0x11, 0x00, 0x45, 0x0a,
},
.pair_req = {
@@ -190,10 +190,10 @@ TEST_CASE(ble_sm_sc_peer_pk_iio0_rio2_b1_iat0_rat0_ik5_rk7)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
- .resp_addr = {
+ .resp_id_addr = {
0x33, 0x22, 0x11, 0x00, 0x45, 0x0a,
},
.pair_req = {
@@ -795,10 +795,10 @@ TEST_CASE(ble_sm_sc_peer_pk_iio2_rio0_b1_iat0_rat0_ik5_rk7)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
- .resp_addr = {
+ .resp_id_addr = {
0x33, 0x22, 0x11, 0x00, 0x45, 0x0a,
},
.pair_req = {
@@ -1400,10 +1400,10 @@ TEST_CASE(ble_sm_sc_peer_nc_iio1_rio1_b1_iat0_rat0_ik5_rk7)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
- .resp_addr = {
+ .resp_id_addr = {
0x33, 0x22, 0x11, 0x00, 0x45, 0x0a,
},
.pair_req = {
@@ -1544,10 +1544,10 @@ TEST_CASE(ble_sm_sc_us_jw_iio3_rio4_b1_iat0_rat0_ik7_rk5)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
- .resp_addr = {
+ .resp_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
.pair_req = {
@@ -1686,10 +1686,10 @@ TEST_CASE(ble_sm_sc_us_pk_iio2_rio4_b1_iat0_rat0_ik7_rk5)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
- .resp_addr = {
+ .resp_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
.pair_req = {
@@ -2291,10 +2291,10 @@ TEST_CASE(ble_sm_sc_us_pk_iio0_rio4_b1_iat0_rat0_ik7_rk5)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
- .resp_addr = {
+ .resp_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
.pair_req = {
@@ -2896,10 +2896,10 @@ TEST_CASE(ble_sm_sc_us_nc_iio1_rio4_b1_iat0_rat0_ik7_rk5)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
- .resp_addr = {
+ .resp_id_addr = {
0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0,
},
.pair_req = {
@@ -3023,8 +3023,1864 @@ TEST_CASE(ble_sm_sc_us_nc_iio1_rio4_b1_iat0_rat0_ik7_rk5)
ble_sm_test_util_us_sc_good(¶ms);
}
+/**
+ * Secure connections pairing
+ * Master: peer
+ * Pair algorithm: just works
+ * Initiator IO capabilities: 3
+ * Responder IO capabilities: 3
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 7
+ * Responder key distribution: 7
+ */
+TEST_CASE(ble_sm_sc_peer_jw_iio3_rio3_b1_iat2_rat2_ik7_rk7)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0xd0, 0x8e, 0xf7, 0x42, 0x8c, 0x69,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0x1a, 0x6e, 0x83, 0x55, 0x5b, 0x5a,
+ },
+ .pair_req = {
+ .io_cap = 0x03,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x07,
+ },
+ .pair_rsp = {
+ .io_cap = 0x03,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x07,
+ },
+ .our_priv_key = {
+ 0xc5, 0x04, 0xc5, 0xf9, 0x28, 0x95, 0x78, 0x17,
+ 0xd5, 0x97, 0x1d, 0x01, 0xbb, 0x2c, 0xcf, 0x77,
+ 0x5c, 0x70, 0x52, 0xc6, 0x5e, 0x33, 0x2e, 0xe7,
+ 0x79, 0x58, 0xc8, 0xf1, 0xc2, 0x2d, 0xb0, 0x61,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x1e, 0x07, 0x87, 0xb2, 0x54, 0x3a, 0x44, 0x6b,
+ 0x97, 0x45, 0xa7, 0xa2, 0x36, 0xf4, 0x10, 0x42,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0x99, 0xc4, 0xdf, 0x4a, 0x2f, 0x14, 0xd8, 0x11,
+ 0xd3, 0x93, 0x53, 0xac, 0x64, 0xc8, 0x67, 0xe6,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0xc5, 0xb0, 0xf5, 0x2a, 0x65, 0x77, 0x05, 0xb8,
+ 0xf7, 0x5b, 0xad, 0x4e, 0xa9, 0x9e, 0x79, 0x98,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0xbb, 0x44, 0x9b, 0x1b, 0xcd, 0xfc, 0xdf, 0xff,
+ 0xbb, 0x34, 0xb7, 0x3b, 0x3e, 0x30, 0xa1, 0x6e,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x58, 0x8f, 0xbe, 0xa2, 0x5f, 0xe3, 0x0a, 0xbc,
+ 0x17, 0x0f, 0x3b, 0x23, 0x27, 0xa5, 0xfb, 0x25,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .sign_info_req = {
+ .sig_key = {
+ 0xd3, 0x46, 0x86, 0xf7, 0xeb, 0x19, 0x0a, 0x18,
+ 0x5a, 0xb2, 0xd0, 0x5b, 0x0f, 0x03, 0x64, 0x01,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0x84, 0x91, 0x5d, 0x89, 0xf6, 0xf0, 0x01, 0x65,
+ 0xed, 0xa9, 0xcc, 0x9b, 0xa4, 0xd4, 0x97, 0x86,
+ },
+ },
+ .ltk = {
+ 0x4b, 0xb6, 0x1d, 0xd2, 0xba, 0xa4, 0x94, 0xe5,
+ 0x78, 0xde, 0xee, 0x47, 0x7a, 0x95, 0x91, 0x1c,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_JW,
+ .authenticated = 0,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_NONE,
+ },
+ },
+ };
+ ble_sm_test_util_peer_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: peer
+ * Pair algorithm: numeric comparison
+ * Initiator IO capabilities: 1
+ * Responder IO capabilities: 1
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 3
+ * Responder key distribution: 3
+ */
+TEST_CASE(ble_sm_sc_peer_nc_iio1_rio1_b1_iat2_rat2_ik3_rk3)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0xc5, 0xf3, 0x5d, 0x83, 0xcd, 0x4a,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0x9f, 0x56, 0x57, 0x5e, 0x12, 0x65,
+ },
+ .pair_req = {
+ .io_cap = 0x01,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .pair_rsp = {
+ .io_cap = 0x01,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .our_priv_key = {
+ 0xc5, 0x04, 0xc5, 0xf9, 0x28, 0x95, 0x78, 0x17,
+ 0xd5, 0x97, 0x1d, 0x01, 0xbb, 0x2c, 0xcf, 0x77,
+ 0x5c, 0x70, 0x52, 0xc6, 0x5e, 0x33, 0x2e, 0xe7,
+ 0x79, 0x58, 0xc8, 0xf1, 0xc2, 0x2d, 0xb0, 0x61,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x39, 0xba, 0x86, 0x47, 0x06, 0x87, 0x14, 0xe4,
+ 0x5c, 0x82, 0xe9, 0x6a, 0x80, 0xca, 0x87, 0xcd,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0xce, 0xe2, 0xa3, 0x29, 0x8a, 0xc6, 0x76, 0x1d,
+ 0xa2, 0xfd, 0xe0, 0x7f, 0x8c, 0xbe, 0xf8, 0x1d,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x3d, 0xac, 0xf0, 0xfe, 0x7c, 0x78, 0x73, 0x03,
+ 0xe2, 0xb6, 0x59, 0x7e, 0x80, 0xb4, 0x69, 0x07,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0xaa, 0x95, 0x9f, 0x33, 0x32, 0xa1, 0xbd, 0xf9,
+ 0xef, 0xb9, 0x3d, 0xfb, 0x08, 0xd1, 0x28, 0xa0,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x3c, 0x10, 0x17, 0x76, 0x55, 0x65, 0x6f, 0x14,
+ 0xfa, 0x80, 0xd3, 0x52, 0x04, 0x82, 0xe2, 0xf7,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0xd4, 0x66, 0x94, 0xc9, 0x96, 0xd0, 0x28, 0x96,
+ 0x1c, 0xa1, 0x3b, 0xf7, 0x15, 0x95, 0x95, 0x43,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xb7, 0x98, 0xac, 0x85, 0xc4, 0x0a, 0x69, 0x8d,
+ 0xa6, 0xaf, 0xf3, 0x1f, 0x63, 0x3c, 0xf2, 0x33,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .ltk = {
+ 0x95, 0x46, 0xe6, 0x8e, 0x52, 0xcc, 0x05, 0xca,
+ 0xf4, 0x59, 0x57, 0x54, 0x8c, 0x0d, 0x51, 0xfc,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_NUMCMP,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_NUMCMP,
+ .numcmp_accept = 1,
+ },
+ .exp_numcmp = 70210,
+ },
+ };
+ ble_sm_test_util_peer_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: peer
+ * Pair algorithm: passkey entry
+ * Initiator IO capabilities: 2
+ * Responder IO capabilities: 0
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 7
+ * Responder key distribution: 3
+ */
+TEST_CASE(ble_sm_sc_peer_pk_iio2_rio0_b1_iat2_rat2_ik7_rk3)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0x6e, 0x56, 0x09, 0xef, 0x1e, 0x76,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0xb5, 0x29, 0xdf, 0xb4, 0x9b, 0x62,
+ },
+ .pair_req = {
+ .io_cap = 0x02,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x03,
+ },
+ .pair_rsp = {
+ .io_cap = 0x00,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x03,
+ },
+ .our_priv_key = {
+ 0xc5, 0x04, 0xc5, 0xf9, 0x28, 0x95, 0x78, 0x17,
+ 0xd5, 0x97, 0x1d, 0x01, 0xbb, 0x2c, 0xcf, 0x77,
+ 0x5c, 0x70, 0x52, 0xc6, 0x5e, 0x33, 0x2e, 0xe7,
+ 0x79, 0x58, 0xc8, 0xf1, 0xc2, 0x2d, 0xb0, 0x61,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_req[0] = {
+ .value = {
+ 0x12, 0xe3, 0x01, 0xd0, 0x30, 0x59, 0xca, 0xd9,
+ 0x78, 0x0b, 0x45, 0x73, 0xb1, 0x7a, 0x4d, 0xca,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x47, 0x68, 0x16, 0x24, 0xd4, 0x07, 0x60, 0x6c,
+ 0xa5, 0x47, 0x6f, 0x05, 0x78, 0x71, 0x3e, 0xa8,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0x2a, 0x29, 0xa8, 0xef, 0x0b, 0x70, 0x5f, 0x1b,
+ 0x81, 0x4d, 0x97, 0xff, 0xfb, 0x7f, 0x30, 0x90,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x12, 0x9e, 0x1d, 0x12, 0x11, 0x44, 0x36, 0x74,
+ 0xa3, 0x0c, 0xea, 0x36, 0x4d, 0xdf, 0x2d, 0x5d,
+ },
+ },
+ .confirm_req[1] = {
+ .value = {
+ 0x4d, 0x6a, 0x32, 0xfe, 0xe2, 0xa0, 0xdd, 0x92,
+ 0x60, 0x5c, 0x82, 0x7f, 0xa6, 0xa6, 0x24, 0xd6,
+ },
+ },
+ .confirm_rsp[1] = {
+ .value = {
+ 0xd5, 0x3e, 0xa7, 0xa0, 0xbf, 0x39, 0x8e, 0xfe,
+ 0xfd, 0x73, 0x47, 0x4c, 0x92, 0x8b, 0x74, 0x06,
+ },
+ },
+ .random_req[1] = {
+ .value = {
+ 0xc1, 0x88, 0xdf, 0xb0, 0x99, 0xbb, 0xbf, 0xed,
+ 0xdc, 0x40, 0x66, 0x55, 0xbe, 0x91, 0x56, 0x9a,
+ },
+ },
+ .random_rsp[1] = {
+ .value = {
+ 0xed, 0xed, 0x9a, 0x61, 0xb8, 0x21, 0x03, 0x77,
+ 0xa6, 0xcf, 0x34, 0x65, 0x8c, 0x18, 0x82, 0x9f,
+ },
+ },
+ .confirm_req[2] = {
+ .value = {
+ 0xdb, 0xea, 0x94, 0x29, 0xe4, 0x44, 0x7d, 0x7b,
+ 0xd3, 0x16, 0x81, 0x8e, 0xaf, 0xe6, 0x9c, 0x85,
+ },
+ },
+ .confirm_rsp[2] = {
+ .value = {
+ 0x3f, 0xdd, 0x54, 0x76, 0xab, 0x45, 0x7f, 0x53,
+ 0x64, 0x6b, 0x37, 0xa6, 0xc7, 0xc6, 0x4a, 0x73,
+ },
+ },
+ .random_req[2] = {
+ .value = {
+ 0x5a, 0xf1, 0xfb, 0xde, 0xb3, 0xbe, 0x6e, 0xac,
+ 0x68, 0x51, 0x47, 0x8e, 0x0b, 0xcd, 0xc1, 0xa0,
+ },
+ },
+ .random_rsp[2] = {
+ .value = {
+ 0x29, 0x0f, 0x5e, 0x83, 0x87, 0xca, 0xd3, 0x21,
+ 0xa7, 0x7e, 0x3d, 0x78, 0x47, 0x54, 0xf8, 0xe4,
+ },
+ },
+ .confirm_req[3] = {
+ .value = {
+ 0xca, 0x3e, 0xd5, 0xe3, 0x59, 0xb0, 0x5d, 0x1e,
+ 0x0f, 0x4c, 0x95, 0x0f, 0x6a, 0x72, 0xcf, 0x25,
+ },
+ },
+ .confirm_rsp[3] = {
+ .value = {
+ 0x2f, 0x4d, 0x06, 0x40, 0x09, 0x68, 0x68, 0x45,
+ 0x87, 0x79, 0x78, 0x48, 0xda, 0xe4, 0xf5, 0xae,
+ },
+ },
+ .random_req[3] = {
+ .value = {
+ 0x63, 0x5a, 0xee, 0x91, 0xe4, 0xf8, 0xe8, 0x69,
+ 0xd1, 0x46, 0x18, 0x0d, 0xd2, 0x94, 0xd8, 0x20,
+ },
+ },
+ .random_rsp[3] = {
+ .value = {
+ 0x76, 0x36, 0xf5, 0xc2, 0x41, 0xb6, 0x3c, 0x1f,
+ 0x36, 0x19, 0x58, 0xce, 0x8f, 0x41, 0xeb, 0x8c,
+ },
+ },
+ .confirm_req[4] = {
+ .value = {
+ 0x76, 0xfd, 0x84, 0x0f, 0x0f, 0x58, 0x70, 0x45,
+ 0x41, 0x33, 0x5d, 0xce, 0xe5, 0xe2, 0x2f, 0x83,
+ },
+ },
+ .confirm_rsp[4] = {
+ .value = {
+ 0x87, 0xcf, 0xdf, 0xa5, 0x60, 0x82, 0x4f, 0x09,
+ 0x4c, 0x50, 0x24, 0xba, 0x91, 0x96, 0x0d, 0x65,
+ },
+ },
+ .random_req[4] = {
+ .value = {
+ 0x67, 0xdb, 0x73, 0x1e, 0x57, 0x5c, 0xb7, 0x86,
+ 0xf8, 0xaf, 0x58, 0xd8, 0x0f, 0x97, 0x47, 0xce,
+ },
+ },
+ .random_rsp[4] = {
+ .value = {
+ 0xaa, 0x99, 0x90, 0x05, 0x11, 0xfc, 0xc2, 0xd9,
+ 0xb8, 0xd6, 0x9d, 0xef, 0x86, 0x10, 0xcf, 0x26,
+ },
+ },
+ .confirm_req[5] = {
+ .value = {
+ 0xfc, 0x22, 0xd9, 0x1f, 0x5f, 0x86, 0x25, 0xe7,
+ 0x5e, 0x55, 0x48, 0x35, 0xec, 0x32, 0x37, 0x6d,
+ },
+ },
+ .confirm_rsp[5] = {
+ .value = {
+ 0x98, 0xbc, 0x07, 0x72, 0xa2, 0xe7, 0xa7, 0x66,
+ 0x64, 0xf7, 0x29, 0x3a, 0xaf, 0x52, 0x18, 0x04,
+ },
+ },
+ .random_req[5] = {
+ .value = {
+ 0xd3, 0x36, 0xb9, 0x69, 0x6a, 0x6d, 0x55, 0xbc,
+ 0x82, 0xdf, 0x1c, 0x04, 0xa7, 0xd5, 0x00, 0x68,
+ },
+ },
+ .random_rsp[5] = {
+ .value = {
+ 0xb9, 0x03, 0xbf, 0xd9, 0x86, 0x5a, 0x1a, 0xb4,
+ 0xdc, 0xe6, 0x8f, 0x9b, 0xa4, 0xa8, 0x2a, 0x12,
+ },
+ },
+ .confirm_req[6] = {
+ .value = {
+ 0xfe, 0x14, 0xab, 0x1c, 0xfd, 0x36, 0x64, 0x38,
+ 0xc1, 0xf8, 0xdd, 0xcd, 0xf4, 0x77, 0xa1, 0xb8,
+ },
+ },
+ .confirm_rsp[6] = {
+ .value = {
+ 0x2e, 0x70, 0x54, 0xdc, 0xa6, 0xae, 0xb2, 0xcd,
+ 0x4a, 0x26, 0x97, 0xf8, 0xbf, 0xb4, 0xb4, 0x52,
+ },
+ },
+ .random_req[6] = {
+ .value = {
+ 0x1e, 0x27, 0x73, 0x94, 0x44, 0xfc, 0xd4, 0x44,
+ 0xbf, 0x5b, 0x7d, 0x5d, 0x6d, 0x13, 0x68, 0xb1,
+ },
+ },
+ .random_rsp[6] = {
+ .value = {
+ 0xeb, 0xfd, 0x0b, 0xa1, 0x7b, 0xda, 0x61, 0xdc,
+ 0x6d, 0xe4, 0x3b, 0x51, 0xa7, 0x09, 0x29, 0x6d,
+ },
+ },
+ .confirm_req[7] = {
+ .value = {
+ 0x38, 0x2b, 0x23, 0xb9, 0x18, 0x2d, 0xb9, 0x0b,
+ 0xe7, 0x4d, 0x20, 0x83, 0xab, 0x17, 0xfd, 0x88,
+ },
+ },
+ .confirm_rsp[7] = {
+ .value = {
+ 0x65, 0x60, 0x85, 0xef, 0x0e, 0x9a, 0x23, 0x96,
+ 0xe7, 0xa9, 0xee, 0xba, 0x9e, 0x48, 0xb9, 0x1c,
+ },
+ },
+ .random_req[7] = {
+ .value = {
+ 0x8b, 0xa8, 0x7a, 0x33, 0x15, 0x1e, 0xa7, 0x78,
+ 0x27, 0x01, 0x3e, 0x90, 0x43, 0x47, 0x5a, 0x9d,
+ },
+ },
+ .random_rsp[7] = {
+ .value = {
+ 0x76, 0xf1, 0x21, 0x67, 0x94, 0x20, 0x6f, 0xc7,
+ 0x84, 0xc8, 0xdb, 0x07, 0xdb, 0x77, 0xdd, 0x50,
+ },
+ },
+ .confirm_req[8] = {
+ .value = {
+ 0x4e, 0x7f, 0x83, 0x8e, 0xa6, 0x28, 0xaa, 0x46,
+ 0xa2, 0x69, 0x95, 0x3b, 0xf0, 0x71, 0x14, 0x24,
+ },
+ },
+ .confirm_rsp[8] = {
+ .value = {
+ 0x93, 0x0b, 0x4d, 0xbe, 0x49, 0x36, 0xa0, 0x26,
+ 0xe9, 0x18, 0x4e, 0xc8, 0x19, 0x59, 0xc1, 0x7d,
+ },
+ },
+ .random_req[8] = {
+ .value = {
+ 0x11, 0xa9, 0xce, 0x26, 0x0e, 0x2f, 0x11, 0x0e,
+ 0xc1, 0xbd, 0x68, 0x80, 0xc8, 0xf8, 0x41, 0x65,
+ },
+ },
+ .random_rsp[8] = {
+ .value = {
+ 0xb6, 0x3d, 0x6b, 0x62, 0xb5, 0x37, 0x31, 0x28,
+ 0x79, 0xc4, 0xe2, 0x62, 0xbb, 0x63, 0xf9, 0x91,
+ },
+ },
+ .confirm_req[9] = {
+ .value = {
+ 0x5f, 0x55, 0xb5, 0xa4, 0x80, 0xa8, 0x54, 0x47,
+ 0xa7, 0x79, 0x87, 0x12, 0x2e, 0x44, 0x92, 0x42,
+ },
+ },
+ .confirm_rsp[9] = {
+ .value = {
+ 0x01, 0x69, 0xa2, 0xac, 0xd6, 0x62, 0x8a, 0x64,
+ 0xa2, 0x0b, 0xd0, 0xb4, 0x0e, 0x68, 0xe0, 0x88,
+ },
+ },
+ .random_req[9] = {
+ .value = {
+ 0x75, 0x1e, 0x56, 0xd0, 0xcb, 0x06, 0xfd, 0x51,
+ 0x55, 0xae, 0x77, 0xa4, 0xf2, 0xe7, 0x86, 0x3c,
+ },
+ },
+ .random_rsp[9] = {
+ .value = {
+ 0xff, 0xab, 0x8a, 0x7d, 0xb7, 0x40, 0xe5, 0x07,
+ 0xfe, 0x8f, 0x74, 0xdb, 0x2c, 0x35, 0x35, 0x12,
+ },
+ },
+ .confirm_req[10] = {
+ .value = {
+ 0x1f, 0x2a, 0xed, 0xcd, 0x6b, 0x87, 0xea, 0xa2,
+ 0xf8, 0xd8, 0xad, 0x04, 0x23, 0xc7, 0x5d, 0x47,
+ },
+ },
+ .confirm_rsp[10] = {
+ .value = {
+ 0x5b, 0x18, 0x2d, 0x96, 0x3b, 0xf6, 0xdc, 0x82,
+ 0x3b, 0xfa, 0xc9, 0x81, 0xc7, 0x33, 0xa0, 0x07,
+ },
+ },
+ .random_req[10] = {
+ .value = {
+ 0xd1, 0x3a, 0x82, 0xce, 0x31, 0x75, 0xa2, 0xbf,
+ 0x6f, 0x12, 0xf2, 0xac, 0xf6, 0xcc, 0xea, 0x34,
+ },
+ },
+ .random_rsp[10] = {
+ .value = {
+ 0xcf, 0x11, 0x3d, 0x44, 0x10, 0x0d, 0x26, 0x32,
+ 0xa5, 0x61, 0x13, 0xfd, 0xb8, 0xed, 0x31, 0x53,
+ },
+ },
+ .confirm_req[11] = {
+ .value = {
+ 0x67, 0x14, 0x8a, 0xf6, 0xc8, 0xb8, 0x73, 0x6b,
+ 0xb2, 0xec, 0xa9, 0x61, 0xaa, 0xc0, 0xc9, 0x28,
+ },
+ },
+ .confirm_rsp[11] = {
+ .value = {
+ 0xa5, 0xbf, 0x00, 0x07, 0x48, 0xff, 0x30, 0x36,
+ 0x20, 0x83, 0xd7, 0xd6, 0xd0, 0x90, 0x46, 0x03,
+ },
+ },
+ .random_req[11] = {
+ .value = {
+ 0x75, 0x99, 0x9a, 0xa3, 0xad, 0x9a, 0xe5, 0x9d,
+ 0x2f, 0x21, 0xdb, 0x72, 0x2f, 0xaf, 0xb8, 0x79,
+ },
+ },
+ .random_rsp[11] = {
+ .value = {
+ 0xa3, 0xb7, 0xb7, 0x46, 0x39, 0x99, 0xc2, 0x82,
+ 0xe9, 0x31, 0x8d, 0xc2, 0x28, 0x1b, 0x86, 0x91,
+ },
+ },
+ .confirm_req[12] = {
+ .value = {
+ 0x46, 0x2f, 0xc8, 0x0e, 0x2c, 0x70, 0x3a, 0xdb,
+ 0x25, 0x2f, 0xce, 0xe6, 0x15, 0x1f, 0x9a, 0x06,
+ },
+ },
+ .confirm_rsp[12] = {
+ .value = {
+ 0x9a, 0xa4, 0xe0, 0x03, 0x3a, 0xb5, 0x43, 0x75,
+ 0x8e, 0x93, 0x35, 0x25, 0xe6, 0x5e, 0x9d, 0x7f,
+ },
+ },
+ .random_req[12] = {
+ .value = {
+ 0x1f, 0x01, 0x32, 0x56, 0x64, 0x45, 0xc5, 0x20,
+ 0xd4, 0xad, 0x13, 0x8f, 0xbe, 0x82, 0xc8, 0x01,
+ },
+ },
+ .random_rsp[12] = {
+ .value = {
+ 0xd4, 0x3f, 0xa4, 0xc9, 0xe9, 0x2e, 0x62, 0x77,
+ 0x4e, 0x21, 0x55, 0xd8, 0xde, 0x31, 0xf5, 0xea,
+ },
+ },
+ .confirm_req[13] = {
+ .value = {
+ 0x4e, 0x48, 0x88, 0x4e, 0x4f, 0x74, 0x7e, 0xec,
+ 0x99, 0x5d, 0xb1, 0xcb, 0x84, 0x88, 0x80, 0xe9,
+ },
+ },
+ .confirm_rsp[13] = {
+ .value = {
+ 0x1a, 0x84, 0xfa, 0x2f, 0xd7, 0x3c, 0x5f, 0xee,
+ 0x3e, 0x81, 0xc0, 0x4b, 0x35, 0x4b, 0x7e, 0x98,
+ },
+ },
+ .random_req[13] = {
+ .value = {
+ 0xe3, 0x3a, 0xc5, 0x2f, 0x9f, 0x91, 0x93, 0xfb,
+ 0xcb, 0xd8, 0x53, 0x63, 0xab, 0xc4, 0xa5, 0x85,
+ },
+ },
+ .random_rsp[13] = {
+ .value = {
+ 0xa0, 0xcf, 0xad, 0x30, 0x2d, 0xec, 0xea, 0x81,
+ 0xfd, 0x7f, 0xcf, 0x7c, 0x70, 0xc9, 0x89, 0x7b,
+ },
+ },
+ .confirm_req[14] = {
+ .value = {
+ 0xe1, 0x64, 0x22, 0x19, 0x41, 0x44, 0x37, 0x2b,
+ 0x92, 0x60, 0xa4, 0x1f, 0xd6, 0x53, 0xe0, 0xa0,
+ },
+ },
+ .confirm_rsp[14] = {
+ .value = {
+ 0x08, 0xfa, 0xa4, 0xf8, 0x04, 0x08, 0xb8, 0x9f,
+ 0x61, 0xb5, 0x68, 0xaf, 0x31, 0x12, 0x8d, 0x3f,
+ },
+ },
+ .random_req[14] = {
+ .value = {
+ 0xad, 0x76, 0xc3, 0x1a, 0x4c, 0x64, 0x2c, 0x11,
+ 0x5e, 0x48, 0x6d, 0x41, 0xf5, 0x77, 0xc2, 0x40,
+ },
+ },
+ .random_rsp[14] = {
+ .value = {
+ 0x1b, 0xec, 0x78, 0x2b, 0xd9, 0xbe, 0x93, 0xbd,
+ 0x0b, 0x03, 0xf1, 0xd8, 0x31, 0xe8, 0x60, 0x67,
+ },
+ },
+ .confirm_req[15] = {
+ .value = {
+ 0x5e, 0x22, 0x44, 0x09, 0x97, 0xf9, 0xc5, 0xc7,
+ 0x23, 0xc7, 0x74, 0x51, 0xe5, 0x9d, 0x5c, 0xed,
+ },
+ },
+ .confirm_rsp[15] = {
+ .value = {
+ 0xfe, 0xb2, 0x90, 0xa7, 0x06, 0xaf, 0xdd, 0x6a,
+ 0x83, 0x26, 0x3c, 0x78, 0x66, 0xe0, 0x9d, 0xd9,
+ },
+ },
+ .random_req[15] = {
+ .value = {
+ 0xb2, 0xa0, 0x75, 0x6f, 0x77, 0xc1, 0x0b, 0x4e,
+ 0x99, 0xfa, 0x9a, 0x02, 0xf6, 0xe4, 0x66, 0x27,
+ },
+ },
+ .random_rsp[15] = {
+ .value = {
+ 0xf9, 0xdd, 0x69, 0xae, 0xc8, 0x66, 0xa9, 0xab,
+ 0xb8, 0x01, 0x38, 0xc3, 0x2a, 0x6b, 0x94, 0x66,
+ },
+ },
+ .confirm_req[16] = {
+ .value = {
+ 0x17, 0xc9, 0xf7, 0x2d, 0xe6, 0xb7, 0x99, 0x77,
+ 0x65, 0xf7, 0x62, 0xc8, 0x0d, 0x7d, 0xbd, 0x81,
+ },
+ },
+ .confirm_rsp[16] = {
+ .value = {
+ 0x39, 0xef, 0xbf, 0x39, 0xfa, 0x79, 0xc3, 0x7b,
+ 0x71, 0x40, 0x3c, 0x1f, 0x67, 0xe5, 0x60, 0xe5,
+ },
+ },
+ .random_req[16] = {
+ .value = {
+ 0x32, 0xab, 0x8b, 0xed, 0x90, 0x04, 0x5e, 0x17,
+ 0xd2, 0x5e, 0xa8, 0x91, 0xf7, 0x77, 0xe3, 0xd7,
+ },
+ },
+ .random_rsp[16] = {
+ .value = {
+ 0x6c, 0xc7, 0x14, 0x13, 0xdf, 0xfb, 0xc6, 0xed,
+ 0xa3, 0x9c, 0xa7, 0x90, 0xae, 0x4c, 0x61, 0x47,
+ },
+ },
+ .confirm_req[17] = {
+ .value = {
+ 0xc5, 0x17, 0x07, 0x35, 0x34, 0xbf, 0xc1, 0x4d,
+ 0xc4, 0x57, 0xc0, 0xd9, 0xfd, 0xe9, 0x10, 0x08,
+ },
+ },
+ .confirm_rsp[17] = {
+ .value = {
+ 0xbb, 0xcf, 0x41, 0xd2, 0x94, 0xea, 0xbe, 0x2f,
+ 0xde, 0xb2, 0xb4, 0x20, 0x72, 0x1c, 0xf8, 0x35,
+ },
+ },
+ .random_req[17] = {
+ .value = {
+ 0x59, 0x20, 0xb5, 0xdc, 0xaf, 0xc3, 0x8b, 0x32,
+ 0xe6, 0x40, 0x0f, 0x02, 0x67, 0x45, 0x49, 0x1f,
+ },
+ },
+ .random_rsp[17] = {
+ .value = {
+ 0xf5, 0x95, 0x60, 0x4c, 0x5f, 0x39, 0x54, 0xbf,
+ 0x62, 0x9e, 0x85, 0xca, 0x31, 0x9a, 0x95, 0xee,
+ },
+ },
+ .confirm_req[18] = {
+ .value = {
+ 0x36, 0x50, 0x78, 0x6b, 0x0f, 0x11, 0xe3, 0xa9,
+ 0x79, 0x3a, 0xa6, 0x9d, 0xd4, 0x8b, 0x13, 0x3f,
+ },
+ },
+ .confirm_rsp[18] = {
+ .value = {
+ 0xa5, 0x34, 0x5d, 0x5e, 0x43, 0x01, 0xf2, 0xe1,
+ 0x3f, 0xf2, 0x1c, 0x8b, 0x13, 0xf7, 0x17, 0x3e,
+ },
+ },
+ .random_req[18] = {
+ .value = {
+ 0x77, 0xa1, 0xbe, 0xbf, 0x49, 0xb8, 0x74, 0x73,
+ 0x47, 0x78, 0x2a, 0xf8, 0x66, 0x6b, 0xff, 0xd2,
+ },
+ },
+ .random_rsp[18] = {
+ .value = {
+ 0xa2, 0x05, 0x69, 0x65, 0x3f, 0xd4, 0xb4, 0xcd,
+ 0xed, 0x8c, 0x36, 0x6d, 0x51, 0x6a, 0xbb, 0xef,
+ },
+ },
+ .confirm_req[19] = {
+ .value = {
+ 0xda, 0xd8, 0x96, 0xfd, 0x1c, 0x0d, 0x1e, 0x56,
+ 0xe2, 0x62, 0xed, 0x18, 0x4b, 0xd3, 0x46, 0x48,
+ },
+ },
+ .confirm_rsp[19] = {
+ .value = {
+ 0xeb, 0x79, 0x5e, 0x52, 0x70, 0x25, 0xa7, 0x41,
+ 0x33, 0xfa, 0xac, 0xd3, 0x27, 0x35, 0xfc, 0x5f,
+ },
+ },
+ .random_req[19] = {
+ .value = {
+ 0xa8, 0x9c, 0xb9, 0xcd, 0x13, 0xb8, 0xdd, 0xd2,
+ 0x09, 0xd6, 0xc8, 0x12, 0xc3, 0x69, 0x9a, 0x64,
+ },
+ },
+ .random_rsp[19] = {
+ .value = {
+ 0x06, 0xe3, 0x8a, 0xef, 0xe4, 0x42, 0xae, 0x86,
+ 0xef, 0x58, 0x80, 0xe8, 0xe3, 0xa2, 0x09, 0x44,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x6f, 0xa5, 0x37, 0x06, 0x4a, 0x89, 0x98, 0x39,
+ 0xf6, 0x69, 0x48, 0x56, 0x17, 0x6d, 0x44, 0x7c,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x82, 0x48, 0xd4, 0x9e, 0xb8, 0x3c, 0xb4, 0xdc,
+ 0x44, 0xcb, 0x19, 0xdb, 0xcb, 0xa2, 0x00, 0x5d,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62, 0x0d,
+ 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7, 0x07,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xda, 0x6b, 0x27, 0xa0, 0xac, 0x71, 0xf0, 0xc3,
+ 0x75, 0x51, 0xf6, 0x21, 0x94, 0xec, 0x81, 0x92,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0x49, 0x5b, 0x11, 0xb3, 0x4c, 0x1a, 0x23, 0x5c,
+ 0x61, 0x4f, 0xe3, 0x08, 0xf9, 0x47, 0x8b, 0xdc,
+ },
+ },
+ .ltk = {
+ 0x5a, 0x49, 0x28, 0xf0, 0x11, 0x3b, 0x6f, 0x6b,
+ 0x3a, 0x69, 0x6d, 0xdd, 0xb2, 0xe5, 0xa8, 0x97,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_PASSKEY,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_DISP,
+ .passkey = 4915,
+ },
+ },
+ };
+ ble_sm_test_util_peer_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: just works
+ * Initiator IO capabilities: 3
+ * Responder IO capabilities: 3
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 3
+ * Responder key distribution: 3
+ */
+TEST_CASE(ble_sm_sc_us_jw_iio3_rio3_b1_iat2_rat2_ik3_rk3)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0x46, 0x85, 0x37, 0x90, 0x86, 0x58,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0x6d, 0x59, 0x7d, 0xa9, 0x87, 0x74,
+ },
+ .pair_req = {
+ .io_cap = 0x03,
+ .oob_data_flag = 0x00,
+ .authreq = 0x09,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .pair_rsp = {
+ .io_cap = 0x03,
+ .oob_data_flag = 0x00,
+ .authreq = 0x09,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .our_priv_key = {
+ 0xdb, 0x24, 0x2e, 0x91, 0xda, 0xaa, 0x33, 0x33,
+ 0x23, 0xa2, 0x1e, 0xbe, 0x06, 0x69, 0xdb, 0xad,
+ 0xa9, 0x2a, 0x91, 0xb1, 0x24, 0x0a, 0xc7, 0xaf,
+ 0x50, 0x0c, 0x65, 0x5b, 0x97, 0x1e, 0x12, 0x10,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x32, 0x5b, 0xee, 0x46, 0x42, 0x63, 0xca, 0x86,
+ 0x2d, 0xe7, 0xd2, 0x75, 0x23, 0x7b, 0x4d, 0x59,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0xd4, 0x66, 0x94, 0xc9, 0x96, 0xd0, 0x28, 0x96,
+ 0x1c, 0xa1, 0x3b, 0xf7, 0x15, 0x95, 0x95, 0x43,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0xb7, 0x98, 0xac, 0x85, 0xc4, 0x0a, 0x69, 0x8d,
+ 0xa6, 0xaf, 0xf3, 0x1f, 0x63, 0x3c, 0xf2, 0x33,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x1a, 0xc7, 0x0b, 0xfe, 0xc0, 0x55, 0xc3, 0xdb,
+ 0x94, 0x00, 0x89, 0x4f, 0x0e, 0x64, 0x05, 0xcd,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0xf2, 0x45, 0x41, 0xc0, 0xba, 0x8d, 0x58, 0xec,
+ 0x61, 0xfb, 0x48, 0x71, 0xb4, 0x0e, 0x7b, 0x19,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .ltk = {
+ 0x8b, 0xb6, 0xf6, 0x5a, 0x52, 0x7b, 0xb8, 0xf4,
+ 0xb8, 0x4c, 0xe7, 0x60, 0x4f, 0x0b, 0x88, 0xfe,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_JW,
+ .authenticated = 0,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_NONE,
+ },
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: numeric comparison
+ * Initiator IO capabilities: 1
+ * Responder IO capabilities: 1
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 3
+ * Responder key distribution: 3
+ */
+TEST_CASE(ble_sm_sc_us_nc_iio1_rio1_b1_iat2_rat2_ik3_rk3)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0xc5, 0xf3, 0x5d, 0x83, 0xcd, 0x4a,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0x9f, 0x56, 0x57, 0x5e, 0x12, 0x65,
+ },
+ .pair_req = {
+ .io_cap = 0x01,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .pair_rsp = {
+ .io_cap = 0x01,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x03,
+ .resp_key_dist = 0x03,
+ },
+ .our_priv_key = {
+ 0xdb, 0x24, 0x2e, 0x91, 0xda, 0xaa, 0x33, 0x33,
+ 0x23, 0xa2, 0x1e, 0xbe, 0x06, 0x69, 0xdb, 0xad,
+ 0xa9, 0x2a, 0x91, 0xb1, 0x24, 0x0a, 0xc7, 0xaf,
+ 0x50, 0x0c, 0x65, 0x5b, 0x97, 0x1e, 0x12, 0x10,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x39, 0xba, 0x86, 0x47, 0x06, 0x87, 0x14, 0xe4,
+ 0x5c, 0x82, 0xe9, 0x6a, 0x80, 0xca, 0x87, 0xcd,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0xce, 0xe2, 0xa3, 0x29, 0x8a, 0xc6, 0x76, 0x1d,
+ 0xa2, 0xfd, 0xe0, 0x7f, 0x8c, 0xbe, 0xf8, 0x1d,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x3d, 0xac, 0xf0, 0xfe, 0x7c, 0x78, 0x73, 0x03,
+ 0xe2, 0xb6, 0x59, 0x7e, 0x80, 0xb4, 0x69, 0x07,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0xaa, 0x95, 0x9f, 0x33, 0x32, 0xa1, 0xbd, 0xf9,
+ 0xef, 0xb9, 0x3d, 0xfb, 0x08, 0xd1, 0x28, 0xa0,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x3c, 0x10, 0x17, 0x76, 0x55, 0x65, 0x6f, 0x14,
+ 0xfa, 0x80, 0xd3, 0x52, 0x04, 0x82, 0xe2, 0xf7,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0xd4, 0x66, 0x94, 0xc9, 0x96, 0xd0, 0x28, 0x96,
+ 0x1c, 0xa1, 0x3b, 0xf7, 0x15, 0x95, 0x95, 0x43,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xb7, 0x98, 0xac, 0x85, 0xc4, 0x0a, 0x69, 0x8d,
+ 0xa6, 0xaf, 0xf3, 0x1f, 0x63, 0x3c, 0xf2, 0x33,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .ltk = {
+ 0x95, 0x46, 0xe6, 0x8e, 0x52, 0xcc, 0x05, 0xca,
+ 0xf4, 0x59, 0x57, 0x54, 0x8c, 0x0d, 0x51, 0xfc,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_NUMCMP,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_NUMCMP,
+ .numcmp_accept = 1,
+ },
+ .exp_numcmp = 70210,
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
+/**
+ * Secure connections pairing
+ * Master: us
+ * Pair algorithm: passkey entry
+ * Initiator IO capabilities: 2
+ * Responder IO capabilities: 0
+ * Bonding: true
+ * Initiator address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Responder address type: BLE_ADDR_TYPE_RPA_PUB_DEFAULT
+ * Initiator key distribution: 7
+ * Responder key distribution: 3
+ */
+TEST_CASE(ble_sm_sc_us_pk_iio2_rio0_b1_iat2_rat2_ik7_rk3)
+{
+ struct ble_sm_test_sc_params params;
+
+ params = (struct ble_sm_test_sc_params) {
+ .init_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .init_id_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ .init_rpa = {
+ 0x6e, 0x56, 0x09, 0xef, 0x1e, 0x76,
+ },
+ .resp_addr_type = BLE_ADDR_TYPE_RPA_PUB_DEFAULT,
+ .resp_id_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ .resp_rpa = {
+ 0xb5, 0x29, 0xdf, 0xb4, 0x9b, 0x62,
+ },
+ .pair_req = {
+ .io_cap = 0x02,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x03,
+ },
+ .pair_rsp = {
+ .io_cap = 0x00,
+ .oob_data_flag = 0x00,
+ .authreq = 0x0d,
+ .max_enc_key_size = 0x10,
+ .init_key_dist = 0x07,
+ .resp_key_dist = 0x03,
+ },
+ .our_priv_key = {
+ 0xdb, 0x24, 0x2e, 0x91, 0xda, 0xaa, 0x33, 0x33,
+ 0x23, 0xa2, 0x1e, 0xbe, 0x06, 0x69, 0xdb, 0xad,
+ 0xa9, 0x2a, 0x91, 0xb1, 0x24, 0x0a, 0xc7, 0xaf,
+ 0x50, 0x0c, 0x65, 0x5b, 0x97, 0x1e, 0x12, 0x10,
+ },
+ .public_key_req = {
+ .x = {
+ 0x54, 0xd9, 0x8f, 0xeb, 0xc1, 0xbb, 0xe6, 0x74,
+ 0x8a, 0x55, 0x3a, 0x80, 0x0e, 0xef, 0x90, 0xc9,
+ 0xab, 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62,
+ 0x0d, 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7,
+ },
+ .y = {
+ 0x07, 0x33, 0x91, 0x40, 0xde, 0x25, 0xb4, 0x3d,
+ 0x81, 0x2f, 0xd2, 0x41, 0x98, 0xe7, 0xaf, 0x0f,
+ 0x5f, 0x17, 0x85, 0x1f, 0x75, 0x6e, 0xf4, 0x0e,
+ 0x05, 0x19, 0x7f, 0x03, 0x9b, 0xf4, 0x41, 0x23,
+ },
+ },
+ .public_key_rsp = {
+ .x = {
+ 0x1d, 0x44, 0x66, 0x0d, 0x3a, 0x03, 0x71, 0x17,
+ 0xb3, 0x10, 0x2e, 0xf0, 0xd3, 0xf8, 0xa2, 0x6c,
+ 0x1f, 0xfc, 0xbf, 0x02, 0x62, 0x6b, 0x11, 0x5a,
+ 0x76, 0x5b, 0x30, 0x20, 0xb1, 0xef, 0xb3, 0x76,
+ },
+ .y = {
+ 0xf1, 0x23, 0x63, 0x75, 0xfc, 0xb6, 0xc9, 0x32,
+ 0xa4, 0x36, 0xbe, 0x18, 0xa0, 0x7d, 0x0b, 0x16,
+ 0x65, 0x24, 0xd0, 0xe3, 0x74, 0x1b, 0x34, 0x1a,
+ 0xf9, 0xe2, 0xcb, 0x30, 0x93, 0x88, 0xd7, 0xfa,
+ },
+ },
+ .confirm_req[0] = {
+ .value = {
+ 0x12, 0xe3, 0x01, 0xd0, 0x30, 0x59, 0xca, 0xd9,
+ 0x78, 0x0b, 0x45, 0x73, 0xb1, 0x7a, 0x4d, 0xca,
+ },
+ },
+ .confirm_rsp[0] = {
+ .value = {
+ 0x47, 0x68, 0x16, 0x24, 0xd4, 0x07, 0x60, 0x6c,
+ 0xa5, 0x47, 0x6f, 0x05, 0x78, 0x71, 0x3e, 0xa8,
+ },
+ },
+ .random_req[0] = {
+ .value = {
+ 0x2a, 0x29, 0xa8, 0xef, 0x0b, 0x70, 0x5f, 0x1b,
+ 0x81, 0x4d, 0x97, 0xff, 0xfb, 0x7f, 0x30, 0x90,
+ },
+ },
+ .random_rsp[0] = {
+ .value = {
+ 0x12, 0x9e, 0x1d, 0x12, 0x11, 0x44, 0x36, 0x74,
+ 0xa3, 0x0c, 0xea, 0x36, 0x4d, 0xdf, 0x2d, 0x5d,
+ },
+ },
+ .confirm_req[1] = {
+ .value = {
+ 0x4d, 0x6a, 0x32, 0xfe, 0xe2, 0xa0, 0xdd, 0x92,
+ 0x60, 0x5c, 0x82, 0x7f, 0xa6, 0xa6, 0x24, 0xd6,
+ },
+ },
+ .confirm_rsp[1] = {
+ .value = {
+ 0xd5, 0x3e, 0xa7, 0xa0, 0xbf, 0x39, 0x8e, 0xfe,
+ 0xfd, 0x73, 0x47, 0x4c, 0x92, 0x8b, 0x74, 0x06,
+ },
+ },
+ .random_req[1] = {
+ .value = {
+ 0xc1, 0x88, 0xdf, 0xb0, 0x99, 0xbb, 0xbf, 0xed,
+ 0xdc, 0x40, 0x66, 0x55, 0xbe, 0x91, 0x56, 0x9a,
+ },
+ },
+ .random_rsp[1] = {
+ .value = {
+ 0xed, 0xed, 0x9a, 0x61, 0xb8, 0x21, 0x03, 0x77,
+ 0xa6, 0xcf, 0x34, 0x65, 0x8c, 0x18, 0x82, 0x9f,
+ },
+ },
+ .confirm_req[2] = {
+ .value = {
+ 0xdb, 0xea, 0x94, 0x29, 0xe4, 0x44, 0x7d, 0x7b,
+ 0xd3, 0x16, 0x81, 0x8e, 0xaf, 0xe6, 0x9c, 0x85,
+ },
+ },
+ .confirm_rsp[2] = {
+ .value = {
+ 0x3f, 0xdd, 0x54, 0x76, 0xab, 0x45, 0x7f, 0x53,
+ 0x64, 0x6b, 0x37, 0xa6, 0xc7, 0xc6, 0x4a, 0x73,
+ },
+ },
+ .random_req[2] = {
+ .value = {
+ 0x5a, 0xf1, 0xfb, 0xde, 0xb3, 0xbe, 0x6e, 0xac,
+ 0x68, 0x51, 0x47, 0x8e, 0x0b, 0xcd, 0xc1, 0xa0,
+ },
+ },
+ .random_rsp[2] = {
+ .value = {
+ 0x29, 0x0f, 0x5e, 0x83, 0x87, 0xca, 0xd3, 0x21,
+ 0xa7, 0x7e, 0x3d, 0x78, 0x47, 0x54, 0xf8, 0xe4,
+ },
+ },
+ .confirm_req[3] = {
+ .value = {
+ 0xca, 0x3e, 0xd5, 0xe3, 0x59, 0xb0, 0x5d, 0x1e,
+ 0x0f, 0x4c, 0x95, 0x0f, 0x6a, 0x72, 0xcf, 0x25,
+ },
+ },
+ .confirm_rsp[3] = {
+ .value = {
+ 0x2f, 0x4d, 0x06, 0x40, 0x09, 0x68, 0x68, 0x45,
+ 0x87, 0x79, 0x78, 0x48, 0xda, 0xe4, 0xf5, 0xae,
+ },
+ },
+ .random_req[3] = {
+ .value = {
+ 0x63, 0x5a, 0xee, 0x91, 0xe4, 0xf8, 0xe8, 0x69,
+ 0xd1, 0x46, 0x18, 0x0d, 0xd2, 0x94, 0xd8, 0x20,
+ },
+ },
+ .random_rsp[3] = {
+ .value = {
+ 0x76, 0x36, 0xf5, 0xc2, 0x41, 0xb6, 0x3c, 0x1f,
+ 0x36, 0x19, 0x58, 0xce, 0x8f, 0x41, 0xeb, 0x8c,
+ },
+ },
+ .confirm_req[4] = {
+ .value = {
+ 0x76, 0xfd, 0x84, 0x0f, 0x0f, 0x58, 0x70, 0x45,
+ 0x41, 0x33, 0x5d, 0xce, 0xe5, 0xe2, 0x2f, 0x83,
+ },
+ },
+ .confirm_rsp[4] = {
+ .value = {
+ 0x87, 0xcf, 0xdf, 0xa5, 0x60, 0x82, 0x4f, 0x09,
+ 0x4c, 0x50, 0x24, 0xba, 0x91, 0x96, 0x0d, 0x65,
+ },
+ },
+ .random_req[4] = {
+ .value = {
+ 0x67, 0xdb, 0x73, 0x1e, 0x57, 0x5c, 0xb7, 0x86,
+ 0xf8, 0xaf, 0x58, 0xd8, 0x0f, 0x97, 0x47, 0xce,
+ },
+ },
+ .random_rsp[4] = {
+ .value = {
+ 0xaa, 0x99, 0x90, 0x05, 0x11, 0xfc, 0xc2, 0xd9,
+ 0xb8, 0xd6, 0x9d, 0xef, 0x86, 0x10, 0xcf, 0x26,
+ },
+ },
+ .confirm_req[5] = {
+ .value = {
+ 0xfc, 0x22, 0xd9, 0x1f, 0x5f, 0x86, 0x25, 0xe7,
+ 0x5e, 0x55, 0x48, 0x35, 0xec, 0x32, 0x37, 0x6d,
+ },
+ },
+ .confirm_rsp[5] = {
+ .value = {
+ 0x98, 0xbc, 0x07, 0x72, 0xa2, 0xe7, 0xa7, 0x66,
+ 0x64, 0xf7, 0x29, 0x3a, 0xaf, 0x52, 0x18, 0x04,
+ },
+ },
+ .random_req[5] = {
+ .value = {
+ 0xd3, 0x36, 0xb9, 0x69, 0x6a, 0x6d, 0x55, 0xbc,
+ 0x82, 0xdf, 0x1c, 0x04, 0xa7, 0xd5, 0x00, 0x68,
+ },
+ },
+ .random_rsp[5] = {
+ .value = {
+ 0xb9, 0x03, 0xbf, 0xd9, 0x86, 0x5a, 0x1a, 0xb4,
+ 0xdc, 0xe6, 0x8f, 0x9b, 0xa4, 0xa8, 0x2a, 0x12,
+ },
+ },
+ .confirm_req[6] = {
+ .value = {
+ 0xfe, 0x14, 0xab, 0x1c, 0xfd, 0x36, 0x64, 0x38,
+ 0xc1, 0xf8, 0xdd, 0xcd, 0xf4, 0x77, 0xa1, 0xb8,
+ },
+ },
+ .confirm_rsp[6] = {
+ .value = {
+ 0x2e, 0x70, 0x54, 0xdc, 0xa6, 0xae, 0xb2, 0xcd,
+ 0x4a, 0x26, 0x97, 0xf8, 0xbf, 0xb4, 0xb4, 0x52,
+ },
+ },
+ .random_req[6] = {
+ .value = {
+ 0x1e, 0x27, 0x73, 0x94, 0x44, 0xfc, 0xd4, 0x44,
+ 0xbf, 0x5b, 0x7d, 0x5d, 0x6d, 0x13, 0x68, 0xb1,
+ },
+ },
+ .random_rsp[6] = {
+ .value = {
+ 0xeb, 0xfd, 0x0b, 0xa1, 0x7b, 0xda, 0x61, 0xdc,
+ 0x6d, 0xe4, 0x3b, 0x51, 0xa7, 0x09, 0x29, 0x6d,
+ },
+ },
+ .confirm_req[7] = {
+ .value = {
+ 0x38, 0x2b, 0x23, 0xb9, 0x18, 0x2d, 0xb9, 0x0b,
+ 0xe7, 0x4d, 0x20, 0x83, 0xab, 0x17, 0xfd, 0x88,
+ },
+ },
+ .confirm_rsp[7] = {
+ .value = {
+ 0x65, 0x60, 0x85, 0xef, 0x0e, 0x9a, 0x23, 0x96,
+ 0xe7, 0xa9, 0xee, 0xba, 0x9e, 0x48, 0xb9, 0x1c,
+ },
+ },
+ .random_req[7] = {
+ .value = {
+ 0x8b, 0xa8, 0x7a, 0x33, 0x15, 0x1e, 0xa7, 0x78,
+ 0x27, 0x01, 0x3e, 0x90, 0x43, 0x47, 0x5a, 0x9d,
+ },
+ },
+ .random_rsp[7] = {
+ .value = {
+ 0x76, 0xf1, 0x21, 0x67, 0x94, 0x20, 0x6f, 0xc7,
+ 0x84, 0xc8, 0xdb, 0x07, 0xdb, 0x77, 0xdd, 0x50,
+ },
+ },
+ .confirm_req[8] = {
+ .value = {
+ 0x4e, 0x7f, 0x83, 0x8e, 0xa6, 0x28, 0xaa, 0x46,
+ 0xa2, 0x69, 0x95, 0x3b, 0xf0, 0x71, 0x14, 0x24,
+ },
+ },
+ .confirm_rsp[8] = {
+ .value = {
+ 0x93, 0x0b, 0x4d, 0xbe, 0x49, 0x36, 0xa0, 0x26,
+ 0xe9, 0x18, 0x4e, 0xc8, 0x19, 0x59, 0xc1, 0x7d,
+ },
+ },
+ .random_req[8] = {
+ .value = {
+ 0x11, 0xa9, 0xce, 0x26, 0x0e, 0x2f, 0x11, 0x0e,
+ 0xc1, 0xbd, 0x68, 0x80, 0xc8, 0xf8, 0x41, 0x65,
+ },
+ },
+ .random_rsp[8] = {
+ .value = {
+ 0xb6, 0x3d, 0x6b, 0x62, 0xb5, 0x37, 0x31, 0x28,
+ 0x79, 0xc4, 0xe2, 0x62, 0xbb, 0x63, 0xf9, 0x91,
+ },
+ },
+ .confirm_req[9] = {
+ .value = {
+ 0x5f, 0x55, 0xb5, 0xa4, 0x80, 0xa8, 0x54, 0x47,
+ 0xa7, 0x79, 0x87, 0x12, 0x2e, 0x44, 0x92, 0x42,
+ },
+ },
+ .confirm_rsp[9] = {
+ .value = {
+ 0x01, 0x69, 0xa2, 0xac, 0xd6, 0x62, 0x8a, 0x64,
+ 0xa2, 0x0b, 0xd0, 0xb4, 0x0e, 0x68, 0xe0, 0x88,
+ },
+ },
+ .random_req[9] = {
+ .value = {
+ 0x75, 0x1e, 0x56, 0xd0, 0xcb, 0x06, 0xfd, 0x51,
+ 0x55, 0xae, 0x77, 0xa4, 0xf2, 0xe7, 0x86, 0x3c,
+ },
+ },
+ .random_rsp[9] = {
+ .value = {
+ 0xff, 0xab, 0x8a, 0x7d, 0xb7, 0x40, 0xe5, 0x07,
+ 0xfe, 0x8f, 0x74, 0xdb, 0x2c, 0x35, 0x35, 0x12,
+ },
+ },
+ .confirm_req[10] = {
+ .value = {
+ 0x1f, 0x2a, 0xed, 0xcd, 0x6b, 0x87, 0xea, 0xa2,
+ 0xf8, 0xd8, 0xad, 0x04, 0x23, 0xc7, 0x5d, 0x47,
+ },
+ },
+ .confirm_rsp[10] = {
+ .value = {
+ 0x5b, 0x18, 0x2d, 0x96, 0x3b, 0xf6, 0xdc, 0x82,
+ 0x3b, 0xfa, 0xc9, 0x81, 0xc7, 0x33, 0xa0, 0x07,
+ },
+ },
+ .random_req[10] = {
+ .value = {
+ 0xd1, 0x3a, 0x82, 0xce, 0x31, 0x75, 0xa2, 0xbf,
+ 0x6f, 0x12, 0xf2, 0xac, 0xf6, 0xcc, 0xea, 0x34,
+ },
+ },
+ .random_rsp[10] = {
+ .value = {
+ 0xcf, 0x11, 0x3d, 0x44, 0x10, 0x0d, 0x26, 0x32,
+ 0xa5, 0x61, 0x13, 0xfd, 0xb8, 0xed, 0x31, 0x53,
+ },
+ },
+ .confirm_req[11] = {
+ .value = {
+ 0x67, 0x14, 0x8a, 0xf6, 0xc8, 0xb8, 0x73, 0x6b,
+ 0xb2, 0xec, 0xa9, 0x61, 0xaa, 0xc0, 0xc9, 0x28,
+ },
+ },
+ .confirm_rsp[11] = {
+ .value = {
+ 0xa5, 0xbf, 0x00, 0x07, 0x48, 0xff, 0x30, 0x36,
+ 0x20, 0x83, 0xd7, 0xd6, 0xd0, 0x90, 0x46, 0x03,
+ },
+ },
+ .random_req[11] = {
+ .value = {
+ 0x75, 0x99, 0x9a, 0xa3, 0xad, 0x9a, 0xe5, 0x9d,
+ 0x2f, 0x21, 0xdb, 0x72, 0x2f, 0xaf, 0xb8, 0x79,
+ },
+ },
+ .random_rsp[11] = {
+ .value = {
+ 0xa3, 0xb7, 0xb7, 0x46, 0x39, 0x99, 0xc2, 0x82,
+ 0xe9, 0x31, 0x8d, 0xc2, 0x28, 0x1b, 0x86, 0x91,
+ },
+ },
+ .confirm_req[12] = {
+ .value = {
+ 0x46, 0x2f, 0xc8, 0x0e, 0x2c, 0x70, 0x3a, 0xdb,
+ 0x25, 0x2f, 0xce, 0xe6, 0x15, 0x1f, 0x9a, 0x06,
+ },
+ },
+ .confirm_rsp[12] = {
+ .value = {
+ 0x9a, 0xa4, 0xe0, 0x03, 0x3a, 0xb5, 0x43, 0x75,
+ 0x8e, 0x93, 0x35, 0x25, 0xe6, 0x5e, 0x9d, 0x7f,
+ },
+ },
+ .random_req[12] = {
+ .value = {
+ 0x1f, 0x01, 0x32, 0x56, 0x64, 0x45, 0xc5, 0x20,
+ 0xd4, 0xad, 0x13, 0x8f, 0xbe, 0x82, 0xc8, 0x01,
+ },
+ },
+ .random_rsp[12] = {
+ .value = {
+ 0xd4, 0x3f, 0xa4, 0xc9, 0xe9, 0x2e, 0x62, 0x77,
+ 0x4e, 0x21, 0x55, 0xd8, 0xde, 0x31, 0xf5, 0xea,
+ },
+ },
+ .confirm_req[13] = {
+ .value = {
+ 0x4e, 0x48, 0x88, 0x4e, 0x4f, 0x74, 0x7e, 0xec,
+ 0x99, 0x5d, 0xb1, 0xcb, 0x84, 0x88, 0x80, 0xe9,
+ },
+ },
+ .confirm_rsp[13] = {
+ .value = {
+ 0x1a, 0x84, 0xfa, 0x2f, 0xd7, 0x3c, 0x5f, 0xee,
+ 0x3e, 0x81, 0xc0, 0x4b, 0x35, 0x4b, 0x7e, 0x98,
+ },
+ },
+ .random_req[13] = {
+ .value = {
+ 0xe3, 0x3a, 0xc5, 0x2f, 0x9f, 0x91, 0x93, 0xfb,
+ 0xcb, 0xd8, 0x53, 0x63, 0xab, 0xc4, 0xa5, 0x85,
+ },
+ },
+ .random_rsp[13] = {
+ .value = {
+ 0xa0, 0xcf, 0xad, 0x30, 0x2d, 0xec, 0xea, 0x81,
+ 0xfd, 0x7f, 0xcf, 0x7c, 0x70, 0xc9, 0x89, 0x7b,
+ },
+ },
+ .confirm_req[14] = {
+ .value = {
+ 0xe1, 0x64, 0x22, 0x19, 0x41, 0x44, 0x37, 0x2b,
+ 0x92, 0x60, 0xa4, 0x1f, 0xd6, 0x53, 0xe0, 0xa0,
+ },
+ },
+ .confirm_rsp[14] = {
+ .value = {
+ 0x08, 0xfa, 0xa4, 0xf8, 0x04, 0x08, 0xb8, 0x9f,
+ 0x61, 0xb5, 0x68, 0xaf, 0x31, 0x12, 0x8d, 0x3f,
+ },
+ },
+ .random_req[14] = {
+ .value = {
+ 0xad, 0x76, 0xc3, 0x1a, 0x4c, 0x64, 0x2c, 0x11,
+ 0x5e, 0x48, 0x6d, 0x41, 0xf5, 0x77, 0xc2, 0x40,
+ },
+ },
+ .random_rsp[14] = {
+ .value = {
+ 0x1b, 0xec, 0x78, 0x2b, 0xd9, 0xbe, 0x93, 0xbd,
+ 0x0b, 0x03, 0xf1, 0xd8, 0x31, 0xe8, 0x60, 0x67,
+ },
+ },
+ .confirm_req[15] = {
+ .value = {
+ 0x5e, 0x22, 0x44, 0x09, 0x97, 0xf9, 0xc5, 0xc7,
+ 0x23, 0xc7, 0x74, 0x51, 0xe5, 0x9d, 0x5c, 0xed,
+ },
+ },
+ .confirm_rsp[15] = {
+ .value = {
+ 0xfe, 0xb2, 0x90, 0xa7, 0x06, 0xaf, 0xdd, 0x6a,
+ 0x83, 0x26, 0x3c, 0x78, 0x66, 0xe0, 0x9d, 0xd9,
+ },
+ },
+ .random_req[15] = {
+ .value = {
+ 0xb2, 0xa0, 0x75, 0x6f, 0x77, 0xc1, 0x0b, 0x4e,
+ 0x99, 0xfa, 0x9a, 0x02, 0xf6, 0xe4, 0x66, 0x27,
+ },
+ },
+ .random_rsp[15] = {
+ .value = {
+ 0xf9, 0xdd, 0x69, 0xae, 0xc8, 0x66, 0xa9, 0xab,
+ 0xb8, 0x01, 0x38, 0xc3, 0x2a, 0x6b, 0x94, 0x66,
+ },
+ },
+ .confirm_req[16] = {
+ .value = {
+ 0x17, 0xc9, 0xf7, 0x2d, 0xe6, 0xb7, 0x99, 0x77,
+ 0x65, 0xf7, 0x62, 0xc8, 0x0d, 0x7d, 0xbd, 0x81,
+ },
+ },
+ .confirm_rsp[16] = {
+ .value = {
+ 0x39, 0xef, 0xbf, 0x39, 0xfa, 0x79, 0xc3, 0x7b,
+ 0x71, 0x40, 0x3c, 0x1f, 0x67, 0xe5, 0x60, 0xe5,
+ },
+ },
+ .random_req[16] = {
+ .value = {
+ 0x32, 0xab, 0x8b, 0xed, 0x90, 0x04, 0x5e, 0x17,
+ 0xd2, 0x5e, 0xa8, 0x91, 0xf7, 0x77, 0xe3, 0xd7,
+ },
+ },
+ .random_rsp[16] = {
+ .value = {
+ 0x6c, 0xc7, 0x14, 0x13, 0xdf, 0xfb, 0xc6, 0xed,
+ 0xa3, 0x9c, 0xa7, 0x90, 0xae, 0x4c, 0x61, 0x47,
+ },
+ },
+ .confirm_req[17] = {
+ .value = {
+ 0xc5, 0x17, 0x07, 0x35, 0x34, 0xbf, 0xc1, 0x4d,
+ 0xc4, 0x57, 0xc0, 0xd9, 0xfd, 0xe9, 0x10, 0x08,
+ },
+ },
+ .confirm_rsp[17] = {
+ .value = {
+ 0xbb, 0xcf, 0x41, 0xd2, 0x94, 0xea, 0xbe, 0x2f,
+ 0xde, 0xb2, 0xb4, 0x20, 0x72, 0x1c, 0xf8, 0x35,
+ },
+ },
+ .random_req[17] = {
+ .value = {
+ 0x59, 0x20, 0xb5, 0xdc, 0xaf, 0xc3, 0x8b, 0x32,
+ 0xe6, 0x40, 0x0f, 0x02, 0x67, 0x45, 0x49, 0x1f,
+ },
+ },
+ .random_rsp[17] = {
+ .value = {
+ 0xf5, 0x95, 0x60, 0x4c, 0x5f, 0x39, 0x54, 0xbf,
+ 0x62, 0x9e, 0x85, 0xca, 0x31, 0x9a, 0x95, 0xee,
+ },
+ },
+ .confirm_req[18] = {
+ .value = {
+ 0x36, 0x50, 0x78, 0x6b, 0x0f, 0x11, 0xe3, 0xa9,
+ 0x79, 0x3a, 0xa6, 0x9d, 0xd4, 0x8b, 0x13, 0x3f,
+ },
+ },
+ .confirm_rsp[18] = {
+ .value = {
+ 0xa5, 0x34, 0x5d, 0x5e, 0x43, 0x01, 0xf2, 0xe1,
+ 0x3f, 0xf2, 0x1c, 0x8b, 0x13, 0xf7, 0x17, 0x3e,
+ },
+ },
+ .random_req[18] = {
+ .value = {
+ 0x77, 0xa1, 0xbe, 0xbf, 0x49, 0xb8, 0x74, 0x73,
+ 0x47, 0x78, 0x2a, 0xf8, 0x66, 0x6b, 0xff, 0xd2,
+ },
+ },
+ .random_rsp[18] = {
+ .value = {
+ 0xa2, 0x05, 0x69, 0x65, 0x3f, 0xd4, 0xb4, 0xcd,
+ 0xed, 0x8c, 0x36, 0x6d, 0x51, 0x6a, 0xbb, 0xef,
+ },
+ },
+ .confirm_req[19] = {
+ .value = {
+ 0xda, 0xd8, 0x96, 0xfd, 0x1c, 0x0d, 0x1e, 0x56,
+ 0xe2, 0x62, 0xed, 0x18, 0x4b, 0xd3, 0x46, 0x48,
+ },
+ },
+ .confirm_rsp[19] = {
+ .value = {
+ 0xeb, 0x79, 0x5e, 0x52, 0x70, 0x25, 0xa7, 0x41,
+ 0x33, 0xfa, 0xac, 0xd3, 0x27, 0x35, 0xfc, 0x5f,
+ },
+ },
+ .random_req[19] = {
+ .value = {
+ 0xa8, 0x9c, 0xb9, 0xcd, 0x13, 0xb8, 0xdd, 0xd2,
+ 0x09, 0xd6, 0xc8, 0x12, 0xc3, 0x69, 0x9a, 0x64,
+ },
+ },
+ .random_rsp[19] = {
+ .value = {
+ 0x06, 0xe3, 0x8a, 0xef, 0xe4, 0x42, 0xae, 0x86,
+ 0xef, 0x58, 0x80, 0xe8, 0xe3, 0xa2, 0x09, 0x44,
+ },
+ },
+ .dhkey_check_req = {
+ .value = {
+ 0x6f, 0xa5, 0x37, 0x06, 0x4a, 0x89, 0x98, 0x39,
+ 0xf6, 0x69, 0x48, 0x56, 0x17, 0x6d, 0x44, 0x7c,
+ },
+ },
+ .dhkey_check_rsp = {
+ .value = {
+ 0x82, 0x48, 0xd4, 0x9e, 0xb8, 0x3c, 0xb4, 0xdc,
+ 0x44, 0xcb, 0x19, 0xdb, 0xcb, 0xa2, 0x00, 0x5d,
+ },
+ },
+ .id_info_req = {
+ .irk = {
+ 0x79, 0x12, 0x88, 0x97, 0xd9, 0x1c, 0x62, 0x0d,
+ 0x26, 0x43, 0x7d, 0x25, 0x86, 0x79, 0xc7, 0x07,
+ },
+ },
+ .id_addr_info_req = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
+ },
+ },
+ .id_info_rsp = {
+ .irk = {
+ 0xda, 0x6b, 0x27, 0xa0, 0xac, 0x71, 0xf0, 0xc3,
+ 0x75, 0x51, 0xf6, 0x21, 0x94, 0xec, 0x81, 0x92,
+ },
+ },
+ .id_addr_info_rsp = {
+ .addr_type = 0,
+ .bd_addr = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
+ },
+ },
+ .sign_info_rsp = {
+ .sig_key = {
+ 0x49, 0x5b, 0x11, 0xb3, 0x4c, 0x1a, 0x23, 0x5c,
+ 0x61, 0x4f, 0xe3, 0x08, 0xf9, 0x47, 0x8b, 0xdc,
+ },
+ },
+ .ltk = {
+ 0x5a, 0x49, 0x28, 0xf0, 0x11, 0x3b, 0x6f, 0x6b,
+ 0x3a, 0x69, 0x6d, 0xdd, 0xb2, 0xe5, 0xa8, 0x97,
+ },
+ .pair_alg = BLE_SM_PAIR_ALG_PASSKEY,
+ .authenticated = 1,
+ .passkey_info = {
+ .passkey = {
+ .action = BLE_SM_IOACT_INPUT,
+ .passkey = 4915,
+ },
+ },
+ };
+ ble_sm_test_util_us_sc_good(¶ms);
+}
+
TEST_SUITE(ble_sm_sc_test_suite)
{
+ /*** No privacy. */
+
/* Peer as initiator. */
ble_sm_sc_peer_jw_iio3_rio3_b1_iat0_rat0_ik5_rk7();
ble_sm_sc_peer_pk_iio0_rio2_b1_iat0_rat0_ik5_rk7();
@@ -3036,6 +4892,18 @@ TEST_SUITE(ble_sm_sc_test_suite)
ble_sm_sc_us_pk_iio2_rio4_b1_iat0_rat0_ik7_rk5();
ble_sm_sc_us_pk_iio0_rio4_b1_iat0_rat0_ik7_rk5();
ble_sm_sc_us_nc_iio1_rio4_b1_iat0_rat0_ik7_rk5();
+
+ /*** Privacy (id = public). */
+
+ /* Peer as initiator. */
+ ble_sm_sc_peer_jw_iio3_rio3_b1_iat2_rat2_ik7_rk7();
+ ble_sm_sc_peer_nc_iio1_rio1_b1_iat2_rat2_ik3_rk3();
+ ble_sm_sc_peer_pk_iio2_rio0_b1_iat2_rat2_ik7_rk3();
+
+ /* Us as initiator. */
+ ble_sm_sc_us_jw_iio3_rio3_b1_iat2_rat2_ik3_rk3();
+ ble_sm_sc_us_nc_iio1_rio1_b1_iat2_rat2_ik3_rk3();
+ ble_sm_sc_us_pk_iio2_rio0_b1_iat2_rat2_ik7_rk3();
}
#endif /* NIMBLE_OPT_SM */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ec61a048/net/nimble/host/src/test/ble_sm_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test.c b/net/nimble/host/src/test/ble_sm_test.c
index 12327db..4f732bd 100644
--- a/net/nimble/host/src/test/ble_sm_test.c
+++ b/net/nimble/host/src/test/ble_sm_test.c
@@ -390,8 +390,8 @@ TEST_CASE(ble_sm_test_case_peer_lgcy_jw_good)
struct ble_sm_test_lgcy_params params;
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 0x04,
.oob_data_flag = 0,
@@ -450,8 +450,8 @@ TEST_CASE(ble_sm_test_case_peer_lgcy_passkey_good)
struct ble_sm_test_lgcy_params params;
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 0x04,
.oob_data_flag = 0, .authreq = 0x05,
@@ -593,8 +593,8 @@ TEST_CASE(ble_sm_test_case_peer_sec_req_pair)
struct ble_sm_test_lgcy_params params;
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01},
- .resp_addr = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a},
+ .init_id_addr = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01},
+ .resp_id_addr = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a},
.sec_req = (struct ble_sm_sec_req) {
.authreq = 0,
},
@@ -657,8 +657,8 @@ TEST_CASE(ble_sm_test_case_peer_sc_numcmp_good)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = { 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0 },
- .resp_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
+ .init_id_addr = { 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0 },
+ .resp_id_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 0x01,
.oob_data_flag = 0x00,
@@ -766,8 +766,8 @@ TEST_CASE(ble_sm_test_case_peer_sc_passkey_good)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = { 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0 },
- .resp_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
+ .init_id_addr = { 0xca, 0x61, 0xa0, 0x67, 0x94, 0xe0 },
+ .resp_id_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 0x04,
.oob_data_flag = 0x00,
@@ -1339,8 +1339,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid IO capabiltiies. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1365,8 +1365,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid OOB flag. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1391,8 +1391,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid authreq - reserved bonding flag. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1417,8 +1417,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid authreq - reserved other flag. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1443,8 +1443,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid key size - too small. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1469,8 +1469,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid key size - too large. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1495,8 +1495,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid init key dist. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1521,8 +1521,8 @@ TEST_CASE(ble_sm_test_case_us_fail_inval)
/* Invalid resp key dist. */
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x03, 0x02, 0x01, 0x50, 0x13, 0x00},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1551,8 +1551,8 @@ TEST_CASE(ble_sm_test_case_us_lgcy_jw_good)
struct ble_sm_test_lgcy_params params;
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01},
- .resp_addr = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a},
+ .init_id_addr = {0x06, 0x05, 0x04, 0x03, 0x02, 0x01},
+ .resp_id_addr = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a},
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 3,
.oob_data_flag = 0,
@@ -1616,8 +1616,8 @@ TEST_CASE(ble_sm_test_case_us_sec_req_pair)
struct ble_sm_test_lgcy_params params;
params = (struct ble_sm_test_lgcy_params) {
- .init_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
- .resp_addr = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07},
+ .init_id_addr = {0xe1, 0xfc, 0xda, 0xf4, 0xb7, 0x6c},
+ .resp_id_addr = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07},
.sec_req = (struct ble_sm_sec_req) {
.authreq = 0x05,
},
@@ -1722,10 +1722,10 @@ TEST_CASE(ble_sm_test_case_us_sc_jw_good)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0xd9, 0x38, 0x0c, 0x57, 0x0b, 0x00,
},
- .resp_addr = {
+ .resp_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
.pair_req = {
@@ -1833,8 +1833,8 @@ TEST_CASE(ble_sm_test_case_us_sc_numcmp_good)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = { 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 },
- .resp_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
+ .init_id_addr = { 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 },
+ .resp_id_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
.pair_req = (struct ble_sm_pair_cmd) {
.io_cap = 0x01,
.oob_data_flag = 0x00,
@@ -1946,10 +1946,10 @@ TEST_CASE(ble_sm_test_case_us_sc_passkey_good)
struct ble_sm_test_sc_params params;
params = (struct ble_sm_test_sc_params) {
- .init_addr = {
+ .init_id_addr = {
0x01, 0x01, 0x01, 0x07, 0x08, 0x01,
},
- .resp_addr = {
+ .resp_id_addr = {
0x5d, 0xab, 0xaa, 0x67, 0x11, 0x00,
},
.pair_req = {
[3/8] incubator-mynewt-core git commit: BLE Host - unit tests:
restore via enc in sc tests
Posted by cc...@apache.org.
BLE Host - unit tests: restore via enc in sc tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/5a2c4453
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5a2c4453
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5a2c4453
Branch: refs/heads/upf54
Commit: 5a2c4453a46616ab980bee53366787097a8ca3af
Parents: fc6c9cf
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jun 14 12:37:24 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jun 14 12:37:24 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/test/ble_sm_test.c | 58 ------
net/nimble/host/src/test/ble_sm_test_util.c | 222 +++++++++++------------
net/nimble/host/src/test/ble_sm_test_util.h | 6 -
3 files changed, 110 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5a2c4453/net/nimble/host/src/test/ble_sm_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test.c b/net/nimble/host/src/test/ble_sm_test.c
index 1252990..12327db 100644
--- a/net/nimble/host/src/test/ble_sm_test.c
+++ b/net/nimble/host/src/test/ble_sm_test.c
@@ -539,25 +539,6 @@ TEST_CASE(ble_sm_test_case_peer_lgcy_passkey_good)
ble_sm_test_util_peer_lgcy_good(¶ms);
}
-TEST_CASE(ble_sm_test_case_peer_bonding_good)
-{
- /* Unauthenticated. */
- ble_sm_test_util_peer_bonding_good(
- 0,
- ((uint8_t[16]){ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 }),
- 0,
- 0x1234,
- 0x5678);
-
- /* Authenticated. */
- ble_sm_test_util_peer_bonding_good(
- 0,
- ((uint8_t[16]){ 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 }),
- 1,
- 0x4325,
- 0x543892375);
-}
-
TEST_CASE(ble_sm_test_case_peer_bonding_bad)
{
ble_sm_test_util_peer_bonding_bad(0x5684, 32);
@@ -671,22 +652,6 @@ TEST_CASE(ble_sm_test_case_peer_sec_req_pair)
ble_sm_test_util_us_lgcy_good(¶ms);
}
-/**
- * Master: us.
- * Peer sends a security request.
- * We respond by initiating the encryption procedure.
- */
-TEST_CASE(ble_sm_test_case_peer_sec_req_enc)
-{
- /* Unauthenticated. */
- ble_sm_test_util_us_bonding_good(
- 1,
- ((uint8_t[16]){ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 }),
- 0,
- 0x1234,
- 0x5678);
-}
-
TEST_CASE(ble_sm_test_case_peer_sc_numcmp_good)
{
struct ble_sm_test_sc_params params;
@@ -2581,21 +2546,6 @@ TEST_CASE(ble_sm_test_case_us_sc_passkey_good)
ble_sm_test_util_us_sc_good(¶ms);
}
-/**
- * Master: peer.
- * We send a security request.
- * We accept an encryption-changed event in response.
- */
-TEST_CASE(ble_sm_test_case_us_sec_req_enc)
-{
- ble_sm_test_util_peer_bonding_good(
- 1,
- ((uint8_t[16]){ 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 }),
- 1,
- 0x4325,
- 0x543892375);
-}
-
TEST_SUITE(ble_sm_test_suite)
{
ble_sm_test_case_f4();
@@ -2609,19 +2559,11 @@ TEST_SUITE(ble_sm_test_suite)
ble_sm_test_case_peer_lgcy_passkey_good();
ble_sm_test_case_us_fail_inval();
ble_sm_test_case_us_lgcy_jw_good();
- ble_sm_test_case_peer_bonding_good();
ble_sm_test_case_peer_bonding_bad();
ble_sm_test_case_conn_broken();
ble_sm_test_case_peer_sec_req_inval();
ble_sm_test_case_peer_sec_req_pair();
- ble_sm_test_case_peer_sec_req_enc();
ble_sm_test_case_us_sec_req_pair();
- ble_sm_test_case_us_sec_req_enc();
- ble_sm_test_case_peer_sc_numcmp_good();
- ble_sm_test_case_peer_sc_passkey_good();
- ble_sm_test_case_us_sc_jw_good();
- ble_sm_test_case_us_sc_numcmp_good();
- ble_sm_test_case_us_sc_passkey_good();
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5a2c4453/net/nimble/host/src/test/ble_sm_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test_util.c b/net/nimble/host/src/test/ble_sm_test_util.c
index 45fd5a0..28c2a2a 100644
--- a/net/nimble/host/src/test/ble_sm_test_util.c
+++ b/net/nimble/host/src/test/ble_sm_test_util.c
@@ -1379,24 +1379,17 @@ ble_sm_test_util_peer_lgcy_good(struct ble_sm_test_lgcy_params *params)
ble_sm_test_util_peer_lgcy_good_once(params);
}
-/**
- * @param send_enc_req Whether this procedure is initiated by a slave
- * security request;
- * 1: We send a security request at start.
- * 0: No security request; peer initiates.
- */
-void
-ble_sm_test_util_peer_bonding_good(int send_enc_req, uint8_t *ltk,
- int authenticated,
+static void
+ble_sm_test_util_peer_bonding_good(int send_enc_req,
+ uint8_t peer_addr_type,
+ uint8_t *peer_addr,
+ uint8_t *ltk, int authenticated,
uint16_t ediv, uint64_t rand_num)
{
- struct ble_store_value_sec value_sec;
struct ble_hs_conn *conn;
int rc;
- ble_sm_test_util_init();
-
- ble_hs_test_util_create_conn(2, ((uint8_t[6]){1,2,3,4,5,6}),
+ ble_hs_test_util_create_conn(2, peer_addr,
ble_sm_test_util_conn_cb,
NULL);
@@ -1413,19 +1406,6 @@ ble_sm_test_util_peer_bonding_good(int send_enc_req, uint8_t *ltk,
TEST_ASSERT(!conn->bhc_sec_state.encrypted);
TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
- /* Populate the SM database with an LTK for this peer. */
- value_sec.peer_addr_type = conn->bhc_addr_type;
- memcpy(value_sec.peer_addr, conn->bhc_addr, sizeof value_sec.peer_addr);
- value_sec.ediv = ediv;
- value_sec.rand_num = rand_num;
- memcpy(value_sec.ltk, ltk, sizeof value_sec.ltk);
- value_sec.ltk_present = 1;
- value_sec.authenticated = authenticated;
- value_sec.sc = 0;
-
- rc = ble_store_write_our_sec(&value_sec);
- TEST_ASSERT_FATAL(rc == 0);
-
if (send_enc_req) {
rc = ble_sm_slave_initiate(2);
TEST_ASSERT(rc == 0);
@@ -1450,7 +1430,7 @@ ble_sm_test_util_peer_bonding_good(int send_enc_req, uint8_t *ltk,
ble_sm_test_util_io_inject_bad(2, BLE_SM_IOACT_NONE);
/* Ensure we sent the expected long term key request reply command. */
- ble_sm_test_util_verify_tx_lt_key_req_reply(2, value_sec.ltk);
+ ble_sm_test_util_verify_tx_lt_key_req_reply(2, ltk);
TEST_ASSERT(!conn->bhc_sec_state.encrypted);
TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
ble_sm_test_util_io_inject_bad(2, BLE_SM_IOACT_NONE);
@@ -1472,6 +1452,8 @@ ble_sm_test_util_peer_bonding_good(int send_enc_req, uint8_t *ltk,
TEST_ASSERT(ble_sm_test_sec_state.encrypted);
TEST_ASSERT(ble_sm_test_sec_state.authenticated ==
authenticated);
+
+ ble_hs_test_util_conn_disconnect(2);
}
void
@@ -1521,6 +1503,80 @@ ble_sm_test_util_peer_bonding_bad(uint16_t ediv, uint64_t rand_num)
TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
}
+/**
+ * @param send_enc_req Whether this procedure is initiated by a slave
+ * security request;
+ * 1: Peer sends a security request at start.
+ * 0: No security request; we initiate.
+ */
+static void
+ble_sm_test_util_us_bonding_good(int send_enc_req,
+ uint8_t peer_addr_type, uint8_t *peer_addr,
+ uint8_t *ltk, int authenticated,
+ uint16_t ediv, uint64_t rand_num)
+{
+ struct ble_sm_sec_req sec_req;
+ struct ble_hs_conn *conn;
+
+ ble_hs_test_util_create_conn(2, peer_addr,
+ ble_sm_test_util_conn_cb,
+ NULL);
+
+ /* This test inspects and modifies the connection object after unlocking
+ * the host mutex. It is not OK for real code to do this, but this test
+ * can assume the connection list is unchanging.
+ */
+ ble_hs_lock();
+ conn = ble_hs_conn_find(2);
+ TEST_ASSERT_FATAL(conn != NULL);
+ ble_hs_unlock();
+
+ TEST_ASSERT(!conn->bhc_sec_state.encrypted);
+ TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
+
+ ble_hs_test_util_set_ack(
+ host_hci_opcode_join(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_START_ENCRYPT),
+ 0);
+
+ if (send_enc_req) {
+ sec_req.authreq = 0;
+ sec_req.authreq |= BLE_SM_PAIR_AUTHREQ_BOND;
+ if (authenticated) {
+ sec_req.authreq |= BLE_SM_PAIR_AUTHREQ_MITM;
+ }
+ ble_sm_test_util_rx_sec_req(2, &sec_req, 0);
+ } else {
+ ble_gap_security_initiate(2);
+ }
+
+ /* Ensure we sent the expected start encryption command. */
+ ble_hs_test_util_tx_all();
+ ble_sm_test_util_verify_tx_start_enc(2, rand_num, ediv, ltk);
+ TEST_ASSERT(!conn->bhc_sec_state.encrypted);
+ TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
+ ble_sm_test_util_io_inject_bad(2, BLE_SM_IOACT_NONE);
+
+ /* Receive an encryption changed event. */
+ ble_sm_test_util_rx_enc_change(2, 0, 1);
+
+ /* Pairing should now be complete. */
+ TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
+
+ /* Verify that security callback was executed. */
+ TEST_ASSERT(ble_sm_test_gap_event == BLE_GAP_EVENT_ENC_CHANGE);
+ TEST_ASSERT(ble_sm_test_gap_status == 0);
+ TEST_ASSERT(ble_sm_test_sec_state.encrypted);
+ TEST_ASSERT(ble_sm_test_sec_state.authenticated ==
+ authenticated);
+
+ /* Verify that connection has correct security state. */
+ TEST_ASSERT(ble_sm_test_sec_state.encrypted);
+ TEST_ASSERT(ble_sm_test_sec_state.authenticated ==
+ authenticated);
+
+ ble_hs_test_util_conn_disconnect(2);
+}
+
static void
ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
{
@@ -1734,17 +1790,44 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
/* Verify the appropriate security material was persisted. */
ble_sm_test_util_verify_sc_persist(params, 0);
+
+ ble_hs_test_util_conn_disconnect(2);
}
void
ble_sm_test_util_peer_sc_good(struct ble_sm_test_sc_params *params)
{
+ /*** Peer is master; peer initiates pairing. */
+
+ /* Peer performs IO first. */
params->passkey_info.io_before_rx = 0;
ble_sm_test_util_peer_sc_good_once(params);
+ /* We perform IO first. */
params->passkey_info.io_before_rx = 1;
ble_sm_test_util_peer_sc_good_once(params);
+ /*** Verify link can be restored via the encryption procedure. */
+
+ /* Peer is master; peer initiates procedure. */
+ ble_sm_test_util_peer_bonding_good(0, 0, params->init_addr,
+ params->ltk, params->authenticated,
+ 0, 0);
+
+ /* Peer is master; we initiate procedure via security request. */
+ ble_sm_test_util_peer_bonding_good(1, 0, params->init_addr,
+ params->ltk, params->authenticated,
+ 0, 0);
+
+ /* We are master; we initiate procedure. */
+ ble_sm_test_util_us_bonding_good(0, 0, params->init_addr,
+ params->ltk, params->authenticated,
+ 0, 0);
+
+ /* We are master; peer initiates procedure via security request. */
+ ble_sm_test_util_us_bonding_good(1, 0, params->init_addr,
+ params->ltk, params->authenticated,
+ 0, 0);
}
void
@@ -2005,88 +2088,3 @@ ble_sm_test_util_us_fail_inval(
TEST_ASSERT(!conn->bhc_sec_state.encrypted);
TEST_ASSERT(!conn->bhc_sec_state.authenticated);
}
-
-/**
- * @param send_enc_req Whether this procedure is initiated by a slave
- * security request;
- * 1: Peer sends a security request at start.
- * 0: No security request; we initiate.
- */
-void
-ble_sm_test_util_us_bonding_good(int send_enc_req, uint8_t *ltk,
- int authenticated, uint16_t ediv,
- uint64_t rand_num)
-{
- struct ble_sm_sec_req sec_req;
- struct ble_store_value_sec value_sec;
- struct ble_hs_conn *conn;
- int rc;
-
- ble_sm_test_util_init();
-
- ble_hs_test_util_create_conn(2, ((uint8_t[6]){1,2,3,4,5,6}),
- ble_sm_test_util_conn_cb,
- NULL);
-
- /* This test inspects and modifies the connection object after unlocking
- * the host mutex. It is not OK for real code to do this, but this test
- * can assume the connection list is unchanging.
- */
- ble_hs_lock();
- conn = ble_hs_conn_find(2);
- TEST_ASSERT_FATAL(conn != NULL);
- ble_hs_unlock();
-
- TEST_ASSERT(!conn->bhc_sec_state.encrypted);
- TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
-
- /* Populate the SM database with an LTK for this peer. */
- value_sec.peer_addr_type = conn->bhc_addr_type;
- memcpy(value_sec.peer_addr, conn->bhc_addr, sizeof value_sec.peer_addr);
- value_sec.ediv = ediv;
- value_sec.rand_num = rand_num;
- memcpy(value_sec.ltk, ltk, sizeof value_sec.ltk);
- value_sec.ltk_present = 1;
- value_sec.authenticated = authenticated;
- value_sec.sc = 0;
-
- rc = ble_store_write_peer_sec(&value_sec);
- TEST_ASSERT_FATAL(rc == 0);
-
- if (send_enc_req) {
- sec_req.authreq = 0;
- sec_req.authreq |= BLE_SM_PAIR_AUTHREQ_BOND;
- if (authenticated) {
- sec_req.authreq |= BLE_SM_PAIR_AUTHREQ_MITM;
- }
- ble_hs_test_util_set_ack(
- host_hci_opcode_join(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_START_ENCRYPT),
- 0);
- ble_sm_test_util_rx_sec_req(2, &sec_req, 0);
- }
-
- /* Ensure we sent the expected start encryption command. */
- ble_hs_test_util_tx_all();
- ble_sm_test_util_verify_tx_start_enc(2, rand_num, ediv, ltk);
- TEST_ASSERT(!conn->bhc_sec_state.encrypted);
- TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
- ble_sm_test_util_io_inject_bad(2, BLE_SM_IOACT_NONE);
-
- /* Receive an encryption changed event. */
- ble_sm_test_util_rx_enc_change(2, 0, 1);
-
- /* Pairing should now be complete. */
- TEST_ASSERT(ble_sm_dbg_num_procs() == 0);
-
- /* Verify that security callback was executed. */
- TEST_ASSERT(ble_sm_test_gap_event == BLE_GAP_EVENT_ENC_CHANGE);
- TEST_ASSERT(ble_sm_test_gap_status == 0);
- TEST_ASSERT(ble_sm_test_sec_state.encrypted);
- TEST_ASSERT(ble_sm_test_sec_state.authenticated ==
- authenticated);
-
- /* Verify that connection has correct security state. */
- TEST_ASSERT(ble_sm_test_sec_state.encrypted);
- TEST_ASSERT(ble_sm_test_sec_state.authenticated ==
- authenticated);
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5a2c4453/net/nimble/host/src/test/ble_sm_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_sm_test_util.h b/net/nimble/host/src/test/ble_sm_test_util.h
index e71aba1..b9dac79 100644
--- a/net/nimble/host/src/test/ble_sm_test_util.h
+++ b/net/nimble/host/src/test/ble_sm_test_util.h
@@ -131,15 +131,9 @@ void ble_sm_test_util_peer_lgcy_fail_confirm(
struct ble_sm_pair_fail *fail_rsp);
void ble_sm_test_util_peer_lgcy_good(struct ble_sm_test_lgcy_params *params);
-void ble_sm_test_util_peer_bonding_good(int send_enc_req, uint8_t *ltk,
- int authenticated,
- uint16_t ediv, uint64_t rand_num);
void ble_sm_test_util_peer_bonding_bad(uint16_t ediv, uint64_t rand_num);
void ble_sm_test_util_peer_sc_good(struct ble_sm_test_sc_params *params);
void ble_sm_test_util_us_sc_good(struct ble_sm_test_sc_params *params);
void ble_sm_test_util_us_fail_inval(struct ble_sm_test_lgcy_params *params);
-void ble_sm_test_util_us_bonding_good(int send_enc_req, uint8_t *ltk,
- int authenticated, uint16_t ediv,
- uint64_t rand_num);
#endif