28
28
#include " cfg_stack.h"
29
29
30
30
namespace ble {
31
+ namespace impl {
31
32
32
33
class BLEInstanceBase ;
33
34
34
- class PalSecurityManager : public interface ::PalSecurityManager {
35
+ class PalSecurityManager final : public ble ::PalSecurityManager {
35
36
friend BLEInstanceBase;
36
37
public:
37
38
@@ -46,17 +47,17 @@ class PalSecurityManager : public interface::PalSecurityManager {
46
47
/* *
47
48
* @see ::ble::PalSecurityManager::initialize
48
49
*/
49
- ble_error_t initialize ();
50
+ ble_error_t initialize () final ;
50
51
51
52
/* *
52
53
* @see ::ble::PalSecurityManager::terminate
53
54
*/
54
- ble_error_t terminate ();
55
+ ble_error_t terminate () final ;
55
56
56
57
/* *
57
58
* @see ::ble::PalSecurityManager::reset
58
59
*/
59
- ble_error_t reset ();
60
+ ble_error_t reset () final ;
60
61
61
62
// //////////////////////////////////////////////////////////////////////////
62
63
// Resolving list management
@@ -65,7 +66,7 @@ class PalSecurityManager : public interface::PalSecurityManager {
65
66
/* *
66
67
* @see ::ble::PalSecurityManager::read_resolving_list_capacity
67
68
*/
68
- uint8_t read_resolving_list_capacity ();
69
+ uint8_t read_resolving_list_capacity () final ;
69
70
70
71
/* *
71
72
* @see ::ble::PalSecurityManager::add_device_to_resolving_list
@@ -74,20 +75,20 @@ class PalSecurityManager : public interface::PalSecurityManager {
74
75
advertising_peer_address_type_t peer_identity_address_type,
75
76
const address_t &peer_identity_address,
76
77
const irk_t &peer_irk
77
- );
78
+ ) final ;
78
79
79
80
/* *
80
81
* @see ::ble::PalSecurityManager::remove_device_from_resolving_list
81
82
*/
82
83
ble_error_t remove_device_from_resolving_list (
83
84
advertising_peer_address_type_t peer_identity_address_type,
84
85
const address_t &peer_identity_address
85
- );
86
+ ) final ;
86
87
87
88
/* *
88
89
* @see ::ble::PalSecurityManager::clear_resolving_list
89
90
*/
90
- ble_error_t clear_resolving_list ();
91
+ ble_error_t clear_resolving_list () final ;
91
92
92
93
// //////////////////////////////////////////////////////////////////////////
93
94
// Pairing
@@ -102,7 +103,7 @@ class PalSecurityManager : public interface::PalSecurityManager {
102
103
AuthenticationMask authentication_requirements,
103
104
KeyDistribution initiator_dist,
104
105
KeyDistribution responder_dist
105
- );
106
+ ) final ;
106
107
107
108
/* *
108
109
* @see ::ble::PalSecurityManager::send_pairing_response
@@ -113,14 +114,14 @@ class PalSecurityManager : public interface::PalSecurityManager {
113
114
AuthenticationMask authentication_requirements,
114
115
KeyDistribution initiator_dist,
115
116
KeyDistribution responder_dist
116
- );
117
+ ) final ;
117
118
118
119
/* *
119
120
* @see ::ble::PalSecurityManager::cancel_pairing
120
121
*/
121
122
ble_error_t cancel_pairing (
122
123
connection_handle_t connection, pairing_failure_t reason
123
- );
124
+ ) final ;
124
125
125
126
// //////////////////////////////////////////////////////////////////////////
126
127
// Feature support
@@ -131,12 +132,12 @@ class PalSecurityManager : public interface::PalSecurityManager {
131
132
*/
132
133
ble_error_t get_secure_connections_support (
133
134
bool &enabled
134
- );
135
+ ) final ;
135
136
136
137
/* *
137
138
* @see ::ble::PalSecurityManager::set_io_capability
138
139
*/
139
- ble_error_t set_io_capability (io_capability_t io_capability);
140
+ ble_error_t set_io_capability (io_capability_t io_capability) final ;
140
141
141
142
// //////////////////////////////////////////////////////////////////////////
142
143
// Security settings
@@ -147,30 +148,30 @@ class PalSecurityManager : public interface::PalSecurityManager {
147
148
*/
148
149
ble_error_t set_authentication_timeout (
149
150
connection_handle_t , uint16_t timeout_in_10ms
150
- );
151
+ ) final ;
151
152
152
153
/* *
153
154
* @see ::ble::PalSecurityManager::get_authentication_timeout
154
155
*/
155
156
ble_error_t get_authentication_timeout (
156
157
connection_handle_t , uint16_t &timeout_in_10ms
157
- );
158
+ ) final ;
158
159
159
160
/* *
160
161
* @see ::ble::PalSecurityManager::set_encryption_key_requirements
161
162
*/
162
163
ble_error_t set_encryption_key_requirements (
163
164
uint8_t min_encryption_key_size,
164
165
uint8_t max_encryption_key_size
165
- );
166
+ ) final ;
166
167
167
168
/* *
168
169
* @see ::ble::PalSecurityManager::slave_security_request
169
170
*/
170
171
ble_error_t slave_security_request (
171
172
connection_handle_t connection,
172
173
AuthenticationMask authentication
173
- );
174
+ ) final ;
174
175
175
176
// //////////////////////////////////////////////////////////////////////////
176
177
// Encryption
@@ -185,7 +186,7 @@ class PalSecurityManager : public interface::PalSecurityManager {
185
186
const rand_t &rand,
186
187
const ediv_t &ediv,
187
188
bool mitm
188
- );
189
+ ) final ;
189
190
190
191
/* *
191
192
* @see ::ble::PalSecurityManager::enable_encryption
@@ -194,15 +195,15 @@ class PalSecurityManager : public interface::PalSecurityManager {
194
195
connection_handle_t connection,
195
196
const ltk_t <k,
196
197
bool mitm
197
- );
198
+ ) final ;
198
199
199
200
/* *
200
201
* @see ::ble::PalSecurityManager::encrypt_data
201
202
*/
202
203
ble_error_t encrypt_data (
203
204
const byte_array_t <16 > &key,
204
205
encryption_block_t &data
205
- );
206
+ ) final ;
206
207
207
208
// //////////////////////////////////////////////////////////////////////////
208
209
// Privacy
@@ -211,12 +212,12 @@ class PalSecurityManager : public interface::PalSecurityManager {
211
212
/* *
212
213
* @see ::ble::PalSecurityManager::set_private_address_timeout
213
214
*/
214
- ble_error_t set_private_address_timeout (uint16_t timeout_in_seconds);
215
+ ble_error_t set_private_address_timeout (uint16_t timeout_in_seconds) final ;
215
216
216
217
/* *
217
218
* @see ::ble::PalSecurityManager::get_identity_address
218
219
*/
219
- ble_error_t get_identity_address (address_t & address, bool & public_address);
220
+ ble_error_t get_identity_address (address_t & address, bool & public_address) final ;
220
221
221
222
// //////////////////////////////////////////////////////////////////////////
222
223
// Keys
@@ -230,27 +231,27 @@ class PalSecurityManager : public interface::PalSecurityManager {
230
231
const ltk_t <k,
231
232
bool mitm,
232
233
bool secure_connections
233
- );
234
+ ) final ;
234
235
235
236
/* *
236
237
* @see ::ble::PalSecurityManager::set_ltk_not_found
237
238
*/
238
239
ble_error_t set_ltk_not_found (
239
240
connection_handle_t connection
240
- );
241
+ ) final ;
241
242
242
243
/* *
243
244
* @see ::ble::PalSecurityManager::set_irk
244
245
*/
245
- ble_error_t set_irk (const irk_t &irk);
246
+ ble_error_t set_irk (const irk_t &irk) final ;
246
247
247
248
/* *
248
249
* @see ::ble::PalSecurityManager::set_csrk
249
250
*/
250
251
ble_error_t set_csrk (
251
252
const csrk_t &csrk,
252
253
sign_count_t sign_counter
253
- );
254
+ ) final ;
254
255
255
256
/* *
256
257
* @see ::ble::PalSecurityManager::set_peer_csrk
@@ -260,9 +261,9 @@ class PalSecurityManager : public interface::PalSecurityManager {
260
261
const csrk_t &csrk,
261
262
bool authenticated,
262
263
sign_count_t sign_counter
263
- );
264
+ ) final ;
264
265
265
- ble_error_t remove_peer_csrk (connection_handle_t connection);
266
+ ble_error_t remove_peer_csrk (connection_handle_t connection) final ;
266
267
267
268
// //////////////////////////////////////////////////////////////////////////
268
269
// Authentication
@@ -271,7 +272,7 @@ class PalSecurityManager : public interface::PalSecurityManager {
271
272
/* *
272
273
* @see ::ble::PalSecurityManager::get_random_data
273
274
*/
274
- ble_error_t get_random_data (byte_array_t <8 > &random_data);
275
+ ble_error_t get_random_data (byte_array_t <8 > &random_data) final ;
275
276
276
277
// //////////////////////////////////////////////////////////////////////////
277
278
// MITM
@@ -280,15 +281,15 @@ class PalSecurityManager : public interface::PalSecurityManager {
280
281
/* *
281
282
* @see ::ble::PalSecurityManager::set_display_passkey
282
283
*/
283
- ble_error_t set_display_passkey (passkey_num_t passkey);
284
+ ble_error_t set_display_passkey (passkey_num_t passkey) final ;
284
285
285
286
/* *
286
287
* @see ::ble::PalSecurityManager::passkey_request_reply
287
288
*/
288
289
ble_error_t passkey_request_reply (
289
290
connection_handle_t connection,
290
291
passkey_num_t passkey
291
- );
292
+ ) final ;
292
293
293
294
/* *
294
295
* @see ::ble::PalSecurityManager::secure_connections_oob_request_reply
@@ -298,51 +299,51 @@ class PalSecurityManager : public interface::PalSecurityManager {
298
299
const oob_lesc_value_t &local_random,
299
300
const oob_lesc_value_t &peer_random,
300
301
const oob_confirm_t &peer_confirm
301
- );
302
+ ) final ;
302
303
303
304
/* *
304
305
* @see ::ble::PalSecurityManager::legacy_pairing_oob_request_reply
305
306
*/
306
307
ble_error_t legacy_pairing_oob_request_reply (
307
308
connection_handle_t connection,
308
309
const oob_tk_t &oob_data
309
- );
310
+ ) final ;
310
311
311
312
/* *
312
313
* @see ::ble::PalSecurityManager::confirmation_entered
313
314
*/
314
315
ble_error_t confirmation_entered (
315
316
connection_handle_t connection, bool confirmation
316
- );
317
+ ) final ;
317
318
318
319
/* *
319
320
* @see ::ble::PalSecurityManager::send_keypress_notification
320
321
*/
321
322
ble_error_t send_keypress_notification (
322
323
connection_handle_t connection, ble::Keypress_t keypress
323
- );
324
+ ) final ;
324
325
325
326
/* *
326
327
* @see ::ble::PalSecurityManager::generate_secure_connections_oob
327
328
*/
328
- ble_error_t generate_secure_connections_oob ();
329
+ ble_error_t generate_secure_connections_oob () final ;
329
330
330
331
/* *
331
332
* @see ::ble::PalSecurityManager::set_event_handler
332
333
*/
333
- void set_event_handler (PalSecurityManagerEventHandler *event_handler);
334
+ void set_event_handler (PalSecurityManagerEventHandler *event_handler) final ;
334
335
335
336
/* *
336
337
* @see ::ble::PalSecurityManager::get_event_handler
337
338
*/
338
- PalSecurityManagerEventHandler* get_event_handler ();
339
+ PalSecurityManagerEventHandler * get_event_handler () final ;
339
340
340
- private :
341
+ public :
341
342
/* used by the PAL to get the singleton */
342
343
static PalSecurityManager &get_security_manager ();
343
344
344
345
/* used by PAL to handle security messages coming from the stack Event handler */
345
- static bool sm_handler (const wsfMsgHdr_t* msg);
346
+ static bool sm_handler (const wsfMsgHdr_t * msg);
346
347
347
348
private:
348
349
@@ -371,28 +372,29 @@ class PalSecurityManager : public interface::PalSecurityManager {
371
372
void clear_privacy_control_blocks ();
372
373
373
374
// Queue a control block
374
- void queue_privacy_control_block (PrivacyControlBlock* block);
375
+ void queue_privacy_control_block (PrivacyControlBlock * block);
375
376
376
377
// Try to dequeue and process the next control block
377
378
// cb_completed is set when the previous block has completed
378
379
void process_privacy_control_blocks (bool cb_completed);
379
380
380
381
void cleanup_peer_csrks ();
381
382
382
- PalSecurityManagerEventHandler* _pal_event_handler;
383
+ PalSecurityManagerEventHandler * _pal_event_handler;
383
384
384
385
bool _use_default_passkey;
385
386
passkey_num_t _default_passkey;
386
387
bool _lesc_keys_generated;
387
388
uint8_t _public_key_x[SEC_ECC_KEY_LEN];
388
389
389
- PrivacyControlBlock* _pending_privacy_control_blocks;
390
+ PrivacyControlBlock * _pending_privacy_control_blocks;
390
391
bool _processing_privacy_control_block;
391
392
irk_t _irk;
392
393
csrk_t _csrk;
393
- csrk_t * _peer_csrks[DM_CONN_MAX];
394
+ csrk_t * _peer_csrks[DM_CONN_MAX];
394
395
};
395
396
396
- } // ble
397
+ } // namespace impl
398
+ } // namespace ble
397
399
398
400
#endif /* IMPL_PAL_SECURITY_MANAGER_ */
0 commit comments