ltk for secure connections

pull/6188/head
paul-szczepanek-arm 2018-02-06 21:50:57 +00:00
parent 3236eada5e
commit 1446142b60
3 changed files with 32 additions and 0 deletions

View File

@ -387,6 +387,11 @@ public:
// Keys
//
virtual void on_secure_connections_ltk_generated(
connection_handle_t connection,
const ltk_t *ltk
);
virtual void on_keys_distributed(
connection_handle_t connection,
advertising_peer_address_type_t peer_address_type,

View File

@ -366,6 +366,18 @@ public:
// Keys
//
/**
* Store the results of key generation of the stage 2 of secure connections pairing
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part H - 2.3.5.6.5
*
* @param[in] connection connection handle
* @param[in] ltk long term key from the peer
*/
virtual void on_secure_connections_ltk_generated(
connection_handle_t connection,
const ltk_t *ltk
) = 0;
/**
* Store the results of key distribution after all the keys have been received.
*

View File

@ -801,6 +801,21 @@ void GenericSecurityManager::on_oob_request(connection_handle_t connection) {
// Keys
//
void GenericSecurityManager::on_secure_connections_ltk_generated(
connection_handle_t connection,
const ltk_t *ltk
) {
SecurityEntry_t *entry = _db.get_entry(connection);
if (!entry) {
return;
}
entry->mitm_ltk = entry->mitm_performed;
entry->secure_connections = true;
_db.set_entry_peer_ltk(connection, ltk);
}
void GenericSecurityManager::on_keys_distributed(
connection_handle_t connection,
advertising_peer_address_type_t peer_address_type,