mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: component/bt: Check own address and filter policy for validity.
This commit is contained in:
parent
195358ddb7
commit
3453824bf2
@ -77,22 +77,6 @@ typedef enum {
|
||||
/// Bluetooth device address
|
||||
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
||||
|
||||
/// Own BD address source of the device
|
||||
typedef enum {
|
||||
/// Public Address
|
||||
BD_ADDR_PUBLIC,
|
||||
/// Provided random address
|
||||
BD_ADDR_PROVIDED_RND,
|
||||
/// Provided static random address
|
||||
BD_ADDR_GEN_STATIC_RND,
|
||||
/// Generated resolvable private random address
|
||||
BD_ADDR_GEN_RSLV,
|
||||
/// Generated non-resolvable private random address
|
||||
BD_ADDR_GEN_NON_RSLV,
|
||||
/// Provided Reconnection address
|
||||
BD_ADDR_PROVIDED_RECON,
|
||||
} esp_bd_addr_type_t;
|
||||
|
||||
/// BLE device address type
|
||||
typedef enum {
|
||||
BLE_ADDR_TYPE_PUBLIC = 0x00,
|
||||
|
@ -204,22 +204,6 @@ typedef struct {
|
||||
uint8_t flag; /*!< Advertising flag of discovery mode, see BLE_ADV_DATA_FLAG detail */
|
||||
} esp_ble_adv_data_t;
|
||||
|
||||
/// Own BD address source of the device
|
||||
typedef enum {
|
||||
/// Public Address
|
||||
ESP_PUBLIC_ADDR,
|
||||
/// Provided random address
|
||||
ESP_PROVIDED_RND_ADDR,
|
||||
/// Provided static random address
|
||||
ESP_GEN_STATIC_RND_ADDR,
|
||||
/// Generated resolvable private random address
|
||||
ESP_GEN_RSLV_ADDR,
|
||||
/// Generated non-resolvable private random address
|
||||
ESP_GEN_NON_RSLV_ADDR,
|
||||
/// Provided Reconnection address
|
||||
ESP_PROVIDED_RECON_ADDR,
|
||||
} esp_ble_own_addr_src_t;
|
||||
|
||||
/// Ble scan type
|
||||
typedef enum {
|
||||
BLE_SCAN_TYPE_PASSIVE = 0x0, /*!< Passive scan */
|
||||
@ -299,7 +283,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
esp_bt_octet16_t irk; /*!< The irk value */
|
||||
esp_bd_addr_type_t addr_type; /*!< The address type */
|
||||
esp_ble_addr_type_t addr_type; /*!< The address type */
|
||||
esp_bd_addr_t static_addr; /*!< The static address */
|
||||
}esp_ble_pid_keys_t; /*!< The pid key type */
|
||||
|
||||
@ -351,7 +335,7 @@ typedef union
|
||||
esp_ble_pcsrk_keys_t pcsrk_key; /*!< received peer device SRK */
|
||||
esp_ble_pid_keys_t pid_key; /*!< peer device ID key */
|
||||
esp_ble_lenc_keys_t lenc_key; /*!< local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
|
||||
esp_ble_lcsrk_keys lcsrk_key; /*!< local device CSRK = d1(ER,DIV,1)*/
|
||||
esp_ble_lcsrk_keys lcsrk_key; /*!< local device CSRK = d1(ER,DIV,1)*/
|
||||
}esp_ble_key_value_t; /*!< ble key value type*/
|
||||
|
||||
|
||||
@ -386,7 +370,7 @@ typedef struct
|
||||
uint8_t key_type; /*!< The type of Link Key */
|
||||
bool success; /*!< TRUE of authentication succeeded, FALSE if failed. */
|
||||
uint8_t fail_reason; /*!< The HCI reason/error code for when success=FALSE */
|
||||
esp_bd_addr_type_t addr_type; /*!< Peer device address type */
|
||||
esp_ble_addr_type_t addr_type; /*!< Peer device address type */
|
||||
esp_bt_dev_type_t dev_type; /*!< Device type */
|
||||
}esp_ble_auth_cmpl_t; /*!< The ble authentication complite cb type */
|
||||
|
||||
|
@ -465,8 +465,10 @@ static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status)
|
||||
static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback)
|
||||
{
|
||||
if (BLE_ISVALID_PARAM(scan_params->scan_interval, BTM_BLE_SCAN_INT_MIN, BTM_BLE_SCAN_INT_MAX) &&
|
||||
BLE_ISVALID_PARAM(scan_params->scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX) &&
|
||||
(scan_params->scan_type == BTM_BLE_SCAN_MODE_ACTI || scan_params->scan_type == BTM_BLE_SCAN_MODE_PASS)) {
|
||||
BLE_ISVALID_PARAM(scan_params->scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX) &&
|
||||
BLE_ISVALID_PARAM(scan_params->own_addr_type, BLE_ADDR_TYPE_PUBLIC, BLE_ADDR_TYPE_RPA_RANDOM) &&
|
||||
BLE_ISVALID_PARAM(scan_params->scan_filter_policy, BLE_SCAN_FILTER_ALLOW_ALL, BLE_SCAN_FILTER_ALLOW_WLIST_PRA_DIR) &&
|
||||
(scan_params->scan_type == BTM_BLE_SCAN_MODE_ACTI || scan_params->scan_type == BTM_BLE_SCAN_MODE_PASS)) {
|
||||
BTA_DmSetBleScanFilterParams(ESP_DEFAULT_GATT_IF, /*client_if*/
|
||||
scan_params->scan_interval,
|
||||
scan_params->scan_window,
|
||||
|
@ -52,7 +52,7 @@ enum {
|
||||
#define HCI_H4_TASK_NAME "hciH4T"
|
||||
#define HCI_H4_QUEUE_NUM 60
|
||||
|
||||
#define BTU_TASK_STACK_SIZE (3584 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTU_TASK_STACK_SIZE (4096 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define BTU_TASK_PRIO (configMAX_PRIORITIES - 5)
|
||||
#define BTU_TASK_NAME "btuT"
|
||||
#define BTU_QUEUE_NUM 50
|
||||
|
Loading…
Reference in New Issue
Block a user