BLE - Devirtualize pal::SecurityManager

The event handler has been extracted out of SecurityManager declaration and instantion of the interface requires the implementation and event handler type.
pull/9727/head
Vincent Coubard 2019-02-25 18:58:20 +00:00
parent e1371f8149
commit 50de4c8a44
1 changed files with 581 additions and 388 deletions

View File

@ -17,6 +17,7 @@
#ifndef MBED_OS_FEATURES_FEATURE_BLE_BLE_PAL_PALSM_H_
#define MBED_OS_FEATURES_FEATURE_BLE_BLE_PAL_PALSM_H_
#include "ble/common/StaticInterface.h"
#include "platform/Callback.h"
#include "platform/NonCopyable.h"
#include "ble/BLETypes.h"
@ -201,15 +202,15 @@ private:
uint8_t _value;
};
/**
* Adaptation layer of the Security Manager.
*/
class SecurityManager : private mbed::NonCopyable<SecurityManager> {
public:
/**
* Handle events generated by ble::pal::SecurityManager
*/
class EventHandler {
template<class Impl>
class SecurityManagerEventHandler :
public StaticInterface<Impl, SecurityManagerEventHandler>
{
using StaticInterface<Impl, ble::pal::SecurityManagerEventHandler>::impl;
public:
////////////////////////////////////////////////////////////////////////////
// Pairing
@ -226,13 +227,21 @@ public:
* @param[in] initiator_dist key distribution
* @param[in] responder_dist key distribution
*/
virtual void on_pairing_request(
void on_pairing_request(
connection_handle_t connection,
bool oob_data_flag,
AuthenticationMask authentication_requirements,
KeyDistribution initiator_dist,
KeyDistribution responder_dist
) = 0;
) {
impl()->on_pairing_request_(
connection,
oob_data_flag,
authentication_requirements,
initiator_dist,
responder_dist
);
}
/**
* Indicate that the pairing has failed.
@ -242,28 +251,34 @@ public:
* @param[in] connection connection handle
* @param[in] error reason for the failed pairing
*/
virtual void on_pairing_error(
void on_pairing_error(
connection_handle_t connection,
pairing_failure_t error
) = 0;
) {
impl()->on_pairing_error_(connection, error);
}
/**
* Indicate that the pairing has timed out.
*
* @param[in] connection connection handle
*/
virtual void on_pairing_timed_out(
void on_pairing_timed_out(
connection_handle_t connection
) = 0;
) {
impl()->on_pairing_timed_out_(connection);
}
/**
* Indicate that the pairing for the link has completed.
*
* @param[in] connection connection handle
*/
virtual void on_pairing_completed(
void on_pairing_completed(
connection_handle_t connection
) = 0;
) {
impl()->on_pairing_completed_(connection);
}
////////////////////////////////////////////////////////////////////////////
// Security
@ -276,9 +291,11 @@ public:
* @param[in] connection connection handle
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B, 5.4
*/
virtual void on_valid_mic_timeout(
void on_valid_mic_timeout(
connection_handle_t connection
) = 0;
) {
impl()->on_valid_mic_timeout_(connection);
}
/**
* Ask the stack to evaluate the security request received from the slave.
@ -287,10 +304,12 @@ public:
* @param[in] connection connection handle
* @param[in] authentication authentication requirements from the slave
*/
virtual void on_slave_security_request(
void on_slave_security_request(
connection_handle_t connection,
AuthenticationMask authentication
) = 0;
) {
impl()->on_slave_security_request_(connection, authentication);
}
////////////////////////////////////////////////////////////////////////////
// Encryption
@ -304,19 +323,23 @@ public:
* @param[in] connection connection handle
* @param[in] result encryption state of the link
*/
virtual void on_link_encryption_result(
void on_link_encryption_result(
connection_handle_t connection,
link_encryption_t result
) = 0;
) {
impl()->on_link_encryption_result_(connection, result);
}
/**
* Indicate that the encryption request failed due to timeout.
*
* @param[in] connection connection handle
*/
virtual void on_link_encryption_request_timed_out(
void on_link_encryption_request_timed_out(
connection_handle_t connection
) = 0;
) {
impl()->on_link_encryption_request_timed_out_(connection);
}
////////////////////////////////////////////////////////////////////////////
// MITM
@ -328,10 +351,15 @@ public:
* @param[in] connection connection handle
* @param[in] passkey passkey to be displayed
*/
virtual void on_passkey_display(
void on_passkey_display(
connection_handle_t connection,
passkey_num_t passkey
) = 0;
) {
impl()->on_passkey_display_(
connection,
passkey
);
}
/**
* Indicate that user confirmation is required to confirm matching
@ -340,9 +368,11 @@ public:
* @param[in] connection connection handle
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E, 7.7.42
*/
virtual void on_confirmation_request(
void on_confirmation_request(
connection_handle_t connection
) = 0;
) {
impl()->on_confirmation_request_(connection);
}
/**
* Request the passkey entered during pairing.
@ -351,9 +381,11 @@ public:
* @param[in] connection connection handle
* or a cancellation of the procedure.
*/
virtual void on_passkey_request(
void on_passkey_request(
connection_handle_t connection
) = 0;
) {
impl()->on_passkey_request_(connection);
}
/**
* Indicate that a key has been pressed by the peer.
@ -362,10 +394,12 @@ public:
* @param[in] keypress type of keypress event
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part H, 3.5.8
*/
virtual void on_keypress_notification(
void on_keypress_notification(
connection_handle_t connection,
Keypress_t keypress
) = 0;
) {
impl()->on_keypress_notification_(connection, keypress);
}
/**
* Request OOB data from the user application.
@ -374,9 +408,11 @@ public:
* @note shall be followed by: pal::SecurityManager::secure_connections_oob_request_reply
* or a cancellation of the procedure.
*/
virtual void on_secure_connections_oob_request(
void on_secure_connections_oob_request(
connection_handle_t connection
) = 0;
) {
impl()->on_secure_connections_oob_request_(connection);
}
/**
* Request OOB data from the user application.
@ -385,9 +421,11 @@ public:
* @note shall be followed by: pal::SecurityManager::legacy_pairing_oob_request_reply
* or a cancellation of the procedure.
*/
virtual void on_legacy_pairing_oob_request(
void on_legacy_pairing_oob_request(
connection_handle_t connection
) = 0;
) {
impl()->on_legacy_pairing_oob_request_(connection);
}
/**
* Send OOB data to the application for transport to the peer.
@ -398,10 +436,12 @@ public:
* in secure connections pairing
* @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
*/
virtual void on_secure_connections_oob_generated(
void on_secure_connections_oob_generated(
const oob_lesc_value_t &random,
const oob_confirm_t &confirm
) = 0;
) {
impl()->on_secure_connections_oob_generated_(random, confirm);
}
////////////////////////////////////////////////////////////////////////////
// Keys
@ -414,10 +454,12 @@ public:
* @param[in] connection connection handle
* @param[in] ltk long term key from the peer
*/
virtual void on_secure_connections_ltk_generated(
void on_secure_connections_ltk_generated(
connection_handle_t connection,
const ltk_t &ltk
) = 0;
) {
impl()->on_secure_connections_ltk_generated_(connection, ltk);
}
/**
* Store the results of key distribution after LTK has been received.
@ -425,10 +467,12 @@ public:
* @param[in] connection connection handle
* @param[in] ltk long term key from the peer
*/
virtual void on_keys_distributed_ltk(
void on_keys_distributed_ltk(
connection_handle_t connection,
const ltk_t &ltk
) = 0;
) {
impl()->on_keys_distributed_ltk_(connection, ltk);
}
/**
* Store the results of key distribution after EDIV and RAND has been received.
@ -436,11 +480,13 @@ public:
* @param[in] connection connection handle
* @param[in] ltk long term key from the peer
*/
virtual void on_keys_distributed_ediv_rand(
void on_keys_distributed_ediv_rand(
connection_handle_t connection,
const ediv_t &ediv,
const rand_t &rand
) = 0;
) {
impl()->on_keys_distributed_ediv_rand_(connection, ediv, rand);
}
/**
* Store the local key, if we are slave now or in the future
@ -449,10 +495,12 @@ public:
* @param[in] connection connection handle
* @param[in] ltk key sent to the peer
*/
virtual void on_keys_distributed_local_ltk(
void on_keys_distributed_local_ltk(
connection_handle_t connection,
const ltk_t &ltk
) = 0;
) {
impl()->on_keys_distributed_local_ltk_(connection, ltk);
}
/**
* Store the EDIV and RAND that will be used to identify
@ -464,11 +512,13 @@ public:
* @param[in] ediv identifies LTK
* @param[in] rand identifies LTK
*/
virtual void on_keys_distributed_local_ediv_rand(
void on_keys_distributed_local_ediv_rand(
connection_handle_t connection,
const ediv_t &ediv,
const rand_t &rand
) = 0;
) {
impl()->on_keys_distributed_local_ediv_rand_(connection, ediv, rand);
}
/**
* Store the results of key distribution after IRK has been received.
@ -476,10 +526,12 @@ public:
* @param[in] connection connection handle
* @param[in] irk identity resolution key
*/
virtual void on_keys_distributed_irk(
void on_keys_distributed_irk(
connection_handle_t connection,
const irk_t &irk
) = 0;
) {
impl()->on_keys_distributed_irk_(connection, irk);
}
/**
* Store the identity address of the peer after it has been distributed.
@ -488,11 +540,13 @@ public:
* @param[in] peer_identity_address_type public or private address indication
* @param[in] peer_identity_address peer address
*/
virtual void on_keys_distributed_bdaddr(
void on_keys_distributed_bdaddr(
connection_handle_t connection,
advertising_peer_address_type_t peer_identity_address_type,
const address_t &peer_identity_address
) = 0;
) {
impl()->on_keys_distributed_bdaddr_(connection, peer_identity_address_type, peer_identity_address);
}
/**
* Store the peer's CSRK after it has been distributed.
@ -500,10 +554,12 @@ public:
* @param[in] connection connection handle
* @param[in] csrk signing key
*/
virtual void on_keys_distributed_csrk(
void on_keys_distributed_csrk(
connection_handle_t connection,
const csrk_t &csrk
) = 0;
) {
impl()->on_keys_distributed_csrk_(connection, csrk);
}
/**
* Request the LTK since the peer is asking us to encrypt the link. We need to
@ -514,11 +570,13 @@ public:
* @param[in] ediv identifies LTK
* @param[in] rand identifies LTK
*/
virtual void on_ltk_request(
void on_ltk_request(
connection_handle_t connection,
const ediv_t &ediv,
const rand_t &rand
) = 0;
) {
impl()->on_ltk_request_(connection, ediv, rand);
}
/**
* Request the LTK since the peer is asking us to encrypt the link.
@ -527,15 +585,28 @@ public:
*
* @param[in] connection connection handle
*/
virtual void on_ltk_request(
void on_ltk_request(
connection_handle_t connection
) = 0;
) {
impl()->on_ltk_request_(connection);
}
};
/**
* Adaptation layer of the Security Manager.
*/
template<class Impl, class EventHandler>
class SecurityManager : private mbed::NonCopyable<SecurityManager<Impl, EventHandler> > {
Impl* impl() {
return static_cast<Impl*>(this);
}
public:
SecurityManager() : _pal_event_handler(NULL) { };
virtual ~SecurityManager() { };
~SecurityManager() { };
////////////////////////////////////////////////////////////////////////////
// SM lifecycle management
@ -546,21 +617,27 @@ public:
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t initialize() = 0;
ble_error_t initialize() {
return impl()->initialize_();
}
/**
* Finalise all actions. Called before shutdown.
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t terminate() = 0;
ble_error_t terminate() {
return impl()->terminate_();
}
/**
* Reset to same state as after initialize.
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t reset() = 0;
ble_error_t reset() {
return impl()->reset_();
}
////////////////////////////////////////////////////////////////////////////
// Resolving list management
@ -575,7 +652,9 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E: 7.8.41
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual uint8_t read_resolving_list_capacity() = 0;
uint8_t read_resolving_list_capacity() {
return impl()->read_resolving_list_capacity_();
}
/**
* Add a device definition into the resolving list of the LE subsystem.
@ -586,11 +665,17 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E: 7.8.38
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t add_device_to_resolving_list(
ble_error_t add_device_to_resolving_list(
advertising_peer_address_type_t peer_identity_address_type,
const address_t &peer_identity_address,
const irk_t &peer_irk
) = 0;
) {
return impl()->add_device_to_resolving_list_(
peer_identity_address_type,
peer_identity_address,
peer_irk
);
}
/**
* Add a device definition from the resolving list of the LE subsystem.
@ -600,10 +685,15 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E: 7.8.39
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t remove_device_from_resolving_list(
ble_error_t remove_device_from_resolving_list(
advertising_peer_address_type_t peer_identity_address_type,
const address_t &peer_identity_address
) = 0;
) {
return impl()->remove_device_from_resolving_list_(
peer_identity_address_type,
peer_identity_address
);
}
/**
* Remove all devices from the resolving list.
@ -611,7 +701,9 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E: 7.8.40
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t clear_resolving_list() = 0;
ble_error_t clear_resolving_list() {
return impl()->clear_resolving_list_();
}
////////////////////////////////////////////////////////////////////////////
// Pairing
@ -628,13 +720,21 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part H - 3.5.1
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t send_pairing_request(
ble_error_t send_pairing_request(
connection_handle_t connection,
bool oob_data_flag,
AuthenticationMask authentication_requirements,
KeyDistribution initiator_dist,
KeyDistribution responder_dist
) = 0;
) {
return impl()->send_pairing_request_(
connection,
oob_data_flag,
authentication_requirements,
initiator_dist,
responder_dist
);
}
/**
* Send a pairing response to a master.
@ -647,13 +747,21 @@ public:
* @param[in] responder_dist key distribution
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t send_pairing_response(
ble_error_t send_pairing_response(
connection_handle_t connection,
bool oob_data_flag,
AuthenticationMask authentication_requirements,
KeyDistribution initiator_dist,
KeyDistribution responder_dist
) = 0;
) {
return impl()->send_pairing_response_(
connection,
oob_data_flag,
authentication_requirements,
initiator_dist,
responder_dist
);
}
/**
* Cancel an ongoing pairing.
@ -663,10 +771,15 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part H - 3.5.5
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t cancel_pairing(
ble_error_t cancel_pairing(
connection_handle_t connection,
pairing_failure_t reason
) = 0;
) {
return impl()->cancel_pairing_(
connection,
reason
);
}
////////////////////////////////////////////////////////////////////////////
// Feature support
@ -678,9 +791,11 @@ public:
* @param[out] enabled true if SC are supported
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t get_secure_connections_support(
ble_error_t get_secure_connections_support(
bool &enabled
) = 0;
) {
return impl()->get_secure_connections_support_(enabled);
}
/**
* Set the IO capability that will be used during pairing feature exchange.
@ -688,9 +803,11 @@ public:
* @param[in] io_capability type of IO capabilities available on the local device
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_io_capability(
ble_error_t set_io_capability(
io_capability_t io_capability
) = 0;
) {
return impl()->set_io_capability_(io_capability);
}
////////////////////////////////////////////////////////////////////////////
// Security settings
@ -704,10 +821,15 @@ public:
* @param[in] timeout_in_10ms time measured in units of 10 milliseconds
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_authentication_timeout(
ble_error_t set_authentication_timeout(
connection_handle_t connection,
uint16_t timeout_in_10ms
) = 0;
) {
return impl()->set_authentication_timeout_(
connection,
timeout_in_10ms
);
}
/**
* Get the time after which an event will be generated unless we received a packet with
@ -717,10 +839,15 @@ public:
* @param[out] timeout_in_10ms time measured in units of 10 milliseconds
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t get_authentication_timeout(
ble_error_t get_authentication_timeout(
connection_handle_t connection,
uint16_t &timeout_in_10ms
) = 0;
) {
return impl()->get_authentication_timeout_(
connection,
timeout_in_10ms
);
}
/**
* Set the key size boundaries that will be used during pairing feature
@ -735,10 +862,15 @@ public:
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_encryption_key_requirements(
ble_error_t set_encryption_key_requirements(
uint8_t min_encryption_key_size,
uint8_t max_encryption_key_size
) = 0;
) {
return impl()->set_encryption_key_requirements_(
min_encryption_key_size,
max_encryption_key_size
);
}
/**
* Request change of security level from the master. This is called by the slave when
@ -750,10 +882,15 @@ public:
* @param[in] authentication authentication requirements
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t slave_security_request(
ble_error_t slave_security_request(
connection_handle_t connection,
AuthenticationMask authentication
) = 0;
) {
return impl()->slave_security_request_(
connection,
authentication
);
}
////////////////////////////////////////////////////////////////////////////
// Encryption
@ -771,13 +908,21 @@ public:
* @param[in] mitm does the LTK have man in the middle protection
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t enable_encryption(
ble_error_t enable_encryption(
connection_handle_t connection,
const ltk_t &ltk,
const rand_t &rand,
const ediv_t &ediv,
bool mitm
) = 0;
) {
return impl()->enable_encryption_(
connection,
ltk,
rand,
ediv,
mitm
);
}
/**
* Enabled encryption using the LTK given on a connection established with secure
@ -788,11 +933,17 @@ public:
* @param[in] mitm does the LTK have man in the middle protection
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t enable_encryption(
ble_error_t enable_encryption(
connection_handle_t connection,
const ltk_t &ltk,
bool mitm
) = 0;
) {
return impl()->enable_encryption_(
connection,
ltk,
mitm
);
}
/**
* Encrypt data with a given key. This uses the facility on the controller to
@ -802,18 +953,22 @@ public:
* @param[in,out] data data to be encrypted, if successful contains the result
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t encrypt_data(
ble_error_t encrypt_data(
const byte_array_t<16> &key,
encryption_block_t &data
) = 0;
) {
return impl()->encrypt_data_(key, data);
}
////////////////////////////////////////////////////////////////////////////
// Privacy
//
virtual ble_error_t set_private_address_timeout(
ble_error_t set_private_address_timeout(
uint16_t timeout_in_seconds
) = 0;
) {
return impl()->set_private_address_timeout(timeout_in_seconds);
}
////////////////////////////////////////////////////////////////////////////
// Keys
@ -828,12 +983,14 @@ public:
* @param[in] secure_connections is this a secure_connections pairing
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_ltk(
ble_error_t set_ltk(
connection_handle_t connection,
const ltk_t &ltk,
bool mitm,
bool secure_connections
) = 0;
) {
return impl()->set_ltk_(connection, ltk, mitm, secure_connections);
}
/**
* Inform the stack we don't have the LTK.
@ -841,9 +998,11 @@ public:
* @param[in] connection connection handle
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_ltk_not_found(
ble_error_t set_ltk_not_found(
connection_handle_t connection
) = 0;
) {
return impl()->set_ltk_not_found_(connection);
}
/**
* Set the local IRK.
@ -851,9 +1010,11 @@ public:
* @param[in] irk identity resolution key
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_irk(
ble_error_t set_irk(
const irk_t &irk
) = 0;
) {
return impl()->set_irk_(irk);
}
/**
* Set the local CSRK.
@ -862,10 +1023,12 @@ public:
* @param[in] sign_counter local signing counter
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_csrk(
ble_error_t set_csrk(
const csrk_t &csrk,
sign_count_t sign_counter
) = 0;
) {
return impl()->set_csrk_(csrk, sign_counter);
}
/**
* Set the peer CSRK for particular connection.
@ -876,14 +1039,23 @@ public:
* @param[in] sign_counter signing counter
* @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_peer_csrk(
ble_error_t set_peer_csrk(
connection_handle_t connection,
const csrk_t &csrk,
bool authenticated,
sign_count_t sign_counter
) = 0;
) {
return impl()->set_peer_csrk_(
connection,
csrk,
authenticated,
sign_counter
);
}
virtual ble_error_t remove_peer_csrk(connection_handle_t connection) = 0;
ble_error_t remove_peer_csrk(connection_handle_t connection) {
return impl()->remove_peer_csrk_(connection);
}
////////////////////////////////////////////////////////////////////////////
// Authentication
@ -896,9 +1068,11 @@ public:
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part H 2
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t get_random_data(
ble_error_t get_random_data(
byte_array_t<8> &random_data
) = 0;
) {
return impl()->get_random_data_(random_data);
}
////////////////////////////////////////////////////////////////////////////
// MITM
@ -924,19 +1098,23 @@ public:
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t set_display_passkey(
ble_error_t set_display_passkey(
passkey_num_t passkey
) = 0;
) {
return impl()->set_display_passkey_(passkey);
}
/**
* Reply to a passkey request received from the SecurityManagerEventHandler.
*
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t passkey_request_reply(
ble_error_t passkey_request_reply(
connection_handle_t connection,
passkey_num_t passkey
) = 0;
) {
return impl()->passkey_request_reply_(connection, passkey);
}
/**
* Reply to a Secure Connections oob data request received from the SecurityManagerEventHandler.
@ -948,12 +1126,19 @@ public:
* in secure connections pairing
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t secure_connections_oob_request_reply(
ble_error_t secure_connections_oob_request_reply(
connection_handle_t connection,
const oob_lesc_value_t &local_random,
const oob_lesc_value_t &peer_random,
const oob_confirm_t &peer_confirm
) = 0;
) {
return impl()->secure_connections_oob_request_reply_(
connection,
local_random,
peer_random,
peer_confirm
);
}
/**
* Reply to a legacy pairing oob data request received from the SecurityManagerEventHandler.
@ -962,10 +1147,12 @@ public:
* @param[in] oob_data pointer to out of band data
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t legacy_pairing_oob_request_reply(
ble_error_t legacy_pairing_oob_request_reply(
connection_handle_t connection,
const oob_tk_t &oob_data
) = 0;
) {
return impl()->legacy_pairing_oob_request_reply_(connection, oob_data);
}
/**
* Notify the stack that the user has confirmed the values during numerical
@ -975,10 +1162,12 @@ public:
* @param[in] confirmation true if the user indicated the numbers match
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t confirmation_entered(
ble_error_t confirmation_entered(
connection_handle_t connection,
bool confirmation
) = 0;
) {
return impl()->confirmation_entered_(connection, confirmation);
}
/**
* Notify the stack that the user pressed a key. This will be sent to the peer and create
@ -988,16 +1177,20 @@ public:
* @param[in] keypress type of keypress event
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t send_keypress_notification(
ble_error_t send_keypress_notification(
connection_handle_t connection,
Keypress_t keypress
) = 0;
) {
return impl()->send_keypress_notification_(connection, keypress);
}
/**
* Generate local OOB data to be sent to the application which sends it to the peer.
* @return BLE_ERROR_NONE On success, else an error code indicating reason for failure
*/
virtual ble_error_t generate_secure_connections_oob() = 0;
ble_error_t generate_secure_connections_oob() {
return impl()->generate_secure_connections_oob_();
}
/* Entry points for the underlying stack to report events back to the user. */
public: