mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
ng_hci: add support for Bluetooth Secure Simple Pairing
Add additional messages that allow for secure simple pairing. PR: 265066 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (review and commit)
This commit is contained in:
parent
c6767dc1f2
commit
4ae0fa8a2f
3 changed files with 82 additions and 0 deletions
|
|
@ -614,8 +614,10 @@ process_hc_baseband_params(ng_hci_unit_p unit, u_int16_t ocf,
|
|||
case NG_HCI_OCF_READ_LOCAL_NAME:
|
||||
case NG_HCI_OCF_READ_UNIT_CLASS:
|
||||
case NG_HCI_OCF_WRITE_UNIT_CLASS:
|
||||
case NG_HCI_OCF_WRITE_SIMPLE_PAIRING:
|
||||
case NG_HCI_OCF_READ_LE_HOST_SUPPORTED:
|
||||
case NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED:
|
||||
case NG_HCI_OCF_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT:
|
||||
/* These do not need post processing */
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ ng_hci_process_event(ng_hci_unit_p unit, struct mbuf *event)
|
|||
case NG_HCI_EVENT_VENDOR:
|
||||
case NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL:
|
||||
case NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL:
|
||||
case NG_HCI_EVENT_IO_CAPABILITY_REQUEST:
|
||||
case NG_HCI_EVENT_SIMPLE_PAIRING_COMPLETE:
|
||||
/* These do not need post processing */
|
||||
NG_FREE_M(event);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@
|
|||
#define NG_HCI_LMP_FLOW_CONTROL_LAG0 0x10
|
||||
#define NG_HCI_LMP_FLOW_CONTROL_LAG1 0x20
|
||||
#define NG_HCI_LMP_FLOW_CONTROL_LAG2 0x40
|
||||
/* ------------------- byte 6 --------------------*/
|
||||
#define NG_HCI_LMP_SECURE_SIMPLE_PAIRING 0x08
|
||||
|
||||
/* Link types */
|
||||
#define NG_HCI_LINK_SCO 0x00 /* Voice */
|
||||
|
|
@ -860,6 +862,50 @@ typedef struct {
|
|||
} __attribute__ ((packed)) ng_hci_read_clock_offset_cp;
|
||||
/* No return parameter(s) */
|
||||
|
||||
#define NG_HCI_IO_CAPABILITY_REQUEST_REPLY 0x002b
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
u_int8_t io_capability;
|
||||
u_int8_t oob_data_present;
|
||||
u_int8_t authentication_requirements;
|
||||
} __attribute__ ((packed)) ng_hci_io_capability_request_reply_cp;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_io_capability_request_reply_rp;
|
||||
|
||||
#define NG_HCI_USER_CONFIRMATION_REQUEST_REPLY 0x002c
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_cp;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_rp;
|
||||
|
||||
#define NG_HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY 0x002d
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__((packed)) ng_hci_user_confirmation_request_negative_reply_cp;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_user_confirmation_request_negative_reply_rp;
|
||||
|
||||
#define NG_HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY 0x0034
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
u_int8_t reason;
|
||||
} __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_cp;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_rp;
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
** Link policy commands and return parameters
|
||||
|
|
@ -1374,6 +1420,13 @@ typedef struct {
|
|||
|
||||
typedef ng_hci_status_rp ng_hci_write_page_scan_rp;
|
||||
|
||||
#define NG_HCI_OCF_WRITE_SIMPLE_PAIRING 0x0056
|
||||
typedef struct {
|
||||
u_int8_t simple_pairing; /* 1 -> enabled, 0 -> disabled */
|
||||
} __attribute__ ((packed)) ng_hci_write_simple_pairing_cp;
|
||||
|
||||
typedef ng_hci_status_rp ng_hci_write_simple_pairing_rp;
|
||||
|
||||
#define NG_HCI_OCF_READ_LE_HOST_SUPPORTED 0x6c
|
||||
typedef struct {
|
||||
u_int8_t status; /* 0x00 - success */
|
||||
|
|
@ -1389,6 +1442,13 @@ typedef struct {
|
|||
|
||||
typedef ng_hci_status_rp ng_hci_write_le_host_supported_rp;
|
||||
|
||||
#define NG_HCI_OCF_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT 0x007a
|
||||
typedef struct {
|
||||
u_int8_t support; /* 0 - disabled, 1 - enabled */
|
||||
} __attribute__ ((packed)) ng_hci_write_secure_connections_host_support_cp;
|
||||
|
||||
typedef ng_hci_status_rp ng_hci_write_secure_connections_host_support_rp;
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
** Informational commands and return parameters
|
||||
|
|
@ -2025,6 +2085,24 @@ typedef struct {
|
|||
bdaddr_t bdaddr; /* destination address */
|
||||
u_int8_t page_scan_rep_mode; /* page scan repetition mode */
|
||||
} __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep;
|
||||
|
||||
#define NG_HCI_EVENT_IO_CAPABILITY_REQUEST 0x31
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_io_capability_request_ep;
|
||||
|
||||
#define NG_HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
|
||||
typedef struct {
|
||||
bdaddr_t bdaddr;
|
||||
u_int32_t numeric_value;
|
||||
} __attribute__ ((packed)) ng_hci_user_confirmation_request_ep;
|
||||
|
||||
#define NG_HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36
|
||||
typedef struct {
|
||||
u_int8_t status;
|
||||
bdaddr_t bdaddr;
|
||||
} __attribute__ ((packed)) ng_hci_simple_pairing_complete_ep;
|
||||
|
||||
#define NG_HCI_EVENT_LE 0x3e
|
||||
typedef struct {
|
||||
u_int8_t subevent_code;
|
||||
|
|
|
|||
Loading…
Reference in a new issue