updated old key_ditribution type and fixed refs to pointers

pull/6188/head
paul-szczepanek-arm 2018-01-18 17:19:59 +00:00
parent dee47771fd
commit 779d6eb7ae
2 changed files with 40 additions and 32 deletions

View File

@ -57,7 +57,10 @@ public:
KeyDistribution() : _value(0) { }
KeyDistribution(uint8_t value) : _value(value) { }
KeyDistribution(bool encryption, bool identity, bool signing, bool link) : _value(0) {
KeyDistribution(bool encryption,
bool identity,
bool signing,
bool link) : _value(0) {
set_encryption(encryption);
set_identity(identity);
set_signing(signing);
@ -112,6 +115,7 @@ public:
uint8_t value() {
return _value;
}
private:
uint8_t _value;
};
@ -127,7 +131,10 @@ public:
AuthenticationMask() : _value(0) { }
AuthenticationMask(uint8_t value) : _value(value) { }
AuthenticationMask(bool bondable, bool mitm, bool secure_connections, bool keypress) : _value(0) {
AuthenticationMask(bool bondable,
bool mitm,
bool secure_connections,
bool keypress) : _value(0) {
set_bondable(bondable);
set_mitm(mitm);
set_secure_connections(secure_connections);
@ -182,6 +189,7 @@ public:
uint8_t value() {
return _value;
}
private:
uint8_t _value;
};

View File

@ -28,7 +28,6 @@ namespace generic {
using ble::pal::address_t;
using ble::pal::advertising_peer_address_type_t;
using ble::pal::key_distribution_t;
using ble::pal::irk_t;
using ble::pal::csrk_t;
using ble::pal::ltk_t;
@ -36,6 +35,7 @@ using ble::pal::ediv_t;
using ble::pal::rand_t;
using ble::pal::AuthenticationMask::AuthenticationFlags_t;
using ble::pal::AuthenticationMask;
using ble::pal::KeyDistribution;
using ble::pairing_failure_t;
typedef SecurityManager::SecurityIOCapabilities_t SecurityIOCapabilities_t;
@ -145,29 +145,29 @@ public:
*/
SecurityEntry_t* get_entry(connection_handle_t connection);
void get_entry_keys(SecurityEntryKeysDbCb_t cb, ediv_t ediv, rand_t rand);
void get_entry_identityt(SecurityEntryIdentityDbCb_t cb, address_t identity_address);
void get_entry_keys(SecurityEntryKeysDbCb_t cb, ediv_t *ediv, rand_t *rand);
void get_entry_identityt(SecurityEntryIdentityDbCb_t cb, address_t &identity_address);
void update_entry(connection_handle_t connection,
bool address_is_public,
address_t &peer_address,
ediv_t &ediv,
rand_t &rand,
ltk_t &ltk,
irk_t &irk,
csrk_t &csrk);
ediv_t *ediv,
rand_t *rand,
ltk_t *ltk,
irk_t *irk,
csrk_t *csrk);
void update_entry_ltk(connection_handle_t connection,
ltk_t &ltk);
ltk_t *ltk);
void update_entry_ediv_rand(connection_handle_t connection,
ediv_t &ediv,
rand_t &rand);
ediv_t *ediv,
rand_t *rand);
void update_entry_irk(connection_handle_t connection,
irk_t &irk);
irk_t *irk);
void update_entry_bdaddr(connection_handle_t connection,
bool address_is_public,
address_t &peer_address);
void update_entry_csrk(connection_handle_t connection,
csrk_t &csrk);
csrk_t *csrk);
void remove_entry(SecurityEntry_t&);
void clear_entries();
@ -487,8 +487,8 @@ private:
AuthenticationMask authentication;
uint8_t min_key_size;
uint8_t max_key_size;
key_distribution_t initiator_dist;
key_distribution_t responder_dist;
KeyDistribution initiator_dist;
KeyDistribution responder_dist;
/* implements ble::pal::SecurityManagerEventHandler */
public:
@ -502,8 +502,8 @@ public:
bool use_oob,
AuthenticationMask authentication,
uint8_t max_key_size,
key_distribution_t initiator_dist,
key_distribution_t responder_dist) {
KeyDistribution initiator_dist,
KeyDistribution responder_dist) {
if (_app_event_handler && pairing_authorisation_required) {
_app_event_handler->acceptPairingRequest(connection);
}
@ -569,7 +569,7 @@ public:
}
}
void on_legacy_pariring_oob_request(connection_handle_t connection) {
void on_legacy_pairing_oob_request(connection_handle_t connection) {
if (_app_event_handler) {
_app_event_handler->legacyPairingOobRequest(connection);
}
@ -588,11 +588,11 @@ public:
void on_keys_distributed(connection_handle_t connection,
advertising_peer_address_type_t peer_address_type,
address_t &peer_identity_address,
ediv_t &ediv,
rand_t &rand,
ltk_t &ltk,
irk_t &irk,
csrk_t &csrk) {
ediv_t *ediv,
rand_t *rand,
ltk_t *ltk,
irk_t *irk,
csrk_t *csrk) {
db.update_entry(
connection,
(peer_address_type == advertising_peer_address_type_t::PUBLIC_ADDRESS),
@ -606,18 +606,18 @@ public:
}
void on_keys_distributed_ltk(connection_handle_t connection,
ltk_t &ltk) {
ltk_t *ltk) {
db.update_entry_ltk(connection, ltk);
}
void on_keys_distributed_ediv_rand(connection_handle_t connection,
ediv_t &ediv,
rand_t &rand) {
ediv_t *ediv,
rand_t *rand) {
db.update_entry_ediv_rand(connection, ediv, rand);
}
void on_keys_distributed_irk(connection_handle_t connection,
irk_t &irk) {
irk_t *irk) {
db.update_entry_irk(connection, irk);
}
@ -632,13 +632,13 @@ public:
}
void on_keys_distributed_csrk(connection_handle_t connection,
csrk_t &csrk) {
csrk_t *csrk) {
db.update_entry_csrk(connection, csrk);
}
void on_ltk_request(connection_handle_t connection,
ediv_t &ediv,
rand_t &rand) {
ediv_t *ediv,
rand_t *rand) {
db.get_entry_keys(mbed::callback(this, &GenericSecurityManager::set_ltk_cb), ediv, rand);
}