Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abcf06b0 authored by Brian Delwiche's avatar Brian Delwiche Committed by Android Build Coastguard Worker
Browse files

Use encrypted link for avdtp and avctp channels

This is a backport of the AOSP changes for b/345258562.

Test: mmm packages/modules/Bluetooth
Bug: 345258562
Ignore-AOSP-First: security
Tag: #security
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d26e79ab057057cbfcafc5eaeaaf1581afebd007)
Merged-In: I4ef23f9dec4aaae6a526c11a7c2489159bd7fdf8
Change-Id: I4ef23f9dec4aaae6a526c11a7c2489159bd7fdf8
parent 755318b1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -63,9 +63,11 @@ void AVCT_Register() {
  /* initialize AVCTP data structures */
  memset(&avct_cb, 0, sizeof(tAVCT_CB));

  uint16_t sec = BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT;

  /* register PSM with L2CAP */
  L2CA_Register2(AVCT_PSM, avct_l2c_appl, true /* enable_snoop */, nullptr,
                 kAvrcMtu, 0, BTA_SEC_AUTHENTICATE);
                 kAvrcMtu, 0, sec);

  /* Include the browsing channel which uses eFCR */
  tL2CAP_ERTM_INFO ertm_info;
@@ -73,7 +75,7 @@ void AVCT_Register() {

  L2CA_Register2(AVCT_BR_PSM, avct_l2c_br_appl, true /*enable_snoop*/,
                 &ertm_info, kAvrcBrMtu, AVCT_MIN_BROWSE_MTU,
                 BTA_SEC_AUTHENTICATE);
                 sec);

  avct_cb.trace_level = avct_trace_level;
}
+3 −2
Original line number Diff line number Diff line
@@ -115,8 +115,9 @@ void avct_bcb_chnl_open(tAVCT_BCB* p_bcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) {

  /* call l2cap connect req */
  p_bcb->ch_state = AVCT_CH_CONN;
  p_bcb->ch_lcid =
      L2CA_ConnectReq2(AVCT_BR_PSM, p_lcb->peer_addr, BTA_SEC_AUTHENTICATE);
  p_bcb->ch_lcid = L2CA_ConnectReq2(AVCT_BR_PSM, p_lcb->peer_addr,
    BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT);

  if (p_bcb->ch_lcid == 0) {
    /* if connect req failed, send ourselves close event */
    tAVCT_LCB_EVT avct_lcb_evt;
+2 −1
Original line number Diff line number Diff line
@@ -190,7 +190,8 @@ void avct_lcb_chnl_open(tAVCT_LCB* p_lcb, UNUSED_ATTR tAVCT_LCB_EVT* p_data) {

  p_lcb->ch_state = AVCT_CH_CONN;
  p_lcb->ch_lcid =
      L2CA_ConnectReq2(AVCT_PSM, p_lcb->peer_addr, BTA_SEC_AUTHENTICATE);
      L2CA_ConnectReq2(AVCT_PSM, p_lcb->peer_addr,
                       BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT);
  if (p_lcb->ch_lcid == 0) {
    /* if connect req failed, send ourselves close event */
    tAVCT_LCB_EVT avct_lcb_evt;
+2 −1
Original line number Diff line number Diff line
@@ -548,7 +548,8 @@ void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb,

    /* call l2cap connect req */
    lcid =
        L2CA_ConnectReq2(AVDT_PSM, p_ccb->peer_addr, BTM_SEC_OUT_AUTHENTICATE);
        L2CA_ConnectReq2(AVDT_PSM, p_ccb->peer_addr,
                         BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT);
    if (lcid != 0) {
      /* if connect req ok, store tcid in lcid table  */
      avdtp_cb.ad.lcid_tbl[lcid] = avdt_ad_tc_tbl_to_idx(p_tbl);
+2 −1
Original line number Diff line number Diff line
@@ -95,9 +95,10 @@ void avdt_scb_transport_channel_timer_timeout(void* data) {
 *
 ******************************************************************************/
void AVDT_Register(AvdtpRcb* p_reg, tAVDT_CTRL_CBACK* p_cback) {
  uint16_t sec = BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT;
  /* register PSM with L2CAP */
  L2CA_Register2(AVDT_PSM, avdt_l2c_appl, true /* enable_snoop */, nullptr,
                 kAvdtpMtu, 0, BTA_SEC_AUTHENTICATE);
                 kAvdtpMtu, 0, sec);

  /* initialize AVDTP data structures */
  avdt_scb_init();