sm: use ltk from db for sc in initiator role

This commit is contained in:
Matthias Ringwald 2016-06-27 14:56:08 +02:00
parent 02bdfbf8cb
commit d2e9012210

View File

@ -1175,7 +1175,7 @@ static void sm_address_resolution_handle_event(address_resolution_event_t event)
hci_con_handle_t con_handle = 0; hci_con_handle_t con_handle = 0;
sm_connection_t * sm_connection; sm_connection_t * sm_connection;
uint16_t ediv; sm_key_t ltk;
switch (mode){ switch (mode){
case ADDRESS_RESOLUTION_GENERAL: case ADDRESS_RESOLUTION_GENERAL:
break; break;
@ -1191,8 +1191,8 @@ static void sm_address_resolution_handle_event(address_resolution_event_t event)
if (!sm_connection->sm_bonding_requested && !sm_connection->sm_security_request_received) break; if (!sm_connection->sm_bonding_requested && !sm_connection->sm_security_request_received) break;
sm_connection->sm_security_request_received = 0; sm_connection->sm_security_request_received = 0;
sm_connection->sm_bonding_requested = 0; sm_connection->sm_bonding_requested = 0;
le_device_db_encryption_get(sm_connection->sm_le_db_index, &ediv, NULL, NULL, NULL, NULL, NULL); le_device_db_encryption_get(sm_connection->sm_le_db_index, NULL, NULL, ltk, NULL, NULL, NULL);
if (ediv){ if (!sm_is_null_key(ltk)){
sm_connection->sm_engine_state = SM_INITIATOR_PH0_HAS_LTK; sm_connection->sm_engine_state = SM_INITIATOR_PH0_HAS_LTK;
} else { } else {
sm_connection->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST; sm_connection->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST;