@@ -213,17 +213,6 @@ class SecurityManager {
213
213
SECURITY_MODE_SIGNED_WITH_MITM, /* *< Require signing or encryption, and MITM protection. */
214
214
};
215
215
216
- /* *
217
- * @brief Defines possible security status or states.
218
- *
219
- * @details Defines possible security status or states of a link when requested by getLinkSecurity().
220
- */
221
- enum LinkSecurityStatus_t {
222
- NOT_ENCRYPTED, /* *< The link is not secured. */
223
- ENCRYPTION_IN_PROGRESS, /* *< Link security is being established.*/
224
- ENCRYPTED /* *< The link is secure.*/
225
- };
226
-
227
216
/* * Input/output capability of the device and application */
228
217
enum SecurityIOCapabilities_t {
229
218
IO_CAPS_DISPLAY_ONLY = 0x00 , /* *< Display only. */
@@ -263,13 +252,6 @@ class SecurityManager {
263
252
typedef FunctionPointerWithContext<const SecurityManager *> SecurityManagerShutdownCallback_t;
264
253
typedef CallChainOfFunctionPointersWithContext<const SecurityManager *> SecurityManagerShutdownCallbackChain_t;
265
254
266
- /* legacy callbacks, please use SecurityManagerEventHandler instead */
267
- typedef void (*HandleSpecificEvent_t)(ble::connection_handle_t connectionHandle);
268
- typedef void (*SecuritySetupInitiatedCallback_t)(ble::connection_handle_t , bool allowBonding, bool requireMITM, SecurityIOCapabilities_t iocaps);
269
- typedef void (*SecuritySetupCompletedCallback_t)(ble::connection_handle_t , SecurityCompletionStatus_t status);
270
- typedef void (*LinkSecuredCallback_t)(ble::connection_handle_t connectionHandle, SecurityMode_t securityMode);
271
- typedef void (*PasskeyDisplayCallback_t)(ble::connection_handle_t connectionHandle, const Passkey_t passkey);
272
-
273
255
/* * The stack will use these functions to signal events to the application,
274
256
* subclass to override handlers. Use SecurityManager::setSecurityManagerEventHandler
275
257
* to set the interface implementation to be used. */
@@ -880,141 +862,6 @@ class SecurityManager {
880
862
881
863
~SecurityManager () { };
882
864
883
- public:
884
- /* *
885
- * @deprecated use generateWhitelistFromBondTable instead
886
- *
887
- * Get a list of addresses from all peers in the bond table.
888
- *
889
- * @param[in,out] addresses
890
- * (on input) addresses.capacity contains the maximum
891
- * number of addresses to be returned.
892
- * (on output) The populated table with copies of the
893
- * addresses in the implementation's whitelist.
894
- *
895
- * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure.
896
- * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization or
897
- * application registration.
898
- */
899
- ble_error_t getAddressesFromBondTable (::Gap::Whitelist_t &addresses) const ;
900
-
901
- /* *
902
- * @deprecated
903
- *
904
- * Get the security status of a connection.
905
- *
906
- * @param[in] connectionHandle Handle to identify the connection.
907
- * @param[out] securityStatus Security status.
908
- *
909
- * @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
910
- */
911
- ble_error_t getLinkSecurity (ble::connection_handle_t connectionHandle, LinkSecurityStatus_t *securityStatus) {
912
- ble::link_encryption_t encryption (ble::link_encryption_t ::NOT_ENCRYPTED);
913
- ble_error_t err = getLinkEncryption (connectionHandle, &encryption);
914
- if (err) {
915
- return err;
916
- }
917
-
918
- switch (encryption.value ()) {
919
- case ble::link_encryption_t ::NOT_ENCRYPTED:
920
- *securityStatus = NOT_ENCRYPTED;
921
- break ;
922
- case ble::link_encryption_t ::ENCRYPTION_IN_PROGRESS:
923
- *securityStatus = ENCRYPTION_IN_PROGRESS;
924
- break ;
925
- case ble::link_encryption_t ::ENCRYPTED:
926
- case ble::link_encryption_t ::ENCRYPTED_WITH_MITM:
927
- case ble::link_encryption_t ::ENCRYPTED_WITH_SC_AND_MITM:
928
- *securityStatus = ENCRYPTED;
929
- break ;
930
- default :
931
- // should never happen
932
- MBED_ASSERT (false );
933
- *securityStatus = NOT_ENCRYPTED;
934
- break ;
935
- }
936
-
937
- return BLE_ERROR_NONE;
938
- }
939
-
940
- /* *
941
- * @deprecated
942
- *
943
- * To indicate that a security procedure for the link has started.
944
- */
945
- void onSecuritySetupInitiated (SecuritySetupInitiatedCallback_t callback) {
946
- defaultEventHandler.securitySetupInitiatedCallback = callback;
947
- }
948
-
949
- /* *
950
- * @deprecated
951
- *
952
- * To indicate that the security procedure for the link has completed.
953
- */
954
- void onSecuritySetupCompleted (SecuritySetupCompletedCallback_t callback) {
955
- defaultEventHandler.securitySetupCompletedCallback = callback;
956
- }
957
-
958
- /* *
959
- * @deprecated
960
- *
961
- * To indicate that the link with the peer is secured. For bonded devices,
962
- * subsequent reconnections with a bonded peer will result only in this callback
963
- * when the link is secured; setup procedures will not occur (unless the
964
- * bonding information is either lost or deleted on either or both sides).
965
- */
966
- void onLinkSecured (LinkSecuredCallback_t callback) {
967
- defaultEventHandler.linkSecuredCallback = callback;
968
- }
969
-
970
- /* *
971
- * @deprecated
972
- *
973
- * To indicate that device context is stored persistently.
974
- */
975
- void onSecurityContextStored (HandleSpecificEvent_t callback) {
976
- defaultEventHandler.securityContextStoredCallback = callback;
977
- }
978
-
979
- /* * @deprecated
980
- *
981
- * To set the callback for when the passkey needs to be displayed on a peripheral with DISPLAY capability.
982
- */
983
- void onPasskeyDisplay (PasskeyDisplayCallback_t callback) {
984
- defaultEventHandler.passkeyDisplayCallback = callback;
985
- }
986
-
987
- /* Entry points for the underlying stack to report events back to the user. */
988
- public:
989
- /* * @deprecated */
990
- void processSecuritySetupInitiatedEvent (ble::connection_handle_t connectionHandle, bool allowBonding, bool requireMITM, SecurityIOCapabilities_t iocaps) {
991
- if (defaultEventHandler.securitySetupInitiatedCallback ) {
992
- defaultEventHandler.securitySetupInitiatedCallback (connectionHandle, allowBonding, requireMITM, iocaps);
993
- }
994
- }
995
- /* * @deprecated */
996
- void processSecuritySetupCompletedEvent (ble::connection_handle_t connectionHandle, SecurityCompletionStatus_t status) {
997
- eventHandler->pairingResult (connectionHandle, status);
998
- }
999
- /* * @deprecated */
1000
- void processLinkSecuredEvent (ble::connection_handle_t connectionHandle, SecurityMode_t securityMode) {
1001
- if (securityMode == SECURITY_MODE_ENCRYPTION_NO_MITM) {
1002
- eventHandler->linkEncryptionResult (connectionHandle, ble::link_encryption_t ::ENCRYPTED);
1003
- } else {
1004
- eventHandler->linkEncryptionResult (connectionHandle, ble::link_encryption_t ::NOT_ENCRYPTED);
1005
- }
1006
- }
1007
- /* * @deprecated */
1008
- void processSecurityContextStoredEvent (ble::connection_handle_t connectionHandle) {
1009
- if (defaultEventHandler.securityContextStoredCallback ) {
1010
- defaultEventHandler.securityContextStoredCallback (connectionHandle);
1011
- }
1012
- }
1013
- /* * @deprecated */
1014
- void processPasskeyDisplayEvent (ble::connection_handle_t connectionHandle, const Passkey_t passkey) {
1015
- eventHandler->passkeyDisplay (connectionHandle, passkey);
1016
- }
1017
-
1018
865
protected:
1019
866
/* --- _virtual_ implementations declaration --- */
1020
867
@@ -1136,62 +983,12 @@ class SecurityManager {
1136
983
bool authenticated
1137
984
);
1138
985
1139
- ble_error_t getAddressesFromBondTable_ (::Gap::Whitelist_t &addresses) const ;
1140
-
1141
- private:
1142
- /* Legacy compatibility with old callbacks (from both sides so any
1143
- * combination of new and old works) */
1144
- class LegacyEventHandler : public EventHandler {
1145
- public:
1146
- LegacyEventHandler () :
1147
- securitySetupInitiatedCallback (),
1148
- securitySetupCompletedCallback (),
1149
- linkSecuredCallback (),
1150
- securityContextStoredCallback (),
1151
- passkeyDisplayCallback () { };
1152
-
1153
- virtual void pairingResult (ble::connection_handle_t connectionHandle, SecurityCompletionStatus_t result) {
1154
- if (securitySetupCompletedCallback) {
1155
- securitySetupCompletedCallback (connectionHandle, result);
1156
- }
1157
- }
1158
-
1159
- virtual void linkEncryptionResult (ble::connection_handle_t connectionHandle, ble::link_encryption_t result) {
1160
- if (linkSecuredCallback) {
1161
- SecurityMode_t securityMode;
1162
- if (result == ble::link_encryption_t ::ENCRYPTED) {
1163
- securityMode = SECURITY_MODE_ENCRYPTION_NO_MITM;
1164
- } else if (
1165
- result == ble::link_encryption_t ::ENCRYPTED_WITH_MITM ||
1166
- result == ble::link_encryption_t ::ENCRYPTED_WITH_SC_AND_MITM
1167
- ) {
1168
- securityMode = SECURITY_MODE_ENCRYPTION_WITH_MITM;
1169
- } else {
1170
- securityMode = SECURITY_MODE_ENCRYPTION_OPEN_LINK;
1171
- }
1172
- linkSecuredCallback (connectionHandle, securityMode);
1173
- }
1174
- };
1175
-
1176
- virtual void passkeyDisplay (ble::connection_handle_t connectionHandle, const Passkey_t passkey) {
1177
- if (passkeyDisplayCallback) {
1178
- passkeyDisplayCallback (connectionHandle, passkey);
1179
- }
1180
- };
1181
-
1182
- SecuritySetupInitiatedCallback_t securitySetupInitiatedCallback;
1183
- SecuritySetupCompletedCallback_t securitySetupCompletedCallback;
1184
- LinkSecuredCallback_t linkSecuredCallback;
1185
- HandleSpecificEvent_t securityContextStoredCallback;
1186
- PasskeyDisplayCallback_t passkeyDisplayCallback;
1187
- };
1188
-
1189
986
private:
1190
987
SecurityManagerShutdownCallbackChain_t shutdownCallChain;
1191
988
1192
989
protected:
1193
990
EventHandler* eventHandler;
1194
- LegacyEventHandler defaultEventHandler;
991
+ EventHandler defaultEventHandler;
1195
992
};
1196
993
1197
994
0 commit comments