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

Commit 47e9c1a4 authored by Hui Peng's avatar Hui Peng Committed by Automerger Merge Worker
Browse files

Merge "Fix an OOB bug in set_data" into tm-dev am: 8473c8c6 am: daf5d462 am: 8df40829

parents 8651847a 8df40829
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -41,19 +41,6 @@ extern bt_interface_t bluetoothInterface;


namespace android {
namespace android {
// Both
// Both
// OOB_ADDRESS_SIZE is 6 bytes address + 1 byte address type
#define OOB_ADDRESS_SIZE 7
#define OOB_C_SIZE 16
#define OOB_R_SIZE 16
#define OOB_NAME_MAX_SIZE 256
// Classic
#define OOB_DATA_LEN_SIZE 2
#define OOB_COD_SIZE 3
// LE
#define OOB_TK_SIZE 16
#define OOB_LE_FLAG_SIZE 1
#define OOB_LE_ROLE_SIZE 1
#define OOB_LE_APPEARANCE_SIZE 2


#define TRANSPORT_AUTO 0
#define TRANSPORT_AUTO 0
#define TRANSPORT_BREDR 1
#define TRANSPORT_BREDR 1
+22 −9
Original line number Original line Diff line number Diff line
@@ -402,25 +402,38 @@ typedef struct {
  void* val;
  void* val;
} bt_property_t;
} bt_property_t;


// OOB_ADDRESS_SIZE is 6 bytes address + 1 byte address type
#define OOB_ADDRESS_SIZE 7
#define OOB_C_SIZE 16
#define OOB_R_SIZE 16
#define OOB_NAME_MAX_SIZE 256
// Classic
#define OOB_DATA_LEN_SIZE 2
#define OOB_COD_SIZE 3
// LE
#define OOB_TK_SIZE 16
#define OOB_LE_FLAG_SIZE 1
#define OOB_LE_ROLE_SIZE 1
#define OOB_LE_APPEARANCE_SIZE 2
/** Represents the actual Out of Band data itself */
/** Represents the actual Out of Band data itself */
typedef struct bt_oob_data_s {
typedef struct bt_oob_data_s {
  // Both
  // Both
  bool is_valid = false; /* Default to invalid data; force caller to verify */
  bool is_valid = false; /* Default to invalid data; force caller to verify */
  uint8_t address[7]; /* Bluetooth Device Address (6) plus Address Type (1) */
  uint8_t address[OOB_ADDRESS_SIZE];
  uint8_t c[16];      /* Simple Pairing Hash C-192/256 (Classic or LE) */
  uint8_t c[OOB_C_SIZE];      /* Simple Pairing Hash C-192/256 (Classic or LE) */
  uint8_t r[16];      /* Simple Pairing Randomizer R-192/256 (Classic or LE) */
  uint8_t r[OOB_R_SIZE];      /* Simple Pairing Randomizer R-192/256 (Classic or LE) */
  uint8_t device_name[256]; /* Name of the device */
  uint8_t device_name[OOB_NAME_MAX_SIZE]; /* Name of the device */


  // Classic
  // Classic
  uint8_t oob_data_length[2]; /* Classic only data Length. Value includes this
  uint8_t oob_data_length[OOB_DATA_LEN_SIZE]; /* Classic only data Length. Value includes this
                                                 in length */
                                                 in length */
  uint8_t class_of_device[2]; /* Class of Device (Classic or LE) */
  uint8_t class_of_device[OOB_COD_SIZE]; /* Class of Device (Classic or LE) */


  // LE
  // LE
  uint8_t le_device_role;   /* Supported and preferred role of device */
  uint8_t le_device_role;   /* Supported and preferred role of device */
  uint8_t sm_tk[16];        /* Security Manager TK Value (LE Only) */
  uint8_t sm_tk[OOB_TK_SIZE];        /* Security Manager TK Value (LE Only) */
  uint8_t le_flags;         /* LE Flags for discoverability and features */
  uint8_t le_flags;         /* LE Flags for discoverability and features */
  uint8_t le_appearance[2]; /* For the appearance of the device */
  uint8_t le_appearance[OOB_LE_APPEARANCE_SIZE]; /* For the appearance of the device */
} bt_oob_data_t;
} bt_oob_data_t;


/** Bluetooth Device Type */
/** Bluetooth Device Type */