[dataset] accept too small Rotation Time in Security Policy TLV (#7323)

Existing deployed networks may have Operational Datasets where the
Security Policy TLV includes a Rotation Time value of 0. Not accepting
such datasets does not allow a Thread device to attach properly.

This commit removes the requirement that the Rotation Time value must
be greater than the minimum value of one hour.
This commit is contained in:
Jonathan Hui
2022-01-18 11:32:50 -08:00
committed by GitHub
parent 0b3f87c588
commit 871a7125c9
2 changed files with 10 additions and 3 deletions
+1 -2
View File
@@ -148,8 +148,7 @@ void SteeringDataTlv::CopyTo(SteeringData &aSteeringData) const
bool SecurityPolicyTlv::IsValid(void) const
{
return GetLength() >= sizeof(mRotationTime) && GetRotationTime() >= SecurityPolicy::kMinKeyRotationTime &&
GetFlagsLength() >= kThread11FlagsLength;
return GetLength() >= sizeof(mRotationTime) && GetFlagsLength() >= kThread11FlagsLength;
}
SecurityPolicy SecurityPolicyTlv::GetSecurityPolicy(void) const
+9 -1
View File
@@ -37,6 +37,7 @@
#include "common/encoding.hpp"
#include "common/instance.hpp"
#include "common/locator_getters.hpp"
#include "common/logging.hpp"
#include "common/timer.hpp"
#include "crypto/hkdf_sha256.hpp"
#include "crypto/storage.hpp"
@@ -483,9 +484,16 @@ void KeyManager::SetKek(const Kek &aKek)
void KeyManager::SetSecurityPolicy(const SecurityPolicy &aSecurityPolicy)
{
OT_ASSERT(aSecurityPolicy.mRotationTime >= SecurityPolicy::kMinKeyRotationTime);
if (aSecurityPolicy.mRotationTime < SecurityPolicy::kMinKeyRotationTime)
{
otLogNoteMeshCoP("Key Rotation Time too small: %d", aSecurityPolicy.mRotationTime);
ExitNow();
}
IgnoreError(Get<Notifier>().Update(mSecurityPolicy, aSecurityPolicy, kEventSecurityPolicyChanged));
exit:
return;
}
void KeyManager::StartKeyRotationTimer(void)