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/05 11:52:16 UTC

[29/43] incubator-mynewt-core git commit: BLE Host - unit test for SC passkey.

BLE Host - unit test for SC passkey.


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/1e085a07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1e085a07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1e085a07

Branch: refs/heads/develop
Commit: 1e085a07a20139ad89f3f8557947624459e1bb14
Parents: 3249460
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Jun 2 16:17:09 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sun Jun 5 19:17:08 2016 +0800

----------------------------------------------------------------------
 net/nimble/host/src/test/ble_sm_test.c | 658 ++++++++++++++++++++++++++--
 1 file changed, 628 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1e085a07/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 78b46cf..cbe8e03 100644
--- a/net/nimble/host/src/test/ble_sm_test.c
+++ b/net/nimble/host/src/test/ble_sm_test.c
@@ -88,10 +88,10 @@ struct ble_sm_test_sc_params {
     struct ble_sm_sec_req sec_req;
     struct ble_sm_pair_cmd pair_req;
     struct ble_sm_pair_cmd pair_rsp;
-    struct ble_sm_pair_confirm confirm_req;
-    struct ble_sm_pair_confirm confirm_rsp;
-    struct ble_sm_pair_random random_req;
-    struct ble_sm_pair_random random_rsp;
+    struct ble_sm_pair_confirm confirm_req[20];
+    struct ble_sm_pair_confirm confirm_rsp[20];
+    struct ble_sm_pair_random random_req[20];
+    struct ble_sm_pair_random random_rsp[20];
     struct ble_sm_public_key public_key_req;
     struct ble_sm_public_key public_key_rsp;
     struct ble_sm_dhkey_check dhkey_check_req;
@@ -105,7 +105,6 @@ struct ble_sm_test_sc_params {
     struct ble_sm_pair_fail pair_fail;
 
     unsigned has_sec_req:1;
-    unsigned has_confirm_req:1;
     unsigned has_enc_info_req:1;
     unsigned has_enc_info_rsp:1;
     unsigned has_master_id_req:1;
@@ -2298,7 +2297,9 @@ static void
 ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
 {
     struct ble_hs_conn *conn;
+    int num_iters;
     int rc;
+    int i;
 
     ble_sm_test_util_init();
 
@@ -2315,7 +2316,7 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
     ble_hs_cfg.sm_their_key_dist = params->pair_rsp.init_key_dist;
 
     ble_hs_test_util_set_public_addr(params->rsp_addr);
-    ble_sm_dbg_set_next_pair_rand(params->random_rsp.value);
+    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);
 
@@ -2368,29 +2369,56 @@ ble_sm_test_util_peer_sc_good_once(struct ble_sm_test_sc_params *params)
     TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
     TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
 
-    if (params->has_confirm_req) {
-        /* Receive a pair confirm from the peer. */
-        ble_sm_test_util_rx_confirm(2, &params->confirm_req);
+    switch (params->pair_alg) {
+    case BLE_SM_PAIR_ALG_PASSKEY:
+        num_iters = 20;
+        break;
+
+    default:
+        num_iters = 1;
+        break;
+    }
+
+    ble_sm_test_util_io_check_pre(&params->passkey_info,
+                                  BLE_SM_PROC_STATE_CONFIRM);
+
+    for (i = 0; i < num_iters; i++) {
+        if (i != 0) {
+            ble_sm_dbg_set_next_pair_rand(params->random_rsp[i].value);
+        }
+
+        if (params->pair_alg != BLE_SM_PAIR_ALG_JW      &&
+            params->pair_alg != BLE_SM_PAIR_ALG_NUMCMP) {
+
+            /* Receive a pair confirm from the peer. */
+            ble_sm_test_util_rx_confirm(2, params->confirm_req + i);
+            TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
+            TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
+        }
+
+        if (i == 0) {
+            ble_sm_test_util_io_check_post(&params->passkey_info,
+                                           BLE_SM_PROC_STATE_CONFIRM);
+        }
+
+        /* Ensure we sent the expected pair confirm. */
+        ble_hs_test_util_tx_all();
+        ble_sm_test_util_verify_tx_pair_confirm(params->confirm_rsp + i);
         TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
         TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
-    }
 
-    /* Ensure we sent the expected pair confirm. */
-    ble_hs_test_util_tx_all();
-    ble_sm_test_util_verify_tx_pair_confirm(&params->confirm_rsp);
-    TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
-    TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
+        /* Receive a pair random from the peer. */
+        ble_sm_test_util_rx_random(2, params->random_req + i, 0);
+        TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
+        TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
 
-    /* Receive a pair random from the peer. */
-    ble_sm_test_util_rx_random(2, &params->random_req, 0);
-    TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
-    TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
+        /* Ensure we sent the expected pair random. */
+        ble_hs_test_util_tx_all();
+        ble_sm_test_util_verify_tx_pair_random(params->random_rsp + i);
+        TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
+        TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
 
-    /* Ensure we sent the expected pair random. */
-    ble_hs_test_util_tx_all();
-    ble_sm_test_util_verify_tx_pair_random(&params->random_rsp);
-    TEST_ASSERT(!conn->bhc_sec_state.enc_enabled);
-    TEST_ASSERT(ble_sm_dbg_num_procs() == 1);
+    }
 
     ble_sm_test_util_io_check_pre(&params->passkey_info,
                                   BLE_SM_PROC_STATE_DHKEY_CHECK);
@@ -2451,6 +2479,7 @@ ble_sm_test_util_peer_sc_good(struct ble_sm_test_sc_params *params)
 
     params->passkey_info.io_before_rx = 1;
     ble_sm_test_util_peer_sc_good_once(params);
+
 }
 
 TEST_CASE(ble_sm_test_case_peer_sc_jw_good)
@@ -2504,19 +2533,19 @@ TEST_CASE(ble_sm_test_case_peer_sc_jw_good)
                 0xe4, 0x72, 0x5d, 0x8c, 0x7a, 0xb9, 0x06, 0x2a,
             },
         },
