sm: drop SC Auth Req Flag if ENABLE_LE_SECURE_CONNECTIONS is not defined

This commit is contained in:
Matthias Ringwald 2017-10-26 14:08:28 +02:00
parent 9635072ee4
commit 98d95509d1

View File

@ -808,6 +808,7 @@ static void sm_setup_tk(void){
#else #else
setup->sm_use_secure_connections = 0; setup->sm_use_secure_connections = 0;
#endif #endif
log_info("Secure pairing: %u", setup->sm_use_secure_connections);
// If both devices have not set the MITM option in the Authentication Requirements // 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 // 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){ 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; sm_auth_req = auth_req;
} }