1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
75
76
77
78
79
80
81
82
83
84
85
86
87
88
91
92
93
94
95
98
99
100
101
102
103
106
107
108
109
113
114
115
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
151
152
153
154
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
188
189
195
196
197
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
278
279
280
281
282
283
286
287
288
293
294
309
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
347
355
367
383
384
385
386
387
388
389
390
410
411
412
413
414
415
416
417
418
419
420
421
422
423
430
431
432
439
440
441
442
443
444
446
447
448
449
450
451
452
453
455
456
457
458
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
488
489
490
494
495
496
502
503
504
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
669
670
673
674
675
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
725
726
727
728
729
730
737
741
742
749
/* ... */
/* ... */
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include "stack/bt_types.h"
#include "device/controller.h"
#include "stack/hcimsgs.h"
#include "stack/btu.h"
#include "stack/btm_api.h"
#include "btm_int.h"
#include "stack/hcidefs.h"
#include "stack/l2c_api.h"11 includes
static tBTM_SEC_DEV_REC *btm_find_oldest_dev (void);
/* ... */
BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
UINT8 *features, UINT32 trusted_mask[],
LINK_KEY link_key, UINT8 key_type, tBTM_IO_CAP io_cap,
UINT8 pin_length, UINT8 sc_support)
{
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_dev_rec;
int i, j;
BOOLEAN found = FALSE;
BTM_TRACE_API("%s, link key type:%x\n", __FUNCTION__, key_type);
p_dev_rec = btm_find_dev (bd_addr);
if (!p_dev_rec) {
/* ... */
if (list_length(btm_cb.p_sec_dev_rec_list) < BTM_SEC_MAX_DEVICE_RECORDS) {
p_dev_rec = (tBTM_SEC_DEV_REC *)osi_malloc(sizeof(tBTM_SEC_DEV_REC));
if(p_dev_rec) {
list_append(btm_cb.p_sec_dev_rec_list, p_dev_rec);
memset (p_dev_rec, 0, sizeof (tBTM_SEC_DEV_REC));
p_dev_rec->sec_flags = BTM_SEC_IN_USE;
memcpy (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN);
p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_BR_EDR);
p_dev_rec->ble_hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_LE);
p_dev_rec->enc_mode = BTM_ENC_MODE_UNKNOWN;
#if BLE_INCLUDED == TRUE
memset(&p_dev_rec->conn_params, 0xff, sizeof(tBTM_LE_CONN_PRAMS));/* ... */
#endif
}{...}
}{...}
if (!p_dev_rec) {
return (FALSE);
}{...}
}{...}
p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
p_dev_rec->timestamp = btm_cb.dev_rec_count++;
p_dev_rec->remote_secure_connection_previous_state = sc_support;
if (dev_class) {
memcpy (p_dev_rec->dev_class, dev_class, DEV_CLASS_LEN);
}{...}
memset(p_dev_rec->sec_bd_name, 0, sizeof(tBTM_BD_NAME));
if (bd_name && bd_name[0]) {
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, (char *)bd_name, BTM_MAX_REM_BD_NAME_LEN);
}{...}
p_dev_rec->num_read_pages = 0;
if (features) {
memcpy (p_dev_rec->features, features, sizeof (p_dev_rec->features));
for (i = HCI_EXT_FEATURES_PAGE_MAX; i >= 0; i--) {
for (j = 0; j < HCI_FEATURE_BYTES_PER_PAGE; j++) {
if (p_dev_rec->features[i][j] != 0) {
found = TRUE;
break;
}{...}
}{...}
if (found) {
p_dev_rec->num_read_pages = i + 1;
break;
}{...}
}{...}
}{...} else {
memset (p_dev_rec->features, 0, sizeof (p_dev_rec->features));
}{...}
BTM_SEC_COPY_TRUSTED_DEVICE(trusted_mask, p_dev_rec->trusted_mask);
if (link_key) {
BTM_TRACE_EVENT ("BTM_SecAddDevice() BDA: %02x:%02x:%02x:%02x:%02x:%02x\n",
bd_addr[0], bd_addr[1], bd_addr[2],
bd_addr[3], bd_addr[4], bd_addr[5]);
p_dev_rec->sec_flags |= BTM_SEC_LINK_KEY_KNOWN;
memcpy (p_dev_rec->link_key, link_key, LINK_KEY_LEN);
p_dev_rec->link_key_type = key_type;
p_dev_rec->pin_code_length = pin_length;
if (pin_length >= 16 ||
key_type == BTM_LKEY_TYPE_AUTH_COMB ||
key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256) {
p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
}{...}
}{...}
#if defined(BTIF_MIXED_MODE_INCLUDED) && (BTIF_MIXED_MODE_INCLUDED == TRUE)
if (key_type < BTM_MAX_PRE_SM4_LKEY_TYPE) {
p_dev_rec->sm4 = BTM_SM4_KNOWN;
}{...} else {
p_dev_rec->sm4 = BTM_SM4_TRUE;
}{...}
#endif/* ... */
p_dev_rec->rmt_io_caps = io_cap;
p_dev_rec->device_type |= BT_DEVICE_TYPE_BREDR;/* ... */
#endif
return (TRUE);
}{ ... }
/* ... */
BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport)
{
tBTM_SEC_DEV_REC *p_dev_rec;
if (BTM_IsAclConnectionUp(bd_addr, transport)) {
BTM_TRACE_WARNING("%s FAILED: Cannot Delete when connection is active\n", __func__);
return FALSE;
}{...}
if ((p_dev_rec = btm_find_dev(bd_addr)) != NULL) {
BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL);
btm_sec_free_dev(p_dev_rec, transport);
}{...}
#if (BLE_SMP_ID_RESET_ENABLE == TRUE)
/* ... */
if (list_is_empty(btm_cb.p_sec_dev_rec_list)) {
btm_ble_reset_id();
}{...}
#endif/* ... */
return TRUE;
}{ ... }
/* ... */
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec == NULL) {
return;
}{...}
p_dev_rec->sec_flags = 0;
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
p_dev_rec->sm4 = BTM_SM4_UNKNOWN;
}{ ... }
/* ... */
char *BTM_SecReadDevName (BD_ADDR bd_addr)
{
char *p_name = NULL;
tBTM_SEC_DEV_REC *p_srec;
if ((p_srec = btm_find_dev(bd_addr)) != NULL) {
p_name = (char *)p_srec->sec_bd_name;
}{...}
return (p_name);
}{ ... }
/* ... */
BOOLEAN btm_find_sec_dev_in_list (void *p_node_data, void *context)
{
tBTM_SEC_DEV_REC *p_sec_dev = (tBTM_SEC_DEV_REC *)p_node_data;
BOOLEAN ret = TRUE;
BOOLEAN dev_free = !(p_sec_dev->sec_flags & BTM_SEC_IN_USE);
tSecDevContext *p_context = (tSecDevContext *)context;
if (dev_free == p_context->free_check) {
switch (p_context->type) {
case SEC_DEV_BDA:
if (!memcmp(p_context->context.p_bd_addr, p_sec_dev->bd_addr, BD_ADDR_LEN)) {
ret = FALSE;
}{...}
break;...
case SEC_DEV_HDL:
if (p_context->context.handle == p_sec_dev->hci_handle
#if BLE_INCLUDED == TRUE
|| (p_context->context.handle == p_sec_dev->ble_hci_handle)
#endif
) {
ret = FALSE;
}{...}
break;
#if BLE_PRIVACY_SPT == TRUE...
case SEC_DEV_ID_ADDR:
if (!memcmp(p_context->context.p_bd_addr, p_sec_dev->ble.static_addr, BD_ADDR_LEN)) {
ret = FALSE;
}{...}
break;/* ... */
#endif
case SEC_DEV_BTDM_BDA:
if (!memcmp(p_context->context.p_bd_addr, p_sec_dev->bd_addr, BD_ADDR_LEN)) {
ret = FALSE;
}{...}
#if BLE_INCLUDED == TRUE
if (!memcmp(p_sec_dev->ble.pseudo_addr, p_context->context.p_bd_addr, BD_ADDR_LEN)) {
ret = FALSE;
}{...}
if (btm_ble_addr_resolvable(p_context->context.p_bd_addr, p_sec_dev)) {
ret = FALSE;
}{...}
#endif/* ... */
break;...
default:
break;...
}{...}
}{...}
return ret;
}{ ... }
/* ... */
tBTM_SEC_DEV_REC *btm_sec_alloc_dev (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
tBTM_SEC_DEV_REC *p_dev_new_rec = NULL;
tBTM_SEC_DEV_REC *p_dev_old_rec = NULL;
tBTM_INQ_INFO *p_inq_info;
list_node_t *p_node = NULL;
BOOLEAN new_entry_found = FALSE;
BOOLEAN old_entry_found = FALSE;
BOOLEAN malloc_new_entry = FALSE;
BTM_TRACE_EVENT ("btm_sec_alloc_dev\n");
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_old_rec = list_node(p_node);
if (!(p_dev_old_rec->sec_flags & BTM_SEC_IN_USE) &&
(!memcmp (p_dev_old_rec->bd_addr, bd_addr, BD_ADDR_LEN))) {
old_entry_found = TRUE;
BTM_TRACE_EVENT ("btm_sec_alloc_dev old device found\n");
break;
}{...}
}{...}
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_new_rec = list_node(p_node);
if (!(p_dev_new_rec->sec_flags & BTM_SEC_IN_USE)) {
new_entry_found = TRUE;
break;
}{...}
}{...}
if (!new_entry_found) {
if (list_length(btm_cb.p_sec_dev_rec_list) < BTM_SEC_MAX_DEVICE_RECORDS){
p_dev_new_rec = (tBTM_SEC_DEV_REC *)osi_malloc(sizeof(tBTM_SEC_DEV_REC));
if (p_dev_new_rec) {
new_entry_found = TRUE;
malloc_new_entry = TRUE;
}{...} else {
return NULL;
}{...}
}{...}
}{...}
if (!new_entry_found) {
p_dev_rec = btm_find_oldest_dev();
}{...} else {
if (old_entry_found) {
p_dev_rec = p_dev_old_rec;
if (malloc_new_entry) {
osi_free(p_dev_new_rec);
}{...}
}{...} else {
if (malloc_new_entry) {
list_append(btm_cb.p_sec_dev_rec_list, p_dev_new_rec);
}{...}
p_dev_rec = p_dev_new_rec;
}{...}
}{...}
memset (p_dev_rec, 0, sizeof (tBTM_SEC_DEV_REC));
p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
p_dev_rec->sec_flags = BTM_SEC_IN_USE;
if ((p_inq_info = BTM_InqDbRead(bd_addr)) != NULL) {
memcpy (p_dev_rec->dev_class, p_inq_info->results.dev_class, DEV_CLASS_LEN);
#if BLE_INCLUDED == TRUE
p_dev_rec->device_type = p_inq_info->results.device_type;
p_dev_rec->ble.ble_addr_type = p_inq_info->results.ble_addr_type;
memset(&p_dev_rec->conn_params, 0xff, sizeof(tBTM_LE_CONN_PRAMS));/* ... */
#endif
}{...} else {
#if BLE_INCLUDED == TRUE
memset(&p_dev_rec->conn_params, 0xff, sizeof(tBTM_LE_CONN_PRAMS));/* ... */
#endif
if (!memcmp (bd_addr, btm_cb.connecting_bda, BD_ADDR_LEN)) {
memcpy (p_dev_rec->dev_class, btm_cb.connecting_dc, DEV_CLASS_LEN);
}{...}
}{...}
memcpy (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN);
#if BLE_INCLUDED == TRUE
p_dev_rec->ble_hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_LE);
#endif
p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_BR_EDR);
p_dev_rec->timestamp = btm_cb.dev_rec_count++;
return (p_dev_rec);
}{ ... }
/* ... */
void btm_sec_free_dev (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport)
{
if (transport == BT_TRANSPORT_BR_EDR) {
memset(p_dev_rec->link_key, 0, LINK_KEY_LEN);
p_dev_rec->sec_flags &= ~(BTM_SEC_AUTHORIZED | BTM_SEC_AUTHENTICATED
| BTM_SEC_ENCRYPTED | BTM_SEC_NAME_KNOWN
| BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_LINK_KEY_AUTHED
| BTM_SEC_ROLE_SWITCHED | BTM_SEC_16_DIGIT_PIN_AUTHED);
}{...} else if (transport == BT_TRANSPORT_LE) {
p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
p_dev_rec->sec_flags &= ~(BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED
| BTM_SEC_LE_NAME_KNOWN | BTM_SEC_LE_LINK_KEY_KNOWN
| BTM_SEC_LE_LINK_KEY_AUTHED | BTM_SEC_ROLE_SWITCHED);
#if BLE_INCLUDED == TRUE
btm_sec_clear_ble_keys (p_dev_rec);/* ... */
#endif
}{...} else {
p_dev_rec->bond_type = BOND_TYPE_UNKNOWN;
memset(p_dev_rec->link_key, 0, LINK_KEY_LEN);
p_dev_rec->sec_flags = 0;
#if BLE_INCLUDED == TRUE
btm_sec_clear_ble_keys (p_dev_rec);/* ... */
#endif
}{...}
if(p_dev_rec->sec_flags == BTM_SEC_IN_USE) {
p_dev_rec->sec_flags = 0;
}{...}
list_remove(btm_cb.p_sec_dev_rec_list, p_dev_rec);
}{ ... }
/* ... */
BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec;
UINT8 xx;
BOOLEAN feature_empty = TRUE;
#if BTM_SCO_INCLUDED == TRUE
if (btm_is_sco_active_by_bdaddr(bd_addr)) {
return (FALSE);
}{...}
#endif/* ... */
p_dev_rec = btm_find_dev (bd_addr);
if (p_dev_rec && controller_get_interface()->supports_master_slave_role_switch()) {
if (HCI_SWITCH_SUPPORTED(p_dev_rec->features[HCI_EXT_FEATURES_PAGE_0])) {
BTM_TRACE_DEBUG("btm_dev_support_switch return TRUE (feature found)\n");
return (TRUE);
}{...}
for (xx = 0 ; xx < BD_FEATURES_LEN ; xx++) {
if (p_dev_rec->features[HCI_EXT_FEATURES_PAGE_0][xx] != 0x00) {
feature_empty = FALSE;
break;
}{...}
}{...}
if (feature_empty) {
BTM_TRACE_DEBUG("btm_dev_support_switch return TRUE (feature empty)\n");
return (TRUE);
}{...}
}{...}
BTM_TRACE_DEBUG("btm_dev_support_switch return FALSE\n");
return (FALSE);
}{ ... }
/* ... */
tBTM_SEC_DEV_REC *btm_find_dev_by_handle (UINT16 handle)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
list_node_t *p_node = NULL;
tSecDevContext context;
context.type = SEC_DEV_HDL;
context.context.handle = handle;
context.free_check = FALSE;
p_node = list_foreach(btm_cb.p_sec_dev_rec_list, btm_find_sec_dev_in_list, &context);
if (p_node) {
p_dev_rec = list_node(p_node);
}{...}
return (p_dev_rec);
}{ ... }
/* ... */
tBTM_SEC_DEV_REC *btm_find_dev(BD_ADDR bd_addr)
{
if(bd_addr) {
list_node_t *p_node = NULL;
tSecDevContext context;
context.type = SEC_DEV_BTDM_BDA;
context.context.p_bd_addr = bd_addr;
context.free_check = FALSE;
p_node = list_foreach(btm_cb.p_sec_dev_rec_list, btm_find_sec_dev_in_list, &context);
if (p_node) {
return(list_node(p_node));
}{...}
}{...}
return (NULL);
}{ ... }
/* ... */
void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec)
{
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
tBTM_SEC_DEV_REC temp_rec = *p_target_rec;
list_node_t *p_node = NULL;
BTM_TRACE_DEBUG("%s\n", __func__);
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_rec = list_node(p_node);
if (p_target_rec != p_dev_rec && p_dev_rec->sec_flags & BTM_SEC_IN_USE) {
if (!memcmp (p_dev_rec->bd_addr, p_target_rec->bd_addr, BD_ADDR_LEN)) {
memcpy(p_target_rec, p_dev_rec, sizeof(tBTM_SEC_DEV_REC));
p_target_rec->ble = temp_rec.ble;
p_target_rec->ble_hci_handle = temp_rec.ble_hci_handle;
p_target_rec->enc_key_size = temp_rec.enc_key_size;
p_target_rec->conn_params = temp_rec.conn_params;
p_target_rec->device_type |= temp_rec.device_type;
p_target_rec->sec_flags |= temp_rec.sec_flags;
p_target_rec->new_encryption_key_is_p256 = temp_rec.new_encryption_key_is_p256;
p_target_rec->no_smp_on_br = temp_rec.no_smp_on_br;
p_target_rec->bond_type = temp_rec.bond_type;
list_remove(btm_cb.p_sec_dev_rec_list, p_dev_rec);
break;
}{...}
if (btm_ble_addr_resolvable(p_dev_rec->bd_addr, p_target_rec)) {
if (memcmp(p_target_rec->ble.pseudo_addr, p_dev_rec->bd_addr, BD_ADDR_LEN) == 0) {
p_target_rec->ble.ble_addr_type = p_dev_rec->ble.ble_addr_type;
p_target_rec->device_type |= p_dev_rec->device_type;
list_remove(btm_cb.p_sec_dev_rec_list, p_dev_rec);
}{...}
break;
}{...}
}{...}
}{...}
/* ... */#endif
}{ ... }
/* ... */
tBTM_SEC_DEV_REC *btm_find_or_alloc_dev (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_EVENT ("btm_find_or_alloc_dev\n");
if ((p_dev_rec = btm_find_dev (bd_addr)) == NULL) {
p_dev_rec = btm_sec_alloc_dev (bd_addr);
}{...}
return (p_dev_rec);
}{ ... }
/* ... */
tBTM_SEC_DEV_REC *btm_find_oldest_dev (void)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
tBTM_SEC_DEV_REC *p_oldest = NULL;
list_node_t *p_node = NULL;
UINT32 old_ts = 0xFFFFFFFF;
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
p_dev_rec = list_node(p_node);
if (((p_dev_rec->sec_flags & BTM_SEC_IN_USE) == 0)
|| ((p_dev_rec->sec_flags & (BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_LE_LINK_KEY_KNOWN)) != 0)) {
continue;
}{...}
if (p_dev_rec->timestamp < old_ts) {
p_oldest = p_dev_rec;
old_ts = p_dev_rec->timestamp;
}{...}
}{...}
if (old_ts != 0xFFFFFFFF) {
return (p_oldest);
}{...}
for (p_node = list_begin(btm_cb.p_sec_dev_rec_list); p_node; p_node = list_next(p_node)) {
if ((p_dev_rec->sec_flags & BTM_SEC_IN_USE) == 0) {
continue;
}{...}
if (p_dev_rec->timestamp < old_ts) {
p_oldest = p_dev_rec;
old_ts = p_dev_rec->timestamp;
}{...}
}{...}
return (p_oldest);
}{ ... }
/* ... */
tBTM_BOND_TYPE btm_get_bond_type_dev(BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec == NULL) {
return BOND_TYPE_UNKNOWN;
}{...}
return p_dev_rec->bond_type;
}{ ... }
/* ... */
BOOLEAN btm_set_bond_type_dev(BD_ADDR bd_addr, tBTM_BOND_TYPE bond_type)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec == NULL) {
return FALSE;
}{...}
p_dev_rec->bond_type = bond_type;
return TRUE;
}{ ... }
/* ... */
void btm_sec_dev_init(void)
{
btm_cb.p_sec_dev_rec_list = list_new(osi_free_func);
}{ ... }
/* ... */
void btm_sec_dev_free(void)
{
list_free(btm_cb.p_sec_dev_rec_list);
}{ ... }