[crypto] make sure MAC keys are exportable (#7669)

If MAC keys are not exportable their reference can't be used by the
platform's radio implementation to retrieve the actual keys.
This commit is contained in:
Eduardo Montoya
2022-05-09 10:17:22 -07:00
committed by GitHub
parent 85382902ac
commit b76e524f7f
3 changed files with 14 additions and 3 deletions
+10
View File
@@ -148,6 +148,16 @@
#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
*
* Define to 1 if you want to make MAC keys exportable.
*
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
#define OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE 0
#endif
#if OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
#if (!defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE) || \
!defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN) || \
+3 -3
View File
@@ -343,13 +343,13 @@ void KeyManager::UpdateKeyMaterial(void)
Mac::KeyMaterial prevKey;
Mac::KeyMaterial nextKey;
curKey.SetFrom(hashKeys.GetMacKey());
curKey.SetFrom(hashKeys.GetMacKey(), kExportableMacKeys);
ComputeKeys(mKeySequence - 1, hashKeys);
prevKey.SetFrom(hashKeys.GetMacKey());
prevKey.SetFrom(hashKeys.GetMacKey(), kExportableMacKeys);
ComputeKeys(mKeySequence + 1, hashKeys);
nextKey.SetFrom(hashKeys.GetMacKey());
nextKey.SetFrom(hashKeys.GetMacKey(), kExportableMacKeys);
Get<Mac::SubMac>().SetMacKey(Mac::Frame::kKeyIdMode1, (mKeySequence & 0x7f) + 1, prevKey, curKey, nextKey);
}
+1
View File
@@ -551,6 +551,7 @@ public:
private:
static constexpr uint32_t kDefaultKeySwitchGuardTime = 624;
static constexpr uint32_t kOneHourIntervalInMsec = 3600u * 1000u;
static constexpr bool kExportableMacKeys = OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE;
OT_TOOL_PACKED_BEGIN
struct Keys