mirror of
https://github.com/espressif/openthread.git
synced 2026-08-19 00:49:53 +00:00
[key-manager] only start guard timer on switch to next key index (#4296)
This commit is contained in:
@@ -162,11 +162,16 @@ void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
|
||||
{
|
||||
VerifyOrExit(aKeySequence != mKeySequence, Get<Notifier>().SignalIfFirst(OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER));
|
||||
|
||||
// Check if the guard timer has expired if key rotation is requested.
|
||||
if ((aKeySequence == (mKeySequence + 1)) && (mKeySwitchGuardTime != 0) && mKeyRotationTimer.IsRunning() &&
|
||||
mKeySwitchGuardEnabled)
|
||||
if ((aKeySequence == (mKeySequence + 1)) && mKeyRotationTimer.IsRunning())
|
||||
{
|
||||
VerifyOrExit(mHoursSinceKeyRotation >= mKeySwitchGuardTime);
|
||||
if (mKeySwitchGuardEnabled)
|
||||
{
|
||||
// Check if the guard timer has expired if key rotation is requested.
|
||||
VerifyOrExit(mHoursSinceKeyRotation >= mKeySwitchGuardTime);
|
||||
StartKeyRotationTimer();
|
||||
}
|
||||
|
||||
mKeySwitchGuardEnabled = true;
|
||||
}
|
||||
|
||||
mKeySequence = aKeySequence;
|
||||
@@ -175,12 +180,6 @@ void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
|
||||
mMacFrameCounter = 0;
|
||||
mMleFrameCounter = 0;
|
||||
|
||||
if (mKeyRotationTimer.IsRunning())
|
||||
{
|
||||
mKeySwitchGuardEnabled = true;
|
||||
StartKeyRotationTimer();
|
||||
}
|
||||
|
||||
Get<Notifier>().Signal(OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER);
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user