-        .confirm_rsp = (struct ble_sm_pair_confirm) {
+        .confirm_rsp[0] = {
             .value = {
                 0x03, 0x8d, 0xc2, 0x76, 0xe8, 0xcb, 0xef, 0x88,
                 0x7d, 0x1f, 0xde, 0xf9, 0x8d, 0x1c, 0x7d, 0xc3,
             },
         },
-        .random_req = (struct ble_sm_pair_random) {
+        .random_req[0] = {
             .value = {
                 0xb9, 0x6c, 0xe1, 0xbb, 0x14, 0xec, 0x6f, 0x18,
                 0x2a, 0x5e, 0xae, 0xe3, 0x23, 0x91, 0x83, 0x3b,
             },
         },
-        .random_rsp = (struct ble_sm_pair_random) {
+        .random_rsp[0] = {
             .value = {
                 0x73, 0x7c, 0xc6, 0xc8, 0xbd, 0x64, 0xa5, 0xab,
                 0xf2, 0xd6, 0xbb, 0x82, 0x68, 0x8e, 0x1b, 0xc2,
@@ -2603,19 +2632,19 @@ TEST_CASE(ble_sm_test_case_peer_sc_numcmp_good)
                 0x93, 0x26, 0x07, 0xfd, 0x9c, 0x93, 0xf3, 0xd6,
             },
         },
-        .confirm_rsp = (struct ble_sm_pair_confirm) {
+        .confirm_rsp[0] = (struct ble_sm_pair_confirm) {
             .value = {
                 0x7c, 0x45, 0xb0, 0x55, 0xce, 0x22, 0x61, 0x57,
                 0x68, 0x2f, 0x2d, 0x3a, 0xce, 0xf5, 0x80, 0xba,
             },
         },
-        .random_req = (struct ble_sm_pair_random) {
+        .random_req[0] = (struct ble_sm_pair_random) {
             .value = {
                 0x4e, 0xfb, 0x89, 0x84, 0xfd, 0xa1, 0xed, 0x65,
                 0x0e, 0x57, 0x11, 0xe6, 0x94, 0xd5, 0x18, 0x78,
             },
         },
-        .random_rsp = (struct ble_sm_pair_random) {
+        .random_rsp[0] = (struct ble_sm_pair_random) {
             .value = {
                 0x29, 0x06, 0xbc, 0x65, 0x1d, 0xe0, 0x95, 0xde,
                 0x79, 0xee, 0xd9, 0x41, 0x86, 0x6f, 0x35, 0x75,
@@ -2682,6 +2711,574 @@ TEST_CASE(ble_sm_test_case_f4)
     TEST_ASSERT(memcmp(res, exp, 16) == 0);
 }
 
+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 },
+        .rsp_addr = { 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07 },
+        .pair_req = (struct ble_sm_pair_cmd) {
+            .io_cap = 0x04,
+            .oob_data_flag = 0x00,
+            .authreq = 0x0d,
+            .max_enc_key_size = 16,
+            .init_key_dist = 0x0d,
+            .resp_key_dist = 0x0f,
+        },
+        .pair_rsp = (struct ble_sm_pair_cmd) {
+            .io_cap = 0x02,
+            .oob_data_flag = 0x00,
+            .authreq = 0x0d,
+            .max_enc_key_size = 16,
+            .init_key_dist = 0x01,
+            .resp_key_dist = 0x01,
+        },
+        .public_key_req = (struct ble_sm_public_key) {
+            .x = {
+                0x82,0xcf, 0x99, 0xe1, 0x56, 0xe5, 0xa3, 0xbc,
+                0x1d,0xd5, 0xab, 0x32, 0x90, 0x65, 0x9a, 0x6c,
+                0x15,0x34, 0xcf, 0xa3, 0xb1, 0xa3, 0x88, 0x9f,
+                0xb0,0x86, 0xc7, 0x17, 0xd4, 0x1a, 0x88, 0x8d,
+            },
+            .y = {
+                0x09,0xfb, 0x98, 0xd2, 0xf8, 0x94, 0x73, 0xed,
+                0x81,0x09, 0x08, 0x00, 0x3f, 0x14, 0x87, 0x6c,
+                0xc6,0x83, 0x36, 0xc1, 0x9d, 0x8e, 0x39, 0xea,
+                0x3d,0x79, 0x9d, 0x8c, 0x7f, 0xcf, 0x00, 0xbd,
+            },
+        },
+        .public_key_rsp = (struct ble_sm_public_key) {
+            .x = {
+                0x9e,0x05, 0x7b, 0x5b, 0x61, 0xf2, 0x57, 0xbe,
+                0xb7,0x73, 0x3f, 0x72, 0x03, 0xc9, 0x51, 0x44,
+                0x9e,0xe1, 0xef, 0xe8, 0x28, 0x67, 0xcc, 0xbe,
+                0x20,0x13, 0xb5, 0xcc, 0x71, 0x39, 0x85, 0xaf,
+            },
+            .y = {
+                0xff,0xac, 0x2c, 0x48, 0x57, 0xd9, 0x49, 0x9d,
+                0x27,0x8d, 0x99, 0x30, 0x01, 0xe3, 0x30, 0x72,
+                0xd4,0x7b, 0x5c, 0x64, 0x7e, 0x80, 0xd5, 0x09,
+                0x3a,0x70, 0x44, 0x61, 0xc9, 0x36, 0x50, 0x6b,
+            },
+        },
+        .confirm_req[0] = {
+            .value = {
+                0x2f,0xa2, 0x10, 0xff, 0xd8, 0x1c, 0x5c, 0x93,
+                0xd9,0x96, 0xf2, 0x8d, 0x7a, 0x34, 0xef, 0xbc,
+            },
+        },
+        .confirm_rsp[0] = {
+            .value = {
+                0xe7,0xd6, 0x11, 0xd9, 0xb1, 0x69, 0xe1, 0x0b,
+                0xbb,0x07, 0x63, 0x38, 0x62, 0x75, 0x5f, 0x2b,
+            },
+        },
+        .random_req[0] = {
+            .value = {
+                0xfa,0x4c, 0xa5, 0x7e, 0xfd, 0x11, 0x68, 0xeb,
+                0xf2,0x6a, 0xcd, 0x50, 0x7a, 0x92, 0x36, 0xf1,
+            },
+        },
+        .random_rsp[0] = {
+            .value = {
+                0xa5,0xec, 0xc8, 0x7f, 0xe2, 0x19, 0x05, 0x5e,
+                0x2e,0x0d, 0x12, 0x65, 0xd5, 0x11, 0x98, 0x7e,
+            },
+        },
+        .confirm_req[1] = {
+            .value = {
+                0x5b,0xff, 0xad, 0x40, 0x98, 0xb8, 0xc8, 0xd9,
+                0x1e,0xde, 0x11, 0x17, 0xcc, 0x16, 0x09, 0x08,
+            },
+        },
+        .confirm_rsp[1] = {
+            .value = {
+                0xe1,0xd7, 0xb3, 0x1b, 0x2b, 0xa8, 0x38, 0x29,
+                0xa4,0xd7, 0x62, 0x4b, 0xf2, 0x59, 0x51, 0xdc,
+            },
+        },
+        .random_req[1] = {
+            .value = {
+                0xac,0x6b, 0xc5, 0x83, 0x9f, 0x08, 0x05, 0xed,
+                0x0e,0x76, 0x14, 0xce, 0x57, 0x07, 0x6e, 0x0b,
+            },
+        },
+        .random_rsp[1] = {
+            .value = {
+                0x6d,0x7d, 0x10, 0x78, 0x76, 0x09, 0x34, 0xca,
+                0xa9,0x70, 0x5b, 0x59, 0xfb, 0xfd, 0x15, 0x17,
+            },
+        },
+        .confirm_req[2] = {
+            .value = {
+                0x5c,0xb7, 0x96, 0x9a, 0x5b, 0x8a, 0x8f, 0x00,
+                0xae,0x84, 0xa1, 0x72, 0xc8, 0x4d, 0xd0, 0x85,
+            },
+        },
+        .confirm_rsp[2] = {
+            .value = {
+                0xe7,0x0e, 0x80, 0x89, 0xf7, 0x04, 0x48, 0x02,
+                0x06,0xd3, 0xd2, 0x09, 0x88, 0x73, 0x44, 0x3c,
+            },
+        },
+        .random_req[2] = {
+            .value = {
+                0xc7,0x83, 0xec, 0x81, 0xf4, 0xe0, 0xdd, 0x41,
+                0xaf,0x28, 0x6f, 0xbe, 0xb4, 0x92, 0x30, 0xf7,
+            },
+        },
+        .random_rsp[2] = {
+            .value = {
+                0x38,0x95, 0xbb, 0x5f, 0x8a, 0x67, 0xb7, 0x8f,
+                0x95,0x2a, 0x7e, 0x3b, 0xac, 0x27, 0xf7, 0x86,
+            },
+        },
+        .confirm_req[3] = {
+            .value = {
+                0x01,0x3d, 0xee, 0x42, 0xb7, 0xfa, 0xc1, 0x82,
+                0x51,0x02, 0x42, 0x51, 0xa2, 0xbb, 0x20, 0x0e,
+            },
+        },
+        .confirm_rsp[3] = {
+            .value = {
+                0x99,0x01, 0x88, 0x1c, 0x45, 0x2c, 0xa6, 0x6f,
+                0x6b,0xca, 0x9d, 0x8d, 0x32, 0xfe, 0x2f, 0x02,
+            },
+        },
+        .random_req[3] = {
+            .value = {
+                0x5e,0x39, 0x5f, 0x91, 0x9d, 0xed, 0xf9, 0x93,
+                0xec,0xd5, 0x6b, 0x39, 0xb6, 0x77, 0x3a, 0x94,
+            },
+        },
+        .random_rsp[3] = {
+            .value = {
+                0xe1,0x06, 0x02, 0xcc, 0x80, 0x9d, 0xd1, 0x47,
+                0x42,0xa6, 0xca, 0x52, 0x6a, 0x1b, 0x9e, 0x7a,
+            },
+        },
+        .confirm_req[4] = {
+            .value = {
+                0x2e,0xcd, 0x64, 0x01, 0x39, 0x74, 0x59, 0xfc,
+                0x78,0xeb, 0x48, 0x4f, 0xa3, 0x8a, 0x6e, 0x2f,
+            },
+        },
+        .confirm_rsp[4] = {
+            .value = {
+                0x9e,0x27, 0x31, 0x14, 0x35, 0x95, 0x0a, 0x3d,
+                0x0b,0x60, 0xd9, 0x78, 0xd9, 0xfc, 0x5d, 0xc4,
+            },
+        },
+        .random_req[4] = {
+            .value = {
+                0x3f,0x35, 0xa0, 0x90, 0xbf, 0x5a, 0x16, 0xcd,
+                0x32,0x0c, 0x88, 0x3a, 0x3c, 0x28, 0x89, 0x29,
+            },
+        },
+        .random_rsp[4] = {
+            .value = {
+                0xde,0xb9, 0x95, 0x46, 0x55, 0xed, 0xaa, 0x76,
+                0xb3,0xae, 0x59, 0x92, 0xec, 0x3e, 0xe6, 0x17,
+            },
+        },
+        .confirm_req[5] = {
+            .value = {
+                0x61,0x65, 0x44, 0xa6, 0x35, 0x88, 0x34, 0x80,
+                0xeb,0xce, 0xc4, 0xc3, 0xa0, 0xf4, 0xc4, 0xdb,
+            },
+        },
+        .confirm_rsp[5] = {
+            .value = {
+                0xc5,0xdd, 0x46, 0x1c, 0x42, 0x8a, 0xe9, 0x5c,
+                0x71,0xb3, 0x55, 0x5f, 0x35, 0xdd, 0xb3, 0x79,
+            },
+        },
+        .random_req[5] = {
+            .value = {
+                0xfa,0xae, 0x45, 0x2a, 0x17, 0xff, 0xfe, 0xe1,
+                0x05,0x58, 0xa4, 0xbd, 0x40, 0x9e, 0x05, 0x0c,
+            },
+        },
+        .random_rsp[5] = {
+            .value = {
+                0x7b,0xef, 0xca, 0x4e, 0x87, 0x80, 0xef, 0xd9,
+                0x8f,0xa5, 0x61, 0x8d, 0x73, 0xb2, 0x38, 0xcd,
+            },
+        },
+        .confirm_req[6] = {
+            .value = {
+                0x38,0xfb, 0x19, 0x1e, 0xc7, 0xec, 0x11, 0xed,
+                0xaa,0xc0, 0xa5, 0xaf, 0x79, 0x8f, 0x96, 0x82,
+            },
+        },
+        .confirm_rsp[6] = {
+            .value = {
+                0x9d,0x0f, 0x44, 0x66, 0xd7, 0x05, 0x24, 0x81,
+                0xff,0x32, 0x5c, 0xda, 0x25, 0x2c, 0x92, 0xec,
+            },
+        },
+        .random_req[6] = {
+            .value = {
+                0x77,0xc3, 0x35, 0x7b, 0x78, 0xbc, 0xe4, 0xc1,
+                0x9c,0x13, 0xbd, 0xd2, 0xd2, 0xc6, 0x1e, 0x50,
+            },
+        },
+        .random_rsp[6] = {
+            .value = {
+                0x5d,0xd5, 0x12, 0x06, 0x66, 0xd1, 0x74, 0x3a,
+                0xb7,0x5e, 0x54, 0x0d, 0xa2, 0x0f, 0xa4, 0x7c,
+            },
+        },
+        .confirm_req[7] = {
+            .value = {
+                0x32,0xe8, 0xf4, 0xc9, 0xed, 0xa7, 0xd3, 0x95,
+                0x94,0x0f, 0x08, 0xfb, 0xaa, 0xce, 0x84, 0x06,
+            },
+        },
+        .confirm_rsp[7] = {
+            .value = {
+                0x5a,0x59, 0xb8, 0xbe, 0x70, 0x33, 0x99, 0xf9,
+                0x07,0xff, 0x70, 0xe2, 0x10, 0x53, 0xf6, 0xf1,
+            },
+        },
+        .random_req[7] = {
+            .value = {
+                0x2f,0x07, 0x42, 0x95, 0xb2, 0x97, 0xcf, 0xa4,
+                0xde,0x2e, 0x88, 0xa1, 0x2a, 0x3c, 0x89, 0x6e,
+            },
+        },
+        .random_rsp[7] = {
+            .value = {
+                0x23,0x21, 0x9f, 0x2f, 0xfc, 0xb1, 0x80, 0xce,
+                0x0f,0x3d, 0xe6, 0xee, 0xbe, 0xab, 0x28, 0xe2,
+            },
+        },
+        .confirm_req[8] = {
+            .value = {
+                0x20,0xc3, 0x49, 0x90, 0x13, 0xad, 0x99, 0x69,
+                0xf1,0xd3, 0x71, 0x95, 0xb0, 0x54, 0xc4, 0xce,
+            },
+        },
+        .confirm_rsp[8] = {
+            .value = {
+                0x02,0x50, 0x29, 0x57, 0xc5, 0x26, 0x1f, 0x90,
+                0x05,0x8b, 0x8c, 0x20, 0xe9, 0xf7, 0xdd, 0x03,
+            },
+        },
+        .random_req[8] = {
+            .value = {
+                0xfd,0x09, 0x39, 0xc8, 0xc6, 0x57, 0xcf, 0x09,
+                0xc7,0x89, 0xab, 0xcc, 0x05, 0xda, 0xb7, 0x05,
+            },
+        },
+        .random_rsp[8] = {
+            .value = {
+                0x0d,0xed, 0xfd, 0x38, 0x76, 0x56, 0xa0, 0xcc,
+                0xf4,0x66, 0x09, 0xcb, 0x0f, 0x8c, 0xa5, 0x6a,
+            },
+        },
+        .confirm_req[9] = {
+            .value = {
+                0xce,0x50, 0x75, 0xda, 0x6a, 0x88, 0x98, 0x00,
+                0xe5,0x4d, 0x7d, 0xcf, 0xde, 0x00, 0xc5, 0x18,
+            },
+        },
+        .confirm_rsp[9] = {
+            .value = {
+                0x0b,0xd4, 0x0c, 0xba, 0xfe, 0x9a, 0xf0, 0x31,
+                0x13,0x21, 0x70, 0x11, 0x7c, 0xde, 0x26, 0x75,
+            },
+        },
+        .random_req[9] = {
+            .value = {
+                0x24,0x85, 0x91, 0xef, 0x4b, 0x8e, 0x2b, 0x67,
+                0x39,0x93, 0x7c, 0x7e, 0x4b, 0x76, 0x10, 0x44,
+            },
+        },
+        .random_rsp[9] = {
+            .value = {
+                0x2d,0xa3, 0x52, 0xc7, 0x09, 0x0b, 0xda, 0x81,
+                0xbd,0x10, 0x30, 0x57, 0x20, 0x2c, 0x5b, 0x90,
+            },
+        },
+        .confirm_req[10] = {
+            .value = {
+                0x7a,0x3e, 0x5b, 0x55, 0x08, 0x63, 0x32, 0x65,
+                0xaa,0xf8, 0xc1, 0xd2, 0xd6, 0x01, 0x1a, 0x7e,
+            },
+        },
+        .confirm_rsp[10] = {
+            .value = {
+                0x46,0xdd, 0x55, 0x46, 0x90, 0x55, 0xc8, 0x0b,
+                0x9e,0x7b, 0x81, 0xbb, 0x71, 0x11, 0x7f, 0x58,
+            },
+        },
+        .random_req[10] = {
+            .value = {
+                0xc0,0xe0, 0xa0, 0x10, 0xfc, 0xbc, 0xd9, 0x54,
+                0x48,0xdc, 0xcf, 0x8f, 0xda, 0xe6, 0x6a, 0x5f,
+            },
+        },
+        .random_rsp[10] = {
+            .value = {
+                0x22,0x3c, 0xd5, 0x79, 0x3e, 0xb3, 0x64, 0x3c,
+                0x46,0xba, 0xbc, 0x74, 0x4a, 0xc0, 0x5c, 0x18,
+            },
+        },
+        .confirm_req[11] = {
+            .value = {
+                0x29,0x6e, 0x96, 0xb8, 0xc1, 0x74, 0x27, 0x4c,
+                0x56,0xe0, 0x3e, 0x33, 0x3a, 0xca, 0xf9, 0x68,
+            },
+        },
+        .confirm_rsp[11] = {
+            .value = {
+                0xf0,0xe5, 0x3e, 0x5b, 0x68, 0x82, 0x40, 0x53,
+                0x98,0x1b, 0x57, 0xdd, 0x4f, 0x40, 0x23, 0xa2,
+            },
+        },
+        .random_req[11] = {
+            .value = {
+                0xb8,0xd9, 0x75, 0x53, 0x65, 0x42, 0x5a, 0x0c,
+                0x82,0x74, 0x55, 0x2c, 0x40, 0x5b, 0x02, 0xed,
+            },
+        },
+        .random_rsp[11] = {
+            .value = {
+                0x3f,0x88, 0x97, 0x63, 0x72, 0xe7, 0x84, 0x29,
+                0x2d,0xcc, 0xd3, 0xc6, 0xbb, 0xa8, 0x6a, 0xb8,
+            },
+        },
+        .confirm_req[12] = {
+            .value = {
+                0x6c,0x1f, 0x97, 0xda, 0x08, 0x2c, 0x9b, 0x8b,
+                0xf2,0xb0, 0x7a, 0x3e, 0xdf, 0xbf, 0x1e, 0x70,
+            },
+        },
+        .confirm_rsp[12] = {
+            .value = {
+                0x18,0xfe, 0x73, 0x49, 0xe0, 0x7a, 0x75, 0xd3,
+                0x68,0x52, 0x2d, 0xae, 0x76, 0xf5, 0xc1, 0x4f,
+            },
+        },
+        .random_req[12] = {
+            .value = {
+                0xb3,0xf1, 0xd0, 0xa9, 0x5a, 0x69, 0xa7, 0x33,
+                0xb9,0xdd, 0x04, 0x7d, 0x19, 0xc9, 0x0e, 0xdc,
+            },
+        },
+        .random_rsp[12] = {
+            .value = {
+                0x62,0x10, 0x99, 0xae, 0xc0, 0x5c, 0x00, 0x59,
+                0xda,0x14, 0x38, 0x41, 0x8e, 0x70, 0xd9, 0x51,
+            },
+        },
+        .confirm_req[13] = {
+            .value = {
+                0x3f,0x62, 0xd8, 0x3c, 0x29, 0x25, 0xf7, 0x96,
+                0x1c,0x01, 0x4f, 0x27, 0x19, 0x89, 0x51, 0xaf,
+            },
+        },
+        .confirm_rsp[13] = {
+            .value = {
+                0x4c,0x9f, 0xff, 0xef, 0x9c, 0x04, 0x4f, 0xa7,
+                0xb9,0x8f, 0x9b, 0x4c, 0xbb, 0xaa, 0x8c, 0x44,
+            },
+        },
+        .random_req[13] = {
+            .value = {
+                0x73,0x5e, 0xef, 0x3b, 0x9b, 0x45, 0xf1, 0x31,
+                0xcd,0x0c, 0x26, 0x7c, 0xe9, 0xfc, 0x04, 0x5d,
+            },
+        },
+        .random_rsp[13] = {
+            .value = {
+                0x38,0x53, 0x68, 0xaa, 0xdf, 0x20, 0xd4, 0xef,
+                0x11,0x2b, 0xac, 0xe2, 0x7c, 0x11, 0x00, 0x10,
+            },
+        },
+        .confirm_req[14] = {
+            .value = {
+                0x13,0x1d, 0xc2, 0x1a, 0x39, 0x01, 0xbf, 0xf9,
+                0x87,0xdd, 0xb4, 0xd3, 0xe5, 0xe8, 0x8c, 0x42,
+            },
+        },
+        .confirm_rsp[14] = {
+            .value = {
+                0x34,0xc5, 0xda, 0xc1, 0x4c, 0xa8, 0x47, 0x31,
+                0x76,0x5e, 0x4f, 0xcd, 0x37, 0x77, 0x04, 0x10,
+            },
+        },
+        .random_req[14] = {
+            .value = {
+                0x59,0x02, 0xa1, 0x35, 0xd7, 0x12, 0x9a, 0x51,
+                0xf4,0xad, 0x32, 0xdf, 0x3b, 0xa4, 0x3a, 0xae,
+            },
+        },
+        .random_rsp[14] = {
+            .value = {
+                0x47,0x9e, 0x47, 0x0f, 0x53, 0xad, 0x74, 0x57,
+                0x1a,0xdc, 0x1b, 0x5f, 0xc0, 0xf0, 0x00, 0x1a,
+            },
+        },
+        .confirm_req[15] = {
+            .value = {
+                0x4c,0xa7, 0x4f, 0x64, 0xc1, 0xb7, 0xfe, 0xa9,
+                0xcb,0x94, 0x5f, 0x39, 0x9a, 0x1e, 0xbf, 0xb4,
+            },
+        },
+        .confirm_rsp[15] = {
+            .value = {
+                0xed,0x61, 0x96, 0xaa, 0xd5, 0x27, 0x23, 0x32,
+                0xc4,0x80, 0x52, 0x3c, 0x81, 0x45, 0x37, 0xc3,
+            },
+        },
+        .random_req[15] = {
+            .value = {
+                0xe4,0x2e, 0x04, 0xce, 0x7d, 0xbe, 0xb5, 0x5b,
+                0xb5,0xd5, 0xba, 0x60, 0x3f, 0x88, 0x05, 0xf1,
+            },
+        },
+        .random_rsp[15] = {
+            .value = {
+                0x64,0xa0, 0x95, 0x1f, 0x01, 0x7e, 0x00, 0x8d,
+                0x00,0x40, 0xa1, 0x2f, 0x90, 0x42, 0xcb, 0x15,
+            },
+        },
+        .confirm_req[16] = {
+            .value = {
+                0xce,0x32, 0x34, 0x33, 0x44, 0xbc, 0xb2, 0x8e,
+                0x64,0xfd, 0x8a, 0xeb, 0x41, 0xf9, 0x4d, 0xd7,
+            },
+        },
+        .confirm_rsp[16] = {
+            .value = {
+                0xb4,0x69, 0x44, 0xa5, 0x0a, 0x88, 0xfe, 0x39,
+                0x0c,0x7f, 0xc9, 0x8b, 0x7f, 0x7e, 0x6e, 0x45,
+            },
+        },
+        .random_req[16] = {
+            .value = {
+                0xff,0x56, 0x8f, 0x97, 0x85, 0x6e, 0xac, 0xd1,
+                0x00,0x0e, 0x8d, 0x2f, 0xf1, 0x68, 0xf9, 0xf2,
+            },
+        },
+        .random_rsp[16] = {
+            .value = {
+                0xc0,0x84, 0x5c, 0x92, 0x0d, 0x71, 0xdd, 0x88,
+                0xab,0x13, 0xa4, 0xf4, 0x06, 0x54, 0x4f, 0x1b,
+            },
+        },
+        .confirm_req[17] = {
+            .value = {
+                0x59,0xe5, 0x79, 0xdd, 0x1d, 0xd3, 0xa5, 0xf8,
+                0xba,0x7f, 0xf6, 0xc9, 0xaf, 0xca, 0xe8, 0xbc,
+            },
+        },
+        .confirm_rsp[17] = {
+            .value = {
+                0x39,0xd4, 0xc3, 0x39, 0xd9, 0x0b, 0x07, 0xe1,
+                0x6c,0x68, 0x6b, 0xef, 0xc8, 0x87, 0x93, 0x4f,
+            },
+        },
+        .random_req[17] = {
+            .value = {
+                0xaa,0xf9, 0xa4, 0xc9, 0xe0, 0x6f, 0xfc, 0x7b,
+                0x22,0x5a, 0xb6, 0x3d, 0x50, 0x3e, 0xd1, 0x02,
+            },
+        },
+        .random_rsp[17] = {
+            .value = {
+                0x22,0x90, 0x0e, 0xd4, 0x92, 0xb7, 0xa9, 0x16,
+                0x39,0x2a, 0x1c, 0xd2, 0x8b, 0xbf, 0xf7, 0x43,
+            },
+        },
+        .confirm_req[18] = {
+            .value = {
+                0x69,0xb9, 0x75, 0x4b, 0x80, 0xe8, 0x93, 0xbb,
+                0x57,0xe8, 0x37, 0x3c, 0x69, 0x47, 0x40, 0xb7,
+            },
+        },
+        .confirm_rsp[18] = {
+            .value = {
+                0xd8,0x69, 0x55, 0xf4, 0x84, 0x54, 0x95, 0x98,
+                0xdf,0x13, 0x69, 0x62, 0xbc, 0xea, 0x46, 0x16,
+            },
+        },
+        .random_req[18] = {
+            .value = {
+                0xf6,0x26, 0xc3, 0xec, 0xdc, 0xc8, 0x85, 0x78,
+                0xd4,0xe4, 0x0e, 0x1b, 0x05, 0x6d, 0x33, 0x20,
+            },
+        },
+        .random_rsp[18] = {
+            .value = {
+                0xf7,0xb6, 0x8a, 0xdc, 0xd5, 0xdd, 0x0f, 0x2f,
+                0x6a,0xab, 0x94, 0xcd, 0x68, 0xf4, 0x2d, 0xda,
+            },
+        },
+        .confirm_req[19] = {
+            .value = {
+                0x07,0xea, 0xe0, 0x61, 0x90, 0x23, 0x52, 0xd8,
+                0x90,0x50, 0xe1, 0x7c, 0x10, 0x1e, 0x41, 0xf0,
+            },
+        },
+        .confirm_rsp[19] = {
+            .value = {
+                0xed,0xd9, 0x02, 0xb7, 0x03, 0xd9, 0xe8, 0x87,
+                0x4a,0x48, 0x43, 0x96, 0xa0, 0x59, 0xb1, 0xa8,
+            },
+        },
+        .random_req[19] = {
+            .value = {
+                0x88,0x00, 0xe6, 0xfc, 0x1f, 0x6f, 0x92, 0x0e,
+                0x33,0xeb, 0x18, 0xc3, 0x5d, 0x7e, 0x37, 0x0e,
+            },
+        },
+        .random_rsp[19] = {
+            .value = {
+                0xfb,0xcf, 0x24, 0x02, 0x4a, 0xe4, 0x92, 0x47,
+                0xa9,0x67, 0x43, 0x33, 0x22, 0x95, 0x0a, 0xd3,
+            },
+        },
+        .dhkey_check_req = (struct ble_sm_dhkey_check) {
+            .value = {
+                0xcb, 0xb5, 0x5f, 0x62, 0xde, 0x14, 0xc7, 0x30,
+                0xaa, 0x58, 0x23, 0x3c, 0xdb, 0x39, 0xc1, 0xb9,
+            }
+        },
+        .dhkey_check_rsp = (struct ble_sm_dhkey_check) {
+            .value = {
+                0x52, 0x00, 0xeb, 0xe5, 0xd7, 0xa6, 0x5c, 0xc4,
+                0xf6, 0x6d, 0xa5, 0x7c, 0xff, 0xa8, 0x7c, 0x3f,
+            }
+        },
+        .pair_alg = BLE_SM_PAIR_ALG_PASSKEY,
+        .authenticated = 1,
+        .ltk = {
+            0x45, 0x8a, 0x1b, 0x92, 0x1c, 0x2b, 0xdf, 0x3e,
+            0xda, 0xf9, 0x5c, 0xdf, 0x96, 0x59, 0xb7, 0x13,
+        },
+        .our_priv_key = {
+            0x20, 0x62, 0xba, 0x77, 0xfe, 0xdd, 0x34, 0xf7,
+            0x30, 0xcc, 0x35, 0x3f, 0xa3, 0x35, 0x02, 0x95,
+            0x2d, 0x03, 0x78, 0x4e, 0xe8, 0x80, 0xaa, 0x4d,
+            0x8c, 0xec, 0x93, 0x02, 0x28, 0x55, 0x2f, 0xf8,
+        },
+
+        .passkey_info = {
+            .passkey = {
+                .action = BLE_SM_PKACT_INPUT,
+                .passkey = 873559,
+            },
+
+            .io_before_rx = 0,
+        },
+    };
+    ble_sm_test_util_peer_sc_good(&params);
+}
+
 TEST_CASE(ble_sm_test_case_f5)
 {
 	uint8_t w[32] = { 0x98, 0xa6, 0xbf, 0x73, 0xf3, 0x34, 0x8d, 0x86,
@@ -2783,6 +3380,7 @@ TEST_SUITE(ble_sm_test_suite)
     ble_sm_test_case_us_sec_req_enc();
     ble_sm_test_case_peer_sc_jw_good();
     ble_sm_test_case_peer_sc_numcmp_good();
+    ble_sm_test_case_peer_sc_passkey_good();
 }
 #endif