From b4343428754843f1c9c2452a8fe786c6ae2334fe Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 13 May 2016 11:55:17 +0200 Subject: [PATCH] sm: add SM_STK_GENERATION_METHOD_NUMERIC_COMPARISON --- src/ble/sm.c | 6 ++++-- src/bluetooth.h | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index ff4070aa3..426298e5d 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -2537,7 +2537,7 @@ static int sm_validate_stk_generation_method(void){ case OOB: return (sm_accepted_stk_generation_methods & SM_STK_GENERATION_METHOD_OOB) != 0; case NK_BOTH_INPUT: - // TODO check sm_accepted_stk_generation_methods + return (sm_accepted_stk_generation_methods & SM_STK_GENERATION_METHOD_NUMERIC_COMPARISON) != 0; return 1; default: return 0; @@ -2885,7 +2885,9 @@ void sm_init(void){ // defaults sm_accepted_stk_generation_methods = SM_STK_GENERATION_METHOD_JUST_WORKS | SM_STK_GENERATION_METHOD_OOB - | SM_STK_GENERATION_METHOD_PASSKEY; + | SM_STK_GENERATION_METHOD_PASSKEY + | SM_STK_GENERATION_METHOD_NUMERIC_COMPARISON; + sm_max_encryption_key_size = 16; sm_min_encryption_key_size = 7; diff --git a/src/bluetooth.h b/src/bluetooth.h index c5d8e1ef8..403b1dc09 100644 --- a/src/bluetooth.h +++ b/src/bluetooth.h @@ -986,9 +986,10 @@ typedef enum { #define SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION 0x10 // STK Generation Methods -#define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01 -#define SM_STK_GENERATION_METHOD_OOB 0x02 -#define SM_STK_GENERATION_METHOD_PASSKEY 0x04 +#define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01 +#define SM_STK_GENERATION_METHOD_OOB 0x02 +#define SM_STK_GENERATION_METHOD_PASSKEY 0x04 +#define SM_STK_GENERATION_METHOD_NUMERIC_COMPARISON 0x08 // Pairing Failed Reasons #define SM_REASON_RESERVED 0x00