From 26c3dd41b294b7f6d0ca7198b00ed1e1ef32dfb9 Mon Sep 17 00:00:00 2001 From: Nitin Arora Date: Thu, 25 Jun 2015 10:48:56 -0700 Subject: [PATCH] Fail LE secure pairing for secure only peripherals This change allows the host peripheral which initiates the pairing to reject the pairing in case the remote does not support secure LE connections and the host DUT is in secure connections only mode. Bug: 22203134 Change-Id: If58f791cb575d6b66c361f58e574b613d5686047 --- stack/smp/smp_act.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c index 334649ad0..c0c7da7f6 100644 --- a/stack/smp/smp_act.c +++ b/stack/smp/smp_act.c @@ -549,11 +549,22 @@ void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) } else /* update local i/r key according to pairing request */ { - /* paring started with this side (slave) sending Security Request */ + /* pairing started with this side (slave) sending Security Request */ p_cb->local_i_key &= p_cb->peer_i_key; p_cb->local_r_key &= p_cb->peer_r_key; p_cb->selected_association_model = smp_select_association_model(p_cb); + if (p_cb->secure_connections_only_mode_required && + (!(p_cb->le_secure_connections_mode_is_used) || + (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_JUSTWORKS))) + { + SMP_TRACE_ERROR("%s pairing failed - slave requires secure connection only mode", + __func__); + reason = SMP_PAIR_AUTH_FAIL; + smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); + return; + } + if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_OOB) { if (smp_request_oob_data(p_cb)) return; -- 2.11.0