Loading system/bta/dm/bta_dm_sec.cc +2 −1 Original line number Diff line number Diff line Loading @@ -494,9 +494,10 @@ static tBTM_STATUS bta_dm_sp_cback(tBTM_SP_EVT event, break; case BTM_SP_LOC_OOB_EVT: // BR/EDR OOB pairing is not supported with Secure Connections btif_dm_proc_loc_oob(BT_TRANSPORT_BR_EDR, (bool)(p_data->loc_oob.status == BTM_SUCCESS), p_data->loc_oob.c, p_data->loc_oob.r); p_data->loc_oob.c_192, p_data->loc_oob.r_192); break; case BTM_SP_RMT_OOB_EVT: { Loading system/stack/btm/btm_sec.cc +8 −1 Original line number Diff line number Diff line Loading @@ -1263,7 +1263,14 @@ void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, * LM * ******************************************************************************/ void BTM_ReadLocalOobData(void) { btsnd_hcic_read_local_oob_data(); } void BTM_ReadLocalOobData(void) { if (com::android::bluetooth::flags::use_local_oob_extended_command() && bluetooth::shim::GetController()->SupportsSecureConnections()) { btsnd_hcic_read_local_oob_extended_data(); } else { btsnd_hcic_read_local_oob_data(); } } /******************************************************************************* * Loading system/stack/btu/btu_hcif.cc +34 −3 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ static void btu_hcif_create_conn_cancel_complete(const uint8_t* p, uint16_t evt_len); static void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len); static void btu_hcif_read_local_oob_extended_complete(const uint8_t* p, uint16_t evt_len); /* Simple Pairing Events */ static void btu_hcif_io_cap_request_evt(const uint8_t* p); Loading Loading @@ -494,6 +496,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd, } break; case HCI_READ_LOCAL_OOB_DATA: case HCI_READ_LOCAL_OOB_EXTENDED_DATA: log_classic_pairing_event(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, Loading Loading @@ -628,6 +631,7 @@ static void btu_hcif_log_command_complete_metrics( switch (opcode) { case HCI_DELETE_STORED_LINK_KEY: case HCI_READ_LOCAL_OOB_DATA: case HCI_READ_LOCAL_OOB_EXTENDED_DATA: case HCI_WRITE_SIMPLE_PAIRING_MODE: case HCI_WRITE_SECURE_CONNS_SUPPORT: STREAM_TO_UINT8(status, p_return_params); Loading Loading @@ -943,6 +947,10 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p, btu_hcif_read_local_oob_complete(p, evt_len); break; case HCI_READ_LOCAL_OOB_EXTENDED_DATA: btu_hcif_read_local_oob_extended_complete(p, evt_len); break; case HCI_READ_INQ_TX_POWER_LEVEL: break; Loading Loading @@ -1281,7 +1289,7 @@ void btu_hcif_create_conn_cancel_complete(const uint8_t* p, uint16_t evt_len) { btm_create_conn_cancel_complete(status, bd_addr); } void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len) { tBTM_SP_LOC_OOB evt_data; tBTM_SP_LOC_OOB evt_data = {}; uint8_t status; if (evt_len < 1) { goto err_out; Loading @@ -1295,8 +1303,8 @@ void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len) { if (evt_len < 32 + 1) { goto err_out; } STREAM_TO_ARRAY16(evt_data.c.data(), p); STREAM_TO_ARRAY16(evt_data.r.data(), p); STREAM_TO_ARRAY16(evt_data.c_192.data(), p); STREAM_TO_ARRAY16(evt_data.r_192.data(), p); btm_read_local_oob_complete(evt_data); return; Loading @@ -1304,6 +1312,29 @@ err_out: log::error("bogus event packet, too short"); } void btu_hcif_read_local_oob_extended_complete(const uint8_t* p, uint16_t evt_len) { if (evt_len < 64 + 1) { log::error("Invalid event length: {}", evt_len); return; } tBTM_SP_LOC_OOB evt_data = {}; uint8_t status; STREAM_TO_UINT8(status, p); if (status == HCI_SUCCESS) { evt_data.status = BTM_SUCCESS; } else { evt_data.status = BTM_ERR_PROCESSING; } STREAM_TO_ARRAY16(evt_data.c_192.data(), p); STREAM_TO_ARRAY16(evt_data.r_192.data(), p); STREAM_TO_ARRAY16(evt_data.c_256.data(), p); STREAM_TO_ARRAY16(evt_data.r_256.data(), p); btm_read_local_oob_complete(evt_data); } /******************************************************************************* * * Function btu_hcif_link_key_notification_evt Loading system/stack/hcic/hcicmds.cc +16 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,9 @@ /* Read Local OOB Data */ #define HCIC_PARAM_SIZE_R_LOCAL_OOB 0 /* Read Local OOB Extended Data */ #define HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED 0 #define HCIC_PARAM_SIZE_UCONF_REPLY 6 #define HCI_USER_CONF_BD_ADDR_OFF 0 Loading Loading @@ -1362,6 +1365,19 @@ void btsnd_hcic_read_local_oob_data(void) { btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_read_local_oob_extended_data(void) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED; p->offset = 0; UINT16_TO_STREAM(pp, HCI_READ_LOCAL_OOB_EXTENDED_DATA); UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED); btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); Loading system/stack/include/btm_sec_api_types.h +4 −2 Original line number Diff line number Diff line Loading @@ -338,8 +338,10 @@ typedef struct { /* data type for BTM_SP_LOC_OOB_EVT */ typedef struct { tBTM_STATUS status; /* */ Octet16 c; /* Simple Pairing Hash C */ Octet16 r; /* Simple Pairing Randomnizer R */ Octet16 c_192; /* Simple Pairing Hash C from P-192 public key */ Octet16 r_192; /* Simple Pairing Randomnizer R from P-192 public key */ Octet16 c_256; /* Simple Pairing Hash C from P-256 public key */ Octet16 r_256; /* Simple Pairing Randomnizer R from P-256 public key */ } tBTM_SP_LOC_OOB; /* data type for BTM_SP_RMT_OOB_EVT */ Loading Loading
system/bta/dm/bta_dm_sec.cc +2 −1 Original line number Diff line number Diff line Loading @@ -494,9 +494,10 @@ static tBTM_STATUS bta_dm_sp_cback(tBTM_SP_EVT event, break; case BTM_SP_LOC_OOB_EVT: // BR/EDR OOB pairing is not supported with Secure Connections btif_dm_proc_loc_oob(BT_TRANSPORT_BR_EDR, (bool)(p_data->loc_oob.status == BTM_SUCCESS), p_data->loc_oob.c, p_data->loc_oob.r); p_data->loc_oob.c_192, p_data->loc_oob.r_192); break; case BTM_SP_RMT_OOB_EVT: { Loading
system/stack/btm/btm_sec.cc +8 −1 Original line number Diff line number Diff line Loading @@ -1263,7 +1263,14 @@ void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, * LM * ******************************************************************************/ void BTM_ReadLocalOobData(void) { btsnd_hcic_read_local_oob_data(); } void BTM_ReadLocalOobData(void) { if (com::android::bluetooth::flags::use_local_oob_extended_command() && bluetooth::shim::GetController()->SupportsSecureConnections()) { btsnd_hcic_read_local_oob_extended_data(); } else { btsnd_hcic_read_local_oob_data(); } } /******************************************************************************* * Loading
system/stack/btu/btu_hcif.cc +34 −3 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ static void btu_hcif_create_conn_cancel_complete(const uint8_t* p, uint16_t evt_len); static void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len); static void btu_hcif_read_local_oob_extended_complete(const uint8_t* p, uint16_t evt_len); /* Simple Pairing Events */ static void btu_hcif_io_cap_request_evt(const uint8_t* p); Loading Loading @@ -494,6 +496,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd, } break; case HCI_READ_LOCAL_OOB_DATA: case HCI_READ_LOCAL_OOB_EXTENDED_DATA: log_classic_pairing_event(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, Loading Loading @@ -628,6 +631,7 @@ static void btu_hcif_log_command_complete_metrics( switch (opcode) { case HCI_DELETE_STORED_LINK_KEY: case HCI_READ_LOCAL_OOB_DATA: case HCI_READ_LOCAL_OOB_EXTENDED_DATA: case HCI_WRITE_SIMPLE_PAIRING_MODE: case HCI_WRITE_SECURE_CONNS_SUPPORT: STREAM_TO_UINT8(status, p_return_params); Loading Loading @@ -943,6 +947,10 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p, btu_hcif_read_local_oob_complete(p, evt_len); break; case HCI_READ_LOCAL_OOB_EXTENDED_DATA: btu_hcif_read_local_oob_extended_complete(p, evt_len); break; case HCI_READ_INQ_TX_POWER_LEVEL: break; Loading Loading @@ -1281,7 +1289,7 @@ void btu_hcif_create_conn_cancel_complete(const uint8_t* p, uint16_t evt_len) { btm_create_conn_cancel_complete(status, bd_addr); } void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len) { tBTM_SP_LOC_OOB evt_data; tBTM_SP_LOC_OOB evt_data = {}; uint8_t status; if (evt_len < 1) { goto err_out; Loading @@ -1295,8 +1303,8 @@ void btu_hcif_read_local_oob_complete(const uint8_t* p, uint16_t evt_len) { if (evt_len < 32 + 1) { goto err_out; } STREAM_TO_ARRAY16(evt_data.c.data(), p); STREAM_TO_ARRAY16(evt_data.r.data(), p); STREAM_TO_ARRAY16(evt_data.c_192.data(), p); STREAM_TO_ARRAY16(evt_data.r_192.data(), p); btm_read_local_oob_complete(evt_data); return; Loading @@ -1304,6 +1312,29 @@ err_out: log::error("bogus event packet, too short"); } void btu_hcif_read_local_oob_extended_complete(const uint8_t* p, uint16_t evt_len) { if (evt_len < 64 + 1) { log::error("Invalid event length: {}", evt_len); return; } tBTM_SP_LOC_OOB evt_data = {}; uint8_t status; STREAM_TO_UINT8(status, p); if (status == HCI_SUCCESS) { evt_data.status = BTM_SUCCESS; } else { evt_data.status = BTM_ERR_PROCESSING; } STREAM_TO_ARRAY16(evt_data.c_192.data(), p); STREAM_TO_ARRAY16(evt_data.r_192.data(), p); STREAM_TO_ARRAY16(evt_data.c_256.data(), p); STREAM_TO_ARRAY16(evt_data.r_256.data(), p); btm_read_local_oob_complete(evt_data); } /******************************************************************************* * * Function btu_hcif_link_key_notification_evt Loading
system/stack/hcic/hcicmds.cc +16 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,9 @@ /* Read Local OOB Data */ #define HCIC_PARAM_SIZE_R_LOCAL_OOB 0 /* Read Local OOB Extended Data */ #define HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED 0 #define HCIC_PARAM_SIZE_UCONF_REPLY 6 #define HCI_USER_CONF_BD_ADDR_OFF 0 Loading Loading @@ -1362,6 +1365,19 @@ void btsnd_hcic_read_local_oob_data(void) { btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_read_local_oob_extended_data(void) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED; p->offset = 0; UINT16_TO_STREAM(pp, HCI_READ_LOCAL_OOB_EXTENDED_DATA); UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_R_LOCAL_OOB_EXTENDED); btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); } void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes) { BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); uint8_t* pp = (uint8_t*)(p + 1); Loading
system/stack/include/btm_sec_api_types.h +4 −2 Original line number Diff line number Diff line Loading @@ -338,8 +338,10 @@ typedef struct { /* data type for BTM_SP_LOC_OOB_EVT */ typedef struct { tBTM_STATUS status; /* */ Octet16 c; /* Simple Pairing Hash C */ Octet16 r; /* Simple Pairing Randomnizer R */ Octet16 c_192; /* Simple Pairing Hash C from P-192 public key */ Octet16 r_192; /* Simple Pairing Randomnizer R from P-192 public key */ Octet16 c_256; /* Simple Pairing Hash C from P-256 public key */ Octet16 r_256; /* Simple Pairing Randomnizer R from P-256 public key */ } tBTM_SP_LOC_OOB; /* data type for BTM_SP_RMT_OOB_EVT */ Loading