diff --git a/src/ble/sm.c b/src/ble/sm.c index 9f8919982..e2b4d48b2 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -808,6 +808,7 @@ static void sm_setup_tk(void){ #else setup->sm_use_secure_connections = 0; #endif + log_info("Secure pairing: %u", setup->sm_use_secure_connections); // If both devices have not set the MITM option in the Authentication Requirements // Flags, then the IO capabilities shall be ignored and the Just Works association @@ -3873,6 +3874,12 @@ void sm_set_encryption_key_size_range(uint8_t min_size, uint8_t max_size){ } void sm_set_authentication_requirements(uint8_t auth_req){ +#ifndef ENABLE_LE_SECURE_CONNECTIONS + if (auth_req & SM_AUTHREQ_SECURE_CONNECTION){ + log_error("ENABLE_LE_SECURE_CONNECTIONS not defined, but requested by app. Dropping SC flag"); + auth_req &= ~SM_AUTHREQ_SECURE_CONNECTION; + } +#endif sm_auth_req = auth_req; }