mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
sm: abort pairing if bonding information is not deleted in re-erncryption failed handler with ENABLE_LE_PROACTIVE_AUTHENTICATION
This commit is contained in:
parent
9b75de03b9
commit
19a4077283
17
src/ble/sm.c
17
src/ble/sm.c
@ -2668,15 +2668,30 @@ static void sm_run(void){
|
|||||||
have_ltk = !sm_is_null_key(ltk);
|
have_ltk = !sm_is_null_key(ltk);
|
||||||
if (have_ltk){
|
if (have_ltk){
|
||||||
log_info("pairing request but LTK available");
|
log_info("pairing request but LTK available");
|
||||||
// emit re-ecnryption start/fail sequence
|
// emit re-encryption start/fail sequence
|
||||||
sm_reencryption_started(connection);
|
sm_reencryption_started(connection);
|
||||||
sm_reencryption_complete(connection, ERROR_CODE_PIN_OR_KEY_MISSING);
|
sm_reencryption_complete(connection, ERROR_CODE_PIN_OR_KEY_MISSING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
have_ltk = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_LE_PROACTIVE_AUTHENTICATION
|
||||||
|
// Reject pairing if we (still) have LTK
|
||||||
|
if (have_ltk){
|
||||||
|
memset(ltk, 0, 16);
|
||||||
|
le_device_db_encryption_get(connection->sm_le_db_index, NULL, NULL, ltk, NULL, NULL, NULL, NULL);
|
||||||
|
have_ltk = !sm_is_null_key(ltk);
|
||||||
|
if (have_ltk){
|
||||||
|
connection->sm_le_db_index = -1;
|
||||||
|
sm_pairing_error(connection, SM_REASON_UNSPECIFIED_REASON);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sm_init_setup(connection);
|
sm_init_setup(connection);
|
||||||
sm_pairing_started(connection);
|
sm_pairing_started(connection);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user