From 3fc45ec760b6fa1b070cf7b3463aa42189940e9a Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 28 Aug 2017 12:24:04 +0200 Subject: [PATCH] sm: calculate DHKey earlier in sm_sc_prepare_dhkey_check --- src/ble/sm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index 40cad2f6f..d6d024fab 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -1586,10 +1586,6 @@ static void sm_sc_calculate_dhkey(sm_key256_t dhkey){ } static void f5_calculate_salt(sm_connection_t * sm_conn){ - // calculate DHKEY - sm_key256_t dhkey; - sm_sc_calculate_dhkey(dhkey); - // calculate salt for f5 const uint16_t message_len = 32; sm_cmac_connection = sm_conn; @@ -1717,6 +1713,10 @@ static void sm_sc_calculate_remote_confirm(sm_connection_t * sm_conn){ static void sm_sc_prepare_dhkey_check(sm_connection_t * sm_conn){ sm_conn->sm_engine_state = SM_SC_W2_CALCULATE_F5_SALT; + + // calculate DHKEY + sm_key256_t dhkey; + sm_sc_calculate_dhkey(dhkey); } static void sm_sc_calculate_f6_for_dhkey_check(sm_connection_t * sm_conn){