[key-manager] fix bug that prevents local key rotation (#2235)

Before rotating the key sequence counter, there is a check against the key
rotating guard time.  The key switch guard time is intended to prevent
the key sequence counter from advancing too quickly.  However, the existing
implementation only allowed the key sequence counter to increment if the
key switch guard time had *not* expired.  Because the key rotation period
is larger than the key switch guard time, the key would never rotate.

This commit fixes the logic to check if the key switch guard time *has*
expired, when performing a key rotation.
This commit is contained in:
Jonathan Hui
2017-09-30 08:36:13 -07:00
committed by GitHub
parent 42caf024c8
commit 312bcc541f
+1 -1
View File
@@ -172,7 +172,7 @@ void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
mKeyRotationTimer.IsRunning() &&
mKeySwitchGuardEnabled)
{
VerifyOrExit(mHoursSinceKeyRotation < mKeySwitchGuardTime);
VerifyOrExit(mHoursSinceKeyRotation >= mKeySwitchGuardTime);
}
mKeySequence = aKeySequence;