From 1664d53b41241fe22952137fc18ebe8c898685c0 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Wed, 1 Jan 2014 19:42:17 +0000 Subject: [PATCH] use 16 as min/max encryption size, use fixed encryption size for re-connections --- example/libusb/ble_server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/example/libusb/ble_server.c b/example/libusb/ble_server.c index 215256299..844fc2c1d 100644 --- a/example/libusb/ble_server.c +++ b/example/libusb/ble_server.c @@ -1318,7 +1318,7 @@ void sm_init(){ | SM_STK_GENERATION_METHOD_OOB | SM_STK_GENERATION_METHOD_PASSKEY; sm_max_encryption_key_size = 16; - sm_min_encryption_key_size = 7; + sm_min_encryption_key_size = 16; // don't accept weaker crypto attempts sm_aes128_active = 0; gap_random_adress_update_period = 15 * 60 * 1000; @@ -1400,6 +1400,11 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha break; } + // re-establish used key encryption size + if (sm_max_encryption_key_size == sm_min_encryption_key_size){ + sm_encryption_key_size = sm_max_encryption_key_size; + } + log_info("LTK Request: recalculating with ediv 0x%04x", sm_s_ediv); // dhk = d1(IR, 3, 0) - enc