diff --git a/nimble/host/src/ble_att_svr.c b/nimble/host/src/ble_att_svr.c index 0a03bcd38..1f97f82e2 100644 --- a/nimble/host/src/ble_att_svr.c +++ b/nimble/host/src/ble_att_svr.c @@ -2500,7 +2500,7 @@ ble_att_svr_rx_notify(uint16_t conn_handle, struct os_mbuf **rxom) /* All indications shall be confirmed, but only these with required * security established shall be pass to application */ - if (MYNEWT_VAL(BLE_SM_SC_LVL) >= 2 && !sec_state.encrypted) { + if (MYNEWT_VAL(BLE_SM_LVL) >= 2 && !sec_state.encrypted) { return 0; } @@ -2591,7 +2591,7 @@ ble_att_svr_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom) /* All indications shall be confirmed, but only these with required * security established shall be pass to application */ - if (MYNEWT_VAL(BLE_SM_SC_LVL) >= 2 && !sec_state.encrypted) { + if (MYNEWT_VAL(BLE_SM_LVL) >= 2 && !sec_state.encrypted) { goto done; } diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c index 5489551ae..fa14a3675 100644 --- a/nimble/host/src/ble_sm.c +++ b/nimble/host/src/ble_sm.c @@ -1737,10 +1737,10 @@ ble_sm_verify_auth_requirements(uint8_t cmd) return false; } } - /* Fail if Secure Connections level forces MITM protection and remote does not + /* Fail if security level forces MITM protection and remote does not * support it */ - if (MYNEWT_VAL(BLE_SM_SC_LVL) >= 3 && !(cmd & BLE_SM_PAIR_AUTHREQ_MITM)) { + if (MYNEWT_VAL(BLE_SM_LVL) >= 3 && !(cmd & BLE_SM_PAIR_AUTHREQ_MITM)) { return false; } return true; @@ -1823,7 +1823,7 @@ ble_sm_pair_req_rx(uint16_t conn_handle, struct os_mbuf **om, if (conn->bhc_flags & BLE_HS_CONN_F_MASTER) { res->sm_err = BLE_SM_ERR_CMD_NOT_SUPP; res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_CMD_NOT_SUPP); - } else if (MYNEWT_VAL(BLE_SM_SC_LVL) == 1) { + } else if (MYNEWT_VAL(BLE_SM_LVL) == 1) { res->sm_err = BLE_SM_ERR_CMD_NOT_SUPP; res->app_status = BLE_HS_SM_US_ERR(BLE_SM_ERR_CMD_NOT_SUPP); } else if (req->max_enc_key_size < BLE_SM_PAIR_KEY_SZ_MIN) { diff --git a/nimble/host/syscfg.yml b/nimble/host/syscfg.yml index 046624022..e9d984dc5 100644 --- a/nimble/host/syscfg.yml +++ b/nimble/host/syscfg.yml @@ -108,7 +108,7 @@ syscfg.defs: - 'BLE_SM_SC if 1' - '!BLE_SM_LEGACY if 1' - BLE_SM_SC_LVL: + BLE_SM_LVL: description: > Force global Secure Connections mode 1 level. This level describes requirements for pairing response/request received @@ -117,7 +117,8 @@ syscfg.defs: authentication requirements is granted - 2 - allow to pair despite MITM being on or off - 3 - allow to pair only when MITM protection is on - - 4 - allow to pair only when 128 bit key is used and MITM is on + - 4 - allow to pair only with Secure Connections and + when 128 bit key is used and MITM is on When set to 0 level is no forced and pairing is allowed for all requests/responses with valid values (for example pairing will be rejected with key longer than 128 bits). Successful pairing with diff --git a/porting/examples/linux/include/syscfg/syscfg.h b/porting/examples/linux/include/syscfg/syscfg.h index 14877d161..65aa24ebb 100644 --- a/porting/examples/linux/include/syscfg/syscfg.h +++ b/porting/examples/linux/include/syscfg/syscfg.h @@ -823,8 +823,8 @@ #define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) #endif -#ifndef MYNEWT_VAL_BLE_SM_SC_LVL -#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#ifndef MYNEWT_VAL_BLE_SM_LVL +#define MYNEWT_VAL_BLE_SM_LVL (0) #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY diff --git a/porting/examples/linux_blemesh/include/syscfg/syscfg.h b/porting/examples/linux_blemesh/include/syscfg/syscfg.h index 5fccff8a2..9fdaff3df 100644 --- a/porting/examples/linux_blemesh/include/syscfg/syscfg.h +++ b/porting/examples/linux_blemesh/include/syscfg/syscfg.h @@ -826,8 +826,8 @@ #define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) #endif -#ifndef MYNEWT_VAL_BLE_SM_SC_LVL -#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#ifndef MYNEWT_VAL_BLE_SM_LVL +#define MYNEWT_VAL_BLE_SM_LVL (0) #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY diff --git a/porting/examples/nuttx/include/syscfg/syscfg.h b/porting/examples/nuttx/include/syscfg/syscfg.h index 435b3aebc..fd9f45613 100644 --- a/porting/examples/nuttx/include/syscfg/syscfg.h +++ b/porting/examples/nuttx/include/syscfg/syscfg.h @@ -825,8 +825,8 @@ #define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) #endif -#ifndef MYNEWT_VAL_BLE_SM_SC_LVL -#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#ifndef MYNEWT_VAL_BLE_SM_LVL +#define MYNEWT_VAL_BLE_SM_LVL (0) #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY diff --git a/porting/nimble/include/syscfg/syscfg.h b/porting/nimble/include/syscfg/syscfg.h index ba2a292d7..a3602308f 100644 --- a/porting/nimble/include/syscfg/syscfg.h +++ b/porting/nimble/include/syscfg/syscfg.h @@ -822,8 +822,8 @@ #define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) #endif -#ifndef MYNEWT_VAL_BLE_SM_SC_LVL -#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#ifndef MYNEWT_VAL_BLE_SM_LVL +#define MYNEWT_VAL_BLE_SM_LVL (0) #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY diff --git a/porting/npl/riot/include/syscfg/syscfg.h b/porting/npl/riot/include/syscfg/syscfg.h index 84bdea5ef..2d5f4b2ee 100644 --- a/porting/npl/riot/include/syscfg/syscfg.h +++ b/porting/npl/riot/include/syscfg/syscfg.h @@ -1584,8 +1584,8 @@ #define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0) #endif -#ifndef MYNEWT_VAL_BLE_SM_SC_LVL -#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#ifndef MYNEWT_VAL_BLE_SM_LVL +#define MYNEWT_VAL_BLE_SM_LVL (0) #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY