From 5e24c4d61cd785cd11c4c9d741b47697047a3e70 Mon Sep 17 00:00:00 2001 From: Hemanth Rao Date: Tue, 30 Jan 2024 11:51:23 -0500 Subject: [PATCH] Check if the key is present and not if the key ref is valid, before exporting the key --- src/core/thread/key_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/thread/key_manager.cpp b/src/core/thread/key_manager.cpp index 4d734442a33..3d9337d93aa 100644 --- a/src/core/thread/key_manager.cpp +++ b/src/core/thread/key_manager.cpp @@ -516,7 +516,7 @@ void KeyManager::HandleKeyRotationTimer(void) void KeyManager::GetNetworkKey(NetworkKey &aNetworkKey) const { #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE - if (Crypto::Storage::IsKeyRefValid(mNetworkKeyRef)) + if (Crypto::Storage::HasKey(mNetworkKeyRef)) { size_t keyLen; @@ -535,7 +535,7 @@ void KeyManager::GetNetworkKey(NetworkKey &aNetworkKey) const void KeyManager::GetPskc(Pskc &aPskc) const { #if OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE - if (Crypto::Storage::IsKeyRefValid(mPskcRef)) + if (Crypto::Storage::HasKey(mPskcRef)) { size_t keyLen;