From bb09604f2e73f17922cd5354c35d9dd28f1a6001 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 30 Mar 2018 22:22:19 +0200 Subject: [PATCH] sm: request signing key only when bonding and ENABLE_LE_SIGNED_WRITE --- src/ble/sm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index 38c23cb18..50c069514 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -1146,10 +1146,14 @@ static void sm_done_for_handle(hci_con_handle_t con_handle){ } static int sm_key_distribution_flags_for_auth_req(void){ - int flags = SM_KEYDIST_ID_KEY | SM_KEYDIST_SIGN; + + int flags = SM_KEYDIST_ID_KEY; if (sm_auth_req & SM_AUTHREQ_BONDING){ - // encryption information only if bonding requested + // encryption and signing information only if bonding requested flags |= SM_KEYDIST_ENC_KEY; +#ifdef ENABLE_LE_SIGNED_WRITE + flags | = SM_KEYDIST_SIGN; +#endif } return flags; }