[sub-mac] new frame counter for retransmissions having header IEs (#13304)

Since the core is not sure whether the frame counter is used by the
platform or not, this commit modifies the sub-mac to always use a new
frame counter to secure retransmissions having header IEs.
This commit is contained in:
Yakun Xu
2026-07-06 14:09:54 -07:00
committed by GitHub
parent 1aeafa6b99
commit 6cc9359cee
3 changed files with 6 additions and 7 deletions
+2 -3
View File
@@ -1238,7 +1238,7 @@ exit:
}
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
void TxFrame::DecryptTransmitAesCcm(const ExtAddress &aExtAddress)
void TxFrame::RestoreTransmitSecurity(const ExtAddress &aExtAddress)
{
uint32_t frameCounter = 0;
uint8_t securityLevel;
@@ -1262,10 +1262,9 @@ void TxFrame::DecryptTransmitAesCcm(const ExtAddress &aExtAddress)
IgnoreError(aesCcm.Process(Crypto::AesCcm::kDecrypt, GetPayload(), GetPayloadLength()));
SetIsSecurityProcessed(false);
SetIsHeaderUpdated(false);
exit:
return;
SetIsHeaderUpdated(false);
}
#endif // OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
+2 -2
View File
@@ -1082,12 +1082,12 @@ public:
void ProcessTransmitAesCcm(const ExtAddress &aExtAddress);
/**
* Decrypts the frame which was previously encrypted.
* Restore the frame for transmit processing.
*
* @param[in] aExtAddress A reference to the extended address, which will be used to generate nonce
* for AES CCM computation.
*/
void DecryptTransmitAesCcm(const ExtAddress &aExtAddress);
void RestoreTransmitSecurity(const ExtAddress &aExtAddress);
/**
* Indicates whether or not the frame has security processed.
+2 -2
View File
@@ -603,9 +603,9 @@ void SubMac::HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, Error aErro
aFrame.SetIsARetransmission(true);
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
if (aFrame.GetSecurityEnabled() && aFrame.IsSecurityProcessed() && aFrame.HasAnyHeaderIe())
if (aFrame.GetSecurityEnabled() && aFrame.HasAnyHeaderIe())
{
aFrame.DecryptTransmitAesCcm(GetExtAddress());
aFrame.RestoreTransmitSecurity(GetExtAddress());
}
ProcessTransmitSecurity();