From nobody Mon Jan 27 13:28:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YhTkm1Q1lz5ldRH; Mon, 27 Jan 2025 13:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YhTkm0jp1z4663; Mon, 27 Jan 2025 13:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737984496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h0ofHql0BTm2o0hUSN9ewNNkHYDMsjj9hMeAt5mc49I=; b=iA3OFp4cTzisbq8f8L7QJTi24+CEAHyCmJ2ubDmEFArJlNTlck+fEFKPrfLre2syhDloio 3QgHNC98ma9X0oaeWeunyFW7NndAFMGUlpjBnlz5BgRZqJ9Qk3byCGuKzdWjXgoC035RsP 829y/wUd1OB0OAOKCEsasHaYHIJPUcTMKuuTRfdgvs1KRhhQ5AuYrexsPgknhAiyi7wMZ/ ymsiBfG6HGRVQnyYciRaTWySz9A8GQLEmejw+O46clf+PnDr4jag8BAykj4VxJxhrZ2Zk1 xRzXzWtNH/NnqTAf94/YVFuljfTNGOQqFg57Ddf4ZUl6i98xiZpwdlz+UiqQzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737984496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h0ofHql0BTm2o0hUSN9ewNNkHYDMsjj9hMeAt5mc49I=; b=B0mVh8kGO5s/5YBbqUAK9cTIWe2mO+9Iklbxjbw1isrkn/l2fNeOkbtMnFVhDDd0x3idkM WzSXNt6GmPRep57FSlC43w7TkpcjCFy6TbZm40KWi5OZOF9nkPSWThEuO2TgPYlbg+hwRF ELUNHQkvuLYmztxIJSN/f5hU8Ho9tzBnd/pkGIvOp//dV0QIHcFLk3KNgyGX6UM0f3kN9j W65aOTdV9F9rhfSDoCRdbwGjQhbhtW10lQW+tICyKx0lfmSGjMhDfN82jnkcZ+ofiz+O5m K7O0hPDRWfbKpb2jhBTRrTSaAsU+w4hTlhHPE2LF0Vj1AMH7dDvkl2qJBUlaFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737984496; a=rsa-sha256; cv=none; b=ycDSzBUrx7kXqJhoGywZ+nM2fuHgJYYzenFERxZcGISC+D0bFiaJbUL5jw7qgurJ11FRzh 6b+iAymu1rgQLfrOSqkSVz4qrR73r/1X1xUwYvYeCckIwfr1OMY6dpExp7gOaIVlB7LoE/ Bptlps78zwWvz7JlIRsxdxd+eqXjJTaIcye9Jj5+q5EQhCzn+tfpzZ8cYLl9Bq4pxS/ZfD uA3nYOYomh5N1Mq1Bf3NFyXVmoT90OeGbBet9XAZT3JXCP2JzomjgNZM1N/xhOloGqY/Uk QvPrLfM4tbEzYsFCFc26SL9VHSJsGSddFBRrjEfSVfFcNKwM1+eaCudYSgZPHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YhTkm0GhjzTpL; Mon, 27 Jan 2025 13:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50RDSFJ3050601; Mon, 27 Jan 2025 13:28:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50RDSFvs050598; Mon, 27 Jan 2025 13:28:15 GMT (envelope-from git) Date: Mon, 27 Jan 2025 13:28:15 GMT Message-Id: <202501271328.50RDSFvs050598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4ae0fa8a2f8b - main - ng_hci: add support for Bluetooth Secure Simple Pairing List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ae0fa8a2f8bff9a5e96dbfd862b03172c88e697 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4ae0fa8a2f8bff9a5e96dbfd862b03172c88e697 commit 4ae0fa8a2f8bff9a5e96dbfd862b03172c88e697 Author: Andreas Kempe AuthorDate: 2025-01-27 13:20:27 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-01-27 13:27:28 +0000 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) --- sys/netgraph/bluetooth/hci/ng_hci_cmds.c | 2 + sys/netgraph/bluetooth/hci/ng_hci_evnt.c | 2 + sys/netgraph/bluetooth/include/ng_hci.h | 78 ++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c index 897a8ed2e917..489ad3a01ee3 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c @@ -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; diff --git a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c index 7d7e1688dcbf..b6836b8843d7 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c @@ -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; diff --git a/sys/netgraph/bluetooth/include/ng_hci.h b/sys/netgraph/bluetooth/include/ng_hci.h index e4d33d8661ba..44a14e62f4ed 100644 --- a/sys/netgraph/bluetooth/include/ng_hci.h +++ b/sys/netgraph/bluetooth/include/ng_hci.h @@ -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;