Skip to content

Commit 55a4b86

Browse files
committed
host: sm: trigger CB upon error for pair request
Trigger callback upon error for pair request. This is required to verify the expected error status on the upper tester for some PTS tests cases.
1 parent c88bac0 commit 55a4b86

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

nimble/host/src/ble_sm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,15 +1840,19 @@ ble_sm_pair_req_rx(uint16_t conn_handle, struct os_mbuf **om,
18401840
if (conn->bhc_flags & BLE_HS_CONN_F_MASTER) {
18411841
res->sm_err = BLE_SM_ERR_CMD_NOT_SUPP;
18421842
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_CMD_NOT_SUPP);
1843+
res->enc_cb = 1;
18431844
} else if (MYNEWT_VAL(BLE_SM_LVL) == 1) {
18441845
res->sm_err = BLE_SM_ERR_CMD_NOT_SUPP;
18451846
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_CMD_NOT_SUPP);
1847+
res->enc_cb = 1;
18461848
} else if (req->max_enc_key_size < BLE_SM_PAIR_KEY_SZ_MIN) {
18471849
res->sm_err = BLE_SM_ERR_ENC_KEY_SZ;
18481850
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_ENC_KEY_SZ);
1851+
res->enc_cb = 1;
18491852
} else if (req->max_enc_key_size > BLE_SM_PAIR_KEY_SZ_MAX) {
18501853
res->sm_err = BLE_SM_ERR_INVAL;
18511854
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_INVAL);
1855+
res->enc_cb = 1;
18521856
} else if (MYNEWT_VAL(BLE_SM_SC_ONLY)) {
18531857
/* Fail if Secure Connections Only mode is on and remote does not
18541858
* meet key size requirements - MITM was checked in last step.
@@ -1857,13 +1861,16 @@ ble_sm_pair_req_rx(uint16_t conn_handle, struct os_mbuf **om,
18571861
if (!(req->authreq & BLE_SM_PAIR_AUTHREQ_SC)) {
18581862
res->sm_err = BLE_SM_ERR_AUTHREQ;
18591863
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_AUTHREQ);
1864+
res->enc_cb = 1;
18601865
} else if (req->max_enc_key_size != BLE_SM_PAIR_KEY_SZ_MAX) {
18611866
res->sm_err = BLE_SM_ERR_ENC_KEY_SZ;
18621867
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_ENC_KEY_SZ);
1868+
res->enc_cb = 1;
18631869
}
18641870
} else if (!ble_sm_verify_auth_requirements(req->authreq)) {
18651871
res->sm_err = BLE_SM_ERR_AUTHREQ;
18661872
res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_AUTHREQ);
1873+
res->enc_cb = 1;
18671874
} else {
18681875
/* The request looks good. Precalculate our pairing response and
18691876
* determine some properties of the imminent link. We need this

0 commit comments

Comments
 (0)