mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 06:37:46 +00:00
[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:
@@ -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) || \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user