1 /******************************************************************************
2 *
3 * Copyright 1999-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19 #pragma once
20
21 #include <base/strings/stringprintf.h>
22 #include <string.h>
23 #include <cstdint>
24 #include <string>
25
26 #include "gd/crypto_toolbox/crypto_toolbox.h"
27 #include "main/shim/dumpsys.h"
28 #include "osi/include/alarm.h"
29 #include "stack/include/btm_api_types.h"
30 #include "types/hci_role.h"
31 #include "types/raw_address.h"
32
33 typedef char tBTM_LOC_BD_NAME[BTM_MAX_LOC_BD_NAME_LEN + 1];
34
35 typedef struct {
36 uint16_t min_conn_int;
37 uint16_t max_conn_int;
38 uint16_t peripheral_latency;
39 uint16_t supervision_tout;
40
41 } tBTM_LE_CONN_PRAMS;
42
43 /* The MSB of the clock offset field indicates whether the offset is valid. */
44 #define BTM_CLOCK_OFFSET_VALID 0x8000
45
46 /*
47 * Define structure for Security Service Record.
48 * A record exists for each service registered with the Security Manager
49 */
50 #define BTM_SEC_OUT_FLAGS (BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT)
51 #define BTM_SEC_IN_FLAGS (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT)
52
53 #define BTM_SEC_OUT_LEVEL4_FLAGS \
54 (BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT | BTM_SEC_OUT_MITM | \
55 BTM_SEC_MODE4_LEVEL4)
56
57 #define BTM_SEC_IN_LEVEL4_FLAGS \
58 (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT | BTM_SEC_IN_MITM | \
59 BTM_SEC_MODE4_LEVEL4)
60 typedef struct {
61 uint32_t mx_proto_id; /* Service runs over this multiplexer protocol */
62 uint32_t orig_mx_chan_id; /* Channel on the multiplexer protocol */
63 uint32_t term_mx_chan_id; /* Channel on the multiplexer protocol */
64 uint16_t psm; /* L2CAP PSM value */
65 uint16_t security_flags; /* Bitmap of required security features */
66 uint8_t service_id; /* Passed in authorization callback */
67 uint8_t orig_service_name[BT_MAX_SERVICE_NAME_LEN + 1];
68 uint8_t term_service_name[BT_MAX_SERVICE_NAME_LEN + 1];
69 } tBTM_SEC_SERV_REC;
70
71 /* LE Security information of device in Peripheral Role */
72 typedef struct {
73 Octet16 irk; /* peer diverified identity root */
74 Octet16 pltk; /* peer long term key */
75 Octet16 pcsrk; /* peer SRK peer device used to secured sign local data */
76
77 Octet16 lltk; /* local long term key */
78 Octet16 lcsrk; /* local SRK peer device used to secured sign local data */
79
80 BT_OCTET8 rand; /* random vector for LTK generation */
81 uint16_t ediv; /* LTK diversifier of this peripheral device */
82 uint16_t div; /* local DIV to generate local LTK=d1(ER,DIV,0) and
83 CSRK=d1(ER,DIV,1) */
84 uint8_t sec_level; /* local pairing security level */
85 uint8_t key_size; /* key size of the LTK delivered to peer device */
86 uint8_t srk_sec_level; /* security property of peer SRK for this device */
87 uint8_t local_csrk_sec_level; /* security property of local CSRK for this
88 device */
89
90 uint32_t counter; /* peer sign counter for verifying rcv signed cmd */
91 uint32_t local_counter; /* local sign counter for sending signed write cmd*/
92 } tBTM_SEC_BLE_KEYS;
93
94 typedef struct {
95 RawAddress pseudo_addr; /* LE pseudo address of the device if different from
96 device address */
97 tBLE_ADDR_TYPE ble_addr_type; /* LE device type: public or random address */
98
99 tBLE_BD_ADDR identity_address_with_type;
100
101 #define BTM_ACCEPTLIST_BIT 0x01
102 #define BTM_RESOLVING_LIST_BIT 0x02
103 uint8_t in_controller_list; /* in controller resolving list or not */
104 uint8_t resolving_list_index;
105 RawAddress cur_rand_addr; /* current random address */
106
107 typedef enum : uint8_t {
108 BTM_BLE_ADDR_PSEUDO = 0,
109 BTM_BLE_ADDR_RRA = 1,
110 BTM_BLE_ADDR_STATIC = 2,
111 } tADDRESS_TYPE;
112 tADDRESS_TYPE active_addr_type;
113
114 tBTM_LE_KEY_TYPE key_type; /* bit mask of valid key types in record */
115 tBTM_SEC_BLE_KEYS keys; /* LE device security info in peripheral rode */
116 } tBTM_SEC_BLE;
117
118 enum : uint16_t {
119 BTM_SEC_AUTHENTICATED = 0x0002,
120 BTM_SEC_ENCRYPTED = 0x0004,
121 BTM_SEC_NAME_KNOWN = 0x0008,
122 BTM_SEC_LINK_KEY_KNOWN = 0x0010,
123 BTM_SEC_LINK_KEY_AUTHED = 0x0020,
124 BTM_SEC_ROLE_SWITCHED = 0x0040, // UNUSED - only cleared
125 BTM_SEC_IN_USE = 0x0080, // UNUSED - only set
126 /* LE link security flag */
127 /* LE link is encrypted after pairing with MITM */
128 BTM_SEC_LE_AUTHENTICATED = 0x0200,
129 /* LE link is encrypted */
130 BTM_SEC_LE_ENCRYPTED = 0x0400,
131 /* not used */
132 BTM_SEC_LE_NAME_KNOWN = 0x0800, // UNUSED
133 /* bonded with peer (peer LTK and/or SRK is saved) */
134 BTM_SEC_LE_LINK_KEY_KNOWN = 0x1000,
135 /* pairing is done with MITM */
136 BTM_SEC_LE_LINK_KEY_AUTHED = 0x2000,
137 /* pairing is done with 16 digit pin */
138 BTM_SEC_16_DIGIT_PIN_AUTHED = 0x4000,
139 };
140
141 #define CASE_RETURN_TEXT(code) \
142 case code: \
143 return #code
144
145 typedef enum : uint8_t {
146 BTM_SEC_STATE_IDLE = 0,
147 BTM_SEC_STATE_AUTHENTICATING = 1,
148 BTM_SEC_STATE_ENCRYPTING = 2,
149 BTM_SEC_STATE_GETTING_NAME = 3,
150 BTM_SEC_STATE_AUTHORIZING = 4,
151 BTM_SEC_STATE_SWITCHING_ROLE = 5,
152 /* disconnecting BR/EDR */
153 BTM_SEC_STATE_DISCONNECTING = 6,
154 /* delay to check for encryption to work around */
155 /* controller problems */
156 BTM_SEC_STATE_DELAY_FOR_ENC = 7,
157 BTM_SEC_STATE_DISCONNECTING_BLE = 8,
158 BTM_SEC_STATE_DISCONNECTING_BOTH = 9,
159 } tSECURITY_STATE;
160
security_state_text(const tSECURITY_STATE & state)161 static inline std::string security_state_text(const tSECURITY_STATE& state) {
162 switch (state) {
163 CASE_RETURN_TEXT(BTM_SEC_STATE_IDLE);
164 CASE_RETURN_TEXT(BTM_SEC_STATE_AUTHENTICATING);
165 CASE_RETURN_TEXT(BTM_SEC_STATE_ENCRYPTING);
166 CASE_RETURN_TEXT(BTM_SEC_STATE_GETTING_NAME);
167 CASE_RETURN_TEXT(BTM_SEC_STATE_AUTHORIZING);
168 CASE_RETURN_TEXT(BTM_SEC_STATE_SWITCHING_ROLE);
169 CASE_RETURN_TEXT(BTM_SEC_STATE_DISCONNECTING);
170 CASE_RETURN_TEXT(BTM_SEC_STATE_DELAY_FOR_ENC);
171 CASE_RETURN_TEXT(BTM_SEC_STATE_DISCONNECTING_BLE);
172 CASE_RETURN_TEXT(BTM_SEC_STATE_DISCONNECTING_BOTH);
173 default:
174 return std::string("UNKNOWN[%hhu]", state);
175 }
176 }
177
178 typedef enum : uint8_t {
179 BTM_SM4_UNKNOWN = 0x00,
180 BTM_SM4_KNOWN = 0x10,
181 BTM_SM4_TRUE = 0x11,
182 BTM_SM4_REQ_PEND = 0x08, /* set this bit when getting remote features */
183 BTM_SM4_UPGRADE = 0x04, /* set this bit when upgrading link key */
184 BTM_SM4_RETRY = 0x02, /* set this bit to retry on HCI_ERR_KEY_MISSING or \
185 HCI_ERR_LMP_ERR_TRANS_COLLISION */
186 BTM_SM4_DD_ACP =
187 0x20, /* set this bit to indicate peer initiated dedicated bonding */
188 BTM_SM4_CONN_PEND = 0x40, /* set this bit to indicate accepting acl conn; to
189 be cleared on \ btm_acl_created */
190 } tBTM_SM4_BIT;
191
class_of_device_text(const DEV_CLASS & cod)192 inline std::string class_of_device_text(const DEV_CLASS& cod) {
193 return base::StringPrintf("0x%02x%02x%02x", cod[2], cod[1], cod[0]);
194 }
195
196 /*
197 * Define structure for Security Device Record.
198 * A record exists for each device authenticated with this device
199 */
200 struct tBTM_SEC_DEV_REC {
201 /* Peering bond type */
202 typedef enum : uint8_t {
203 BOND_TYPE_UNKNOWN = 0,
204 BOND_TYPE_PERSISTENT = 1,
205 BOND_TYPE_TEMPORARY = 2
206 } tBTM_BOND_TYPE;
207
208 uint32_t required_security_flags_for_pairing;
209 tBTM_SEC_CALLBACK* p_callback;
210 void* p_ref_data;
211 uint32_t timestamp; /* Timestamp of the last connection */
212 uint16_t hci_handle; /* Handle to connection when exists */
213 uint16_t clock_offset; /* Latest known clock offset */
214 RawAddress bd_addr; /* BD_ADDR of the device */
215 DEV_CLASS dev_class; /* DEV_CLASS of the device */
216 LinkKey link_key; /* Device link key */
217
218 public:
RemoteAddresstBTM_SEC_DEV_REC219 RawAddress RemoteAddress() const { return bd_addr; }
get_br_edr_hci_handletBTM_SEC_DEV_REC220 uint16_t get_br_edr_hci_handle() const { return hci_handle; }
221
222 private:
223 friend bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
224 BD_NAME bd_name, uint8_t* features,
225 LinkKey* p_link_key, uint8_t key_type,
226 uint8_t pin_length);
227 friend void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res,
228 uint8_t pin_len, uint8_t* p_pin);
229 friend void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status);
230 friend void btm_sec_connected(const RawAddress& bda, uint16_t handle,
231 tHCI_STATUS status, uint8_t enc_mode,
232 tHCI_ROLE);
233 friend void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status,
234 uint8_t encr_enable);
235 friend void btm_sec_link_key_notification(const RawAddress& p_bda,
236 const Octet16& link_key,
237 uint8_t key_type);
238 friend tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
239 tBT_TRANSPORT transport,
240 uint8_t pin_len, uint8_t* p_pin);
241 uint8_t pin_code_length; /* Length of the pin_code used for paring */
242
243 public:
244 uint16_t sec_flags; /* Current device security state */
is_device_authenticatedtBTM_SEC_DEV_REC245 bool is_device_authenticated() const {
246 return sec_flags & BTM_SEC_AUTHENTICATED;
247 }
set_device_authenticatedtBTM_SEC_DEV_REC248 void set_device_authenticated() { sec_flags |= BTM_SEC_AUTHENTICATED; }
reset_device_authenticatedtBTM_SEC_DEV_REC249 void reset_device_authenticated() { sec_flags &= ~BTM_SEC_AUTHENTICATED; }
250
is_device_encryptedtBTM_SEC_DEV_REC251 bool is_device_encrypted() const { return sec_flags & BTM_SEC_ENCRYPTED; }
set_device_encryptedtBTM_SEC_DEV_REC252 void set_device_encrypted() { sec_flags |= BTM_SEC_ENCRYPTED; }
reset_device_encryptedtBTM_SEC_DEV_REC253 void reset_device_encrypted() { sec_flags &= ~BTM_SEC_ENCRYPTED; }
254
is_name_knowntBTM_SEC_DEV_REC255 bool is_name_known() const { return sec_flags & BTM_SEC_NAME_KNOWN; }
set_device_knowntBTM_SEC_DEV_REC256 void set_device_known() { sec_flags |= BTM_SEC_NAME_KNOWN; }
reset_device_knowntBTM_SEC_DEV_REC257 void reset_device_known() { sec_flags &= ~BTM_SEC_NAME_KNOWN; }
258
is_link_key_knowntBTM_SEC_DEV_REC259 bool is_link_key_known() const { return sec_flags & BTM_SEC_LINK_KEY_KNOWN; }
set_link_key_knowntBTM_SEC_DEV_REC260 void set_link_key_known() { sec_flags |= BTM_SEC_LINK_KEY_KNOWN; }
reset_link_key_knowntBTM_SEC_DEV_REC261 void reset_link_key_known() { sec_flags &= ~BTM_SEC_LINK_KEY_KNOWN; }
262
is_link_key_authenticatedtBTM_SEC_DEV_REC263 bool is_link_key_authenticated() const {
264 return sec_flags & BTM_SEC_LINK_KEY_AUTHED;
265 }
set_link_key_authenticatedtBTM_SEC_DEV_REC266 void set_link_key_authenticated() { sec_flags |= BTM_SEC_LINK_KEY_AUTHED; }
reset_link_key_authenticatedtBTM_SEC_DEV_REC267 void reset_link_key_authenticated() { sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED; }
268
is_le_device_authenticatedtBTM_SEC_DEV_REC269 bool is_le_device_authenticated() const {
270 return sec_flags & BTM_SEC_LE_AUTHENTICATED;
271 }
set_le_device_authenticatedtBTM_SEC_DEV_REC272 void set_le_device_authenticated() { sec_flags |= BTM_SEC_LE_AUTHENTICATED; }
reset_le_device_authenticatedtBTM_SEC_DEV_REC273 void reset_le_device_authenticated() {
274 sec_flags &= ~BTM_SEC_LE_AUTHENTICATED;
275 }
276
is_le_device_encryptedtBTM_SEC_DEV_REC277 bool is_le_device_encrypted() const {
278 return sec_flags & BTM_SEC_LE_ENCRYPTED;
279 }
set_le_device_encryptedtBTM_SEC_DEV_REC280 void set_le_device_encrypted() { sec_flags |= BTM_SEC_LE_ENCRYPTED; }
reset_le_device_encryptedtBTM_SEC_DEV_REC281 void reset_le_device_encrypted() { sec_flags &= ~BTM_SEC_LE_ENCRYPTED; }
282
is_le_link_key_knowntBTM_SEC_DEV_REC283 bool is_le_link_key_known() const {
284 return sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN;
285 }
set_le_link_key_knowntBTM_SEC_DEV_REC286 void set_le_link_key_known() { sec_flags |= BTM_SEC_LE_LINK_KEY_KNOWN; }
reset_le_link_key_knowntBTM_SEC_DEV_REC287 void reset_le_link_key_known() { sec_flags &= ~BTM_SEC_LE_LINK_KEY_KNOWN; }
288
is_le_link_key_authenticatedtBTM_SEC_DEV_REC289 bool is_le_link_key_authenticated() const {
290 return sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED;
291 }
set_le_link_key_authenticatedtBTM_SEC_DEV_REC292 void set_le_link_key_authenticated() {
293 sec_flags |= BTM_SEC_LE_LINK_KEY_AUTHED;
294 }
reset_le_link_key_authenticatedtBTM_SEC_DEV_REC295 void reset_le_link_key_authenticated() {
296 sec_flags &= ~BTM_SEC_LE_LINK_KEY_AUTHED;
297 }
298
is_le_link_16_digit_key_authenticatedtBTM_SEC_DEV_REC299 bool is_le_link_16_digit_key_authenticated() const {
300 return sec_flags & BTM_SEC_16_DIGIT_PIN_AUTHED;
301 }
set_le_link_16_digit_key_authenticatedtBTM_SEC_DEV_REC302 void set_le_link_16_digit_key_authenticated() {
303 sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
304 }
reset_le_link_16_digit_key_authenticatedtBTM_SEC_DEV_REC305 void reset_le_link_16_digit_key_authenticated() {
306 sec_flags &= ~BTM_SEC_16_DIGIT_PIN_AUTHED;
307 }
308
309 tBTM_BD_NAME sec_bd_name; /* User friendly name of the device. (may be
310 truncated to save space in dev_rec table) */
311
312 uint8_t sec_state; /* Operating state */
is_security_state_idletBTM_SEC_DEV_REC313 bool is_security_state_idle() const {
314 return sec_state == BTM_SEC_STATE_IDLE;
315 }
is_security_state_authenticatingtBTM_SEC_DEV_REC316 bool is_security_state_authenticating() const {
317 return sec_state == BTM_SEC_STATE_AUTHENTICATING;
318 }
is_security_state_encryptingtBTM_SEC_DEV_REC319 bool is_security_state_encrypting() const {
320 return sec_state == BTM_SEC_STATE_ENCRYPTING;
321 }
is_security_state_getting_nametBTM_SEC_DEV_REC322 bool is_security_state_getting_name() const {
323 return sec_state == BTM_SEC_STATE_GETTING_NAME;
324 }
is_security_state_authorizingtBTM_SEC_DEV_REC325 bool is_security_state_authorizing() const {
326 return sec_state == BTM_SEC_STATE_AUTHORIZING;
327 }
is_security_state_switching_roletBTM_SEC_DEV_REC328 bool is_security_state_switching_role() const {
329 return sec_state == BTM_SEC_STATE_SWITCHING_ROLE;
330 }
is_security_state_disconnectingtBTM_SEC_DEV_REC331 bool is_security_state_disconnecting() const {
332 return sec_state == BTM_SEC_STATE_DISCONNECTING;
333 }
is_security_state_wait_for_encryptiontBTM_SEC_DEV_REC334 bool is_security_state_wait_for_encryption() const {
335 return sec_state == BTM_SEC_STATE_DELAY_FOR_ENC;
336 }
is_security_state_ble_disconnectingtBTM_SEC_DEV_REC337 bool is_security_state_ble_disconnecting() const {
338 return sec_state == BTM_SEC_STATE_DISCONNECTING_BLE;
339 }
is_security_state_br_edr_and_bletBTM_SEC_DEV_REC340 bool is_security_state_br_edr_and_ble() const {
341 return sec_state == BTM_SEC_STATE_DISCONNECTING_BOTH;
342 }
343
344 private:
345 bool is_originator; /* true if device is originating connection */
346 friend tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
347 tBT_TRANSPORT transport,
348 tBTM_SEC_CALLBACK* p_callback,
349 void* p_ref_data,
350 tBTM_BLE_SEC_ACT sec_act);
351 friend tBTM_STATUS btm_sec_l2cap_access_req_by_requirement(
352 const RawAddress& bd_addr, uint16_t security_required, bool is_originator,
353 tBTM_SEC_CALLBACK* p_callback, void* p_ref_data);
354 friend tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr,
355 bool is_originator,
356 uint16_t security_required,
357 tBTM_SEC_CALLBACK* p_callback,
358 void* p_ref_data);
359
360 public:
IsLocallyInitiatedtBTM_SEC_DEV_REC361 bool IsLocallyInitiated() const { return is_originator; }
362
363 bool role_central; /* true if current mode is central */
364 uint16_t security_required; /* Security required for connection */
365 bool link_key_not_sent; /* link key notification has not been sent waiting for
366 name */
367 uint8_t link_key_type; /* Type of key used in pairing */
368
369 uint8_t sm4; /* BTM_SM4_TRUE, if the peer supports SM4 */
370 tBTM_IO_CAP rmt_io_caps; /* IO capability of the peer device */
371 tBTM_AUTH_REQ rmt_auth_req; /* the auth_req flag as in the IO caps rsp evt */
372
373 bool remote_supports_secure_connections;
374 friend void btm_sec_set_peer_sec_caps(uint16_t hci_handle, bool ssp_supported,
375 bool sc_supported,
376 bool hci_role_switch_supported,
377 bool br_edr_supported,
378 bool le_supported);
379
380 public:
SupportsSecureConnectionstBTM_SEC_DEV_REC381 bool SupportsSecureConnections() const {
382 return remote_supports_secure_connections;
383 }
384
385 bool remote_features_needed; /* set to true if the local device is in */
386 /* "Secure Connections Only" mode and it receives */
387 /* HCI_IO_CAPABILITY_REQUEST_EVT from the peer before */
388 /* it knows peer's support for Secure Connections */
389 bool remote_supports_hci_role_switch = false;
390 bool remote_supports_bredr;
391 bool remote_supports_ble;
392 bool remote_feature_received = false;
393
394 uint16_t ble_hci_handle; /* use in DUMO connection */
get_ble_hci_handletBTM_SEC_DEV_REC395 uint16_t get_ble_hci_handle() const { return ble_hci_handle; }
396
397 uint8_t enc_key_size; /* current link encryption key size */
get_encryption_key_sizetBTM_SEC_DEV_REC398 uint8_t get_encryption_key_size() const { return enc_key_size; }
399
400 tBT_DEVICE_TYPE device_type;
is_device_type_br_edrtBTM_SEC_DEV_REC401 bool is_device_type_br_edr() const {
402 return device_type == BT_DEVICE_TYPE_BREDR;
403 }
is_device_type_bletBTM_SEC_DEV_REC404 bool is_device_type_ble() const { return device_type == BT_DEVICE_TYPE_BLE; }
is_device_type_dual_modetBTM_SEC_DEV_REC405 bool is_device_type_dual_mode() const {
406 return device_type == BT_DEVICE_TYPE_DUMO;
407 }
408
is_device_type_has_bletBTM_SEC_DEV_REC409 bool is_device_type_has_ble() const {
410 return device_type & BT_DEVICE_TYPE_BLE;
411 }
412 bool new_encryption_key_is_p256; /* Set to true when the newly generated LK
413 ** is generated from P-256.
414 ** Link encrypted with such LK can be used
415 ** for SM over BR/EDR.
416 */
417 tBTM_BOND_TYPE bond_type; /* peering bond type */
is_bond_type_unknowntBTM_SEC_DEV_REC418 bool is_bond_type_unknown() const { return bond_type == BOND_TYPE_UNKNOWN; }
is_bond_type_persistenttBTM_SEC_DEV_REC419 bool is_bond_type_persistent() const {
420 return bond_type == BOND_TYPE_PERSISTENT;
421 }
is_bond_type_temporarytBTM_SEC_DEV_REC422 bool is_bond_type_temporary() const {
423 return bond_type == BOND_TYPE_TEMPORARY;
424 }
425
426 tBTM_SEC_BLE ble;
427 tBTM_LE_CONN_PRAMS conn_params;
428
429 tREMOTE_VERSION_INFO remote_version_info;
430
ToStringtBTM_SEC_DEV_REC431 std::string ToString() const {
432 return base::StringPrintf(
433 "%s %6s cod:%s remote_info:%-14s sm4:0x%02x SecureConn:%c name:\"%s\"",
434 PRIVATE_ADDRESS(bd_addr), DeviceTypeText(device_type).c_str(),
435 class_of_device_text(dev_class).c_str(),
436 remote_version_info.ToString().c_str(), sm4,
437 (remote_supports_secure_connections) ? 'T' : 'F', sec_bd_name);
438 }
439 };
440