From e4813f4fe9fbed95752c5f2655a63cb419aaa04c Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Tue, 1 May 2018 11:33:36 +0100 Subject: [PATCH] Cordio PAL Security Manager: Copy locally own IRK. The IRK needs to be stored somewhere as it is not copied inside the stack, the stack just keeps a reference to it. --- .../targets/TARGET_CORDIO/CordioPalSecurityManager.h | 1 + .../targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalSecurityManager.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalSecurityManager.h index d7a0a21cd9..850e50f3d0 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalSecurityManager.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalSecurityManager.h @@ -326,6 +326,7 @@ private: passkey_num_t _default_passkey; bool _lesc_keys_generated; uint8_t _public_key_x[SEC_ECC_KEY_LEN]; + irk_t _irk; }; } // cordio diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp index e121906101..538d39e23f 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalSecurityManager.cpp @@ -264,7 +264,8 @@ ble_error_t CordioSecurityManager::set_ltk_not_found( ble_error_t CordioSecurityManager::set_irk(const irk_t& irk) { - DmSecSetLocalIrk(const_cast(irk.data())); + _irk = irk; + DmSecSetLocalIrk(_irk.data()); return BLE_ERROR_NONE; }