bluetooth: ssp: support pairing_accept for ssp
when receiving the io cap request from controller, call pairing_accept to check whether application accept the pairing. If no, reply BT_HCI_OP_IO_CAPABILITY_NEG_REPLY. Signed-off-by: Mark Wang <yichang.wang@nxp.com>
This commit is contained in:
parent
56fd854423
commit
fb811f1599
2 changed files with 15 additions and 1 deletions
|
@ -2195,7 +2195,8 @@ struct bt_conn_auth_cb {
|
||||||
* This callback may be unregistered in which case pairing continues
|
* This callback may be unregistered in which case pairing continues
|
||||||
* as if the Kconfig flag was not set.
|
* as if the Kconfig flag was not set.
|
||||||
*
|
*
|
||||||
* This callback is not called for BR/EDR Secure Simple Pairing (SSP).
|
* For BR/EDR Secure Simple Pairing (SSP), this callback is called
|
||||||
|
* when receiving the BT_HCI_EVT_IO_CAPA_REQ hci event.
|
||||||
*
|
*
|
||||||
* @param conn Connection where pairing is initiated.
|
* @param conn Connection where pairing is initiated.
|
||||||
* @param feat Pairing req/resp info.
|
* @param feat Pairing req/resp info.
|
||||||
|
|
|
@ -650,6 +650,19 @@ void bt_hci_io_capa_req(struct net_buf *buf)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
|
||||||
|
if (bt_auth && bt_auth->pairing_accept) {
|
||||||
|
enum bt_security_err err;
|
||||||
|
|
||||||
|
err = bt_auth->pairing_accept(conn, NULL);
|
||||||
|
if (err != BT_SECURITY_ERR_SUCCESS) {
|
||||||
|
io_capa_neg_reply(&evt->bdaddr,
|
||||||
|
BT_HCI_ERR_PAIRING_NOT_ALLOWED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_REPLY,
|
resp_buf = bt_hci_cmd_create(BT_HCI_OP_IO_CAPABILITY_REPLY,
|
||||||
sizeof(*cp));
|
sizeof(*cp));
|
||||||
if (!resp_buf) {
|
if (!resp_buf) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue