Loading system/btif/src/btif_dm.c +3 −3 Original line number Diff line number Diff line Loading @@ -2899,7 +2899,7 @@ void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r) ** add a node with label "SmpOptions" to the config file ** and assign it a comma separated list of 5 values in the ** format: auth, io, ikey, rkey, ksize, oob ** eg: SmpOptions=0xD,0x4,0xf,0xf,0x10 ** eg: PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10 ** ** Parameters: tBTE_APPL_CFG*: pointer to struct defining pairing options ** Loading @@ -2908,13 +2908,13 @@ void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r) *******************************************************************************/ BOOLEAN btif_dm_get_smp_config(tBTE_APPL_CFG* p_cfg) { if(!stack_config_get_interface()->get_smp_options()) { if(!stack_config_get_interface()->get_pts_smp_options()) { BTIF_TRACE_DEBUG ("%s: SMP options not found in configuration", __func__); return FALSE; } char conf[64]; const char* recv = stack_config_get_interface()->get_smp_options(); const char* recv = stack_config_get_interface()->get_pts_smp_options(); char* pch; char* endptr; Loading system/conf/bt_stack.conf +17 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ TRC_GAP=2 TRC_BNEP=2 TRC_PAN=2 # PTS testing helps # PTS testing helpers # Secure connections only mode. # PTS_SecurePairOnly=true Loading @@ -53,3 +53,19 @@ TRC_PAN=2 # SMP Pair options (formatted as hex bytes) auth, io, ikey, rkey, ksize #PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10 # SMP Certification Failure Cases # Fail case number range from 1 to 9 will set up remote device for test # case execution. Setting PTS_SmpFailureCase to 0 means normal operation. # Failure modes: # 1 = SMP_CONFIRM_VALUE_ERR # 2 = SMP_PAIR_AUTH_FAIL # 3 = SMP_PAIR_FAIL_UNKNOWN # 4 = SMP_PAIR_NOT_SUPPORT # 5 = SMP_PASSKEY_ENTRY_FAIL # 6 = SMP_REPEATED_ATTEMPTS # 7 = PIN generation failure? # 8 = SMP_PASSKEY_ENTRY_FAIL # 9 = SMP_NUMERIC_COMPAR_FAIL; #PTS_SmpFailureCase=0 system/include/stack_config.h +2 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,8 @@ typedef struct { bool (*get_pts_secure_only_mode)(void); bool (*get_pts_conn_updates_disabled)(void); bool (*get_pts_crosskey_sdp_disable)(void); const char* (*get_smp_options)(void); const char* (*get_pts_smp_options)(void); int (*get_pts_smp_failure_case)(void); config_t *(*get_all)(void); } stack_config_t; Loading system/main/stack_config.c +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ const char *PTS_SECURE_ONLY_MODE = "PTS_SecurePairOnly"; const char *PTS_LE_CONN_UPDATED_DISABLED = "PTS_DisableConnUpdates"; const char *PTS_DISABLE_SDP_LE_PAIR = "PTS_DisableSDPOnLEPair"; const char *PTS_SMP_PAIRING_OPTIONS_KEY = "PTS_SmpOptions"; const char *PTS_SMP_FAILURE_CASE_KEY = "PTS_SmpFailureCase"; static config_t *config; Loading Loading @@ -108,6 +109,10 @@ static const char *get_pts_smp_options(void) { return config_get_string(config, CONFIG_DEFAULT_SECTION, PTS_SMP_PAIRING_OPTIONS_KEY, NULL); } static int get_pts_smp_failure_case(void) { return config_get_int(config, CONFIG_DEFAULT_SECTION, PTS_SMP_FAILURE_CASE_KEY, 0); } static config_t *get_all(void) { return config; } Loading @@ -121,6 +126,7 @@ const stack_config_t interface = { get_pts_conn_updates_disabled, get_pts_crosskey_sdp_disable, get_pts_smp_options, get_pts_smp_failure_case, get_all }; Loading system/stack/smp/smp_act.c +54 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,42 @@ static bool lmp_version_below(BD_ADDR bda, uint8_t version) return acl->lmp_version < version; } static bool pts_test_send_authentication_complete_failure(tSMP_CB *p_cb) { uint8_t reason = 0; if (p_cb->cert_failure < 2 || p_cb->cert_failure > 6) return false; SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure); switch (p_cb->cert_failure) { case 2: reason = SMP_PAIR_AUTH_FAIL; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 3: reason = SMP_PAIR_FAIL_UNKNOWN; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 4: reason = SMP_PAIR_NOT_SUPPORT; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 5: reason = SMP_PASSKEY_ENTRY_FAIL; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 6: reason = SMP_REPEATED_ATTEMPTS; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; } return true;; } /******************************************************************************* ** Function smp_update_key_mask ** Description This function updates the key mask for sending or receiving. Loading Loading @@ -550,6 +586,10 @@ void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) return; } // PTS Testing failure modes if (pts_test_send_authentication_complete_failure(p_cb)) return; if (p_cb->role == HCI_ROLE_SLAVE) { if (!(p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD)) Loading Loading @@ -1403,6 +1443,11 @@ void smp_process_io_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) { if (smp_request_oob_data(p_cb)) return; } // PTS Testing failure modes if (pts_test_send_authentication_complete_failure(p_cb)) return; smp_send_pair_rsp(p_cb, NULL); } } Loading Loading @@ -1638,6 +1683,14 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) SMP_TRACE_DEBUG("%s start ", __func__); // PTS Testing failure modes if (p_cb->cert_failure == 1) { SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure); reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); return; } switch(p_cb->selected_association_model) { case SMP_MODEL_SEC_CONN_JUSTWORKS: Loading Loading @@ -1671,7 +1724,7 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) break; case SMP_MODEL_SEC_CONN_PASSKEY_ENT: case SMP_MODEL_SEC_CONN_PASSKEY_DISP: if (!smp_check_commitment(p_cb)) if (!smp_check_commitment(p_cb) && p_cb->cert_failure != 9) { reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); Loading Loading
system/btif/src/btif_dm.c +3 −3 Original line number Diff line number Diff line Loading @@ -2899,7 +2899,7 @@ void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r) ** add a node with label "SmpOptions" to the config file ** and assign it a comma separated list of 5 values in the ** format: auth, io, ikey, rkey, ksize, oob ** eg: SmpOptions=0xD,0x4,0xf,0xf,0x10 ** eg: PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10 ** ** Parameters: tBTE_APPL_CFG*: pointer to struct defining pairing options ** Loading @@ -2908,13 +2908,13 @@ void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r) *******************************************************************************/ BOOLEAN btif_dm_get_smp_config(tBTE_APPL_CFG* p_cfg) { if(!stack_config_get_interface()->get_smp_options()) { if(!stack_config_get_interface()->get_pts_smp_options()) { BTIF_TRACE_DEBUG ("%s: SMP options not found in configuration", __func__); return FALSE; } char conf[64]; const char* recv = stack_config_get_interface()->get_smp_options(); const char* recv = stack_config_get_interface()->get_pts_smp_options(); char* pch; char* endptr; Loading
system/conf/bt_stack.conf +17 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ TRC_GAP=2 TRC_BNEP=2 TRC_PAN=2 # PTS testing helps # PTS testing helpers # Secure connections only mode. # PTS_SecurePairOnly=true Loading @@ -53,3 +53,19 @@ TRC_PAN=2 # SMP Pair options (formatted as hex bytes) auth, io, ikey, rkey, ksize #PTS_SmpOptions=0xD,0x4,0xf,0xf,0x10 # SMP Certification Failure Cases # Fail case number range from 1 to 9 will set up remote device for test # case execution. Setting PTS_SmpFailureCase to 0 means normal operation. # Failure modes: # 1 = SMP_CONFIRM_VALUE_ERR # 2 = SMP_PAIR_AUTH_FAIL # 3 = SMP_PAIR_FAIL_UNKNOWN # 4 = SMP_PAIR_NOT_SUPPORT # 5 = SMP_PASSKEY_ENTRY_FAIL # 6 = SMP_REPEATED_ATTEMPTS # 7 = PIN generation failure? # 8 = SMP_PASSKEY_ENTRY_FAIL # 9 = SMP_NUMERIC_COMPAR_FAIL; #PTS_SmpFailureCase=0
system/include/stack_config.h +2 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,8 @@ typedef struct { bool (*get_pts_secure_only_mode)(void); bool (*get_pts_conn_updates_disabled)(void); bool (*get_pts_crosskey_sdp_disable)(void); const char* (*get_smp_options)(void); const char* (*get_pts_smp_options)(void); int (*get_pts_smp_failure_case)(void); config_t *(*get_all)(void); } stack_config_t; Loading
system/main/stack_config.c +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ const char *PTS_SECURE_ONLY_MODE = "PTS_SecurePairOnly"; const char *PTS_LE_CONN_UPDATED_DISABLED = "PTS_DisableConnUpdates"; const char *PTS_DISABLE_SDP_LE_PAIR = "PTS_DisableSDPOnLEPair"; const char *PTS_SMP_PAIRING_OPTIONS_KEY = "PTS_SmpOptions"; const char *PTS_SMP_FAILURE_CASE_KEY = "PTS_SmpFailureCase"; static config_t *config; Loading Loading @@ -108,6 +109,10 @@ static const char *get_pts_smp_options(void) { return config_get_string(config, CONFIG_DEFAULT_SECTION, PTS_SMP_PAIRING_OPTIONS_KEY, NULL); } static int get_pts_smp_failure_case(void) { return config_get_int(config, CONFIG_DEFAULT_SECTION, PTS_SMP_FAILURE_CASE_KEY, 0); } static config_t *get_all(void) { return config; } Loading @@ -121,6 +126,7 @@ const stack_config_t interface = { get_pts_conn_updates_disabled, get_pts_crosskey_sdp_disable, get_pts_smp_options, get_pts_smp_failure_case, get_all }; Loading
system/stack/smp/smp_act.c +54 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,42 @@ static bool lmp_version_below(BD_ADDR bda, uint8_t version) return acl->lmp_version < version; } static bool pts_test_send_authentication_complete_failure(tSMP_CB *p_cb) { uint8_t reason = 0; if (p_cb->cert_failure < 2 || p_cb->cert_failure > 6) return false; SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure); switch (p_cb->cert_failure) { case 2: reason = SMP_PAIR_AUTH_FAIL; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 3: reason = SMP_PAIR_FAIL_UNKNOWN; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 4: reason = SMP_PAIR_NOT_SUPPORT; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 5: reason = SMP_PASSKEY_ENTRY_FAIL; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; case 6: reason = SMP_REPEATED_ATTEMPTS; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); break; } return true;; } /******************************************************************************* ** Function smp_update_key_mask ** Description This function updates the key mask for sending or receiving. Loading Loading @@ -550,6 +586,10 @@ void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) return; } // PTS Testing failure modes if (pts_test_send_authentication_complete_failure(p_cb)) return; if (p_cb->role == HCI_ROLE_SLAVE) { if (!(p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD)) Loading Loading @@ -1403,6 +1443,11 @@ void smp_process_io_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) { if (smp_request_oob_data(p_cb)) return; } // PTS Testing failure modes if (pts_test_send_authentication_complete_failure(p_cb)) return; smp_send_pair_rsp(p_cb, NULL); } } Loading Loading @@ -1638,6 +1683,14 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) SMP_TRACE_DEBUG("%s start ", __func__); // PTS Testing failure modes if (p_cb->cert_failure == 1) { SMP_TRACE_ERROR("%s failure case = %d", __func__, p_cb->cert_failure); reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); return; } switch(p_cb->selected_association_model) { case SMP_MODEL_SEC_CONN_JUSTWORKS: Loading Loading @@ -1671,7 +1724,7 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) break; case SMP_MODEL_SEC_CONN_PASSKEY_ENT: case SMP_MODEL_SEC_CONN_PASSKEY_DISP: if (!smp_check_commitment(p_cb)) if (!smp_check_commitment(p_cb) && p_cb->cert_failure != 9) { reason = p_cb->failure = SMP_CONFIRM_VALUE_ERR; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); Loading