mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 06:17:47 +00:00
[mac-frame] check rx frame security level in GenerateEnhAck() (#9315)
This commit updates the `Mac::TxFrame::GenerateEnhAck()` method to check the security level of the received frame. If the security level is not `kSecurityEncMic32`, it will return `kErrorParse`. This should help prevent radio platform implementations from trying to perform tx security on an invalid generated enhanced ack frame. Specifically, it can help prevent radio platforms from calling `ProcessTxSecurity()` on an enhanced ack frame with a security level of `kSecurityNone` which can cause an assert in `AesCcm::Init()` due to the tag length being zero.
This commit is contained in:
@@ -1362,6 +1362,8 @@ Error TxFrame::GenerateEnhAck(const RxFrame &aFrame, bool aIsFramePending, const
|
||||
SuccessOrExit(error = aFrame.GetSecurityControlField(securityControlField));
|
||||
SuccessOrExit(error = aFrame.GetKeyId(keyId));
|
||||
|
||||
VerifyOrExit((securityControlField & kSecLevelMask) == kSecurityEncMic32, error = kErrorParse);
|
||||
|
||||
SetSecurityControlField(securityControlField);
|
||||
SetKeyId(keyId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user