mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-07 09:55:45 +00:00
fix crash in slave role when storing CSRK
This commit is contained in:
parent
5a0c4351ec
commit
6b724e3cd7
11
ble/sm.c
11
ble/sm.c
@ -1028,7 +1028,14 @@ static void sm_key_distribution_handle_all_received(sm_connection_t * sm_conn){
|
||||
if (le_db_index >= 0){
|
||||
le_device_db_local_counter_set(le_db_index, 0);
|
||||
|
||||
// store CSRK
|
||||
// store local CSRK
|
||||
if (setup->sm_key_distribution_send_set & SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION){
|
||||
log_info("sm: store local CSRK");
|
||||
le_device_db_local_csrk_set(le_db_index, setup->sm_local_csrk);
|
||||
le_device_db_local_counter_set(le_db_index, 0);
|
||||
}
|
||||
|
||||
// store remote CSRK
|
||||
if (setup->sm_key_distribution_received_set & SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION){
|
||||
log_info("sm: store remote CSRK");
|
||||
le_device_db_remote_csrk_set(le_db_index, setup->sm_peer_csrk);
|
||||
@ -1530,8 +1537,6 @@ static void sm_run(void){
|
||||
|
||||
uint8_t buffer[17];
|
||||
buffer[0] = SM_CODE_SIGNING_INFORMATION;
|
||||
log_info("sm: store local CSRK");
|
||||
le_device_db_local_csrk_set(connection->sm_le_db_index, setup->sm_local_csrk);
|
||||
swap128(setup->sm_local_csrk, &buffer[1]);
|
||||
l2cap_send_connectionless(connection->sm_handle, L2CAP_CID_SECURITY_MANAGER_PROTOCOL, (uint8_t*) buffer, sizeof(buffer));
|
||||
sm_timeout_reset(connection);
|
||||
|
Loading…
Reference in New Issue
Block a user