From 16c24ea8d232a0bd3869d3de89a4b4ffd147d0da Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Wed, 7 Aug 2019 13:57:53 +0200 Subject: [PATCH] Bluetooth: SMP: Use error code for OOB data not available If no callback for oob data request is registered, or the user decided to abort authentication during OOB data request, we should return the error code for no OOB data available to indicate that the user does not have the correct OOB, or no OOB interface at all. Signed-off-by: Joakim Andersson --- subsys/bluetooth/host/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 617866b2310..40ef8d77b5c 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -3134,7 +3134,7 @@ static u8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf) return 0; } else { - return BT_SMP_ERR_UNSPECIFIED; + return BT_SMP_ERR_OOB_NOT_AVAIL; } default: return BT_SMP_ERR_UNSPECIFIED; @@ -3544,7 +3544,7 @@ static u8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) bt_auth->oob_data_request(smp->chan.chan.conn, &info); } else { - return BT_SMP_ERR_UNSPECIFIED; + return BT_SMP_ERR_OOB_NOT_AVAIL; } break; default: @@ -4658,6 +4658,7 @@ int bt_smp_auth_cancel(struct bt_conn *conn) case PASSKEY_CONFIRM: return smp_error(smp, BT_SMP_ERR_CONFIRM_FAILED); case LE_SC_OOB: + return smp_error(smp, BT_SMP_ERR_OOB_NOT_AVAIL); case JUST_WORKS: return smp_error(smp, BT_SMP_ERR_UNSPECIFIED); default: