Skip to content

Commit 6cc9359

Browse files
authored
[sub-mac] new frame counter for retransmissions having header IEs (openthread#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.
1 parent 1aeafa6 commit 6cc9359

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/core/mac/mac_frame.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ void TxFrame::ProcessTransmitAesCcm(const ExtAddress &aExtAddress)
12381238
}
12391239

12401240
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
1241-
void TxFrame::DecryptTransmitAesCcm(const ExtAddress &aExtAddress)
1241+
void TxFrame::RestoreTransmitSecurity(const ExtAddress &aExtAddress)
12421242
{
12431243
uint32_t frameCounter = 0;
12441244
uint8_t securityLevel;
@@ -1262,10 +1262,9 @@ void TxFrame::DecryptTransmitAesCcm(const ExtAddress &aExtAddress)
12621262
IgnoreError(aesCcm.Process(Crypto::AesCcm::kDecrypt, GetPayload(), GetPayloadLength()));
12631263

12641264
SetIsSecurityProcessed(false);
1265-
SetIsHeaderUpdated(false);
12661265

12671266
exit:
1268-
return;
1267+
SetIsHeaderUpdated(false);
12691268
}
12701269
#endif // OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
12711270

src/core/mac/mac_frame.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,12 +1082,12 @@ class TxFrame : public Frame
10821082
void ProcessTransmitAesCcm(const ExtAddress &aExtAddress);
10831083

10841084
/**
1085-
* Decrypts the frame which was previously encrypted.
1085+
* Restore the frame for transmit processing.
10861086
*
10871087
* @param[in] aExtAddress A reference to the extended address, which will be used to generate nonce
10881088
* for AES CCM computation.
10891089
*/
1090-
void DecryptTransmitAesCcm(const ExtAddress &aExtAddress);
1090+
void RestoreTransmitSecurity(const ExtAddress &aExtAddress);
10911091

10921092
/**
10931093
* Indicates whether or not the frame has security processed.

src/core/mac/sub_mac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,9 @@ void SubMac::HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, Error aErro
603603
aFrame.SetIsARetransmission(true);
604604

605605
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT && OPENTHREAD_CONFIG_MAC_SOFTWARE_RETX_SECURITY_ENABLE
606-
if (aFrame.GetSecurityEnabled() && aFrame.IsSecurityProcessed() && aFrame.HasAnyHeaderIe())
606+
if (aFrame.GetSecurityEnabled() && aFrame.HasAnyHeaderIe())
607607
{
608-
aFrame.DecryptTransmitAesCcm(GetExtAddress());
608+
aFrame.RestoreTransmitSecurity(GetExtAddress());
609609
}
610610

611611
ProcessTransmitSecurity();

0 commit comments

Comments
 (0)