[radio] fix ACK frame counter with previous key (#10816)

This commit tracks the frame counter used for the previous key index and
use it for the ACK frame to a frame still using previous key index.
This commit is contained in:
Yakun Xu
2024-10-11 08:24:51 -07:00
committed by GitHub
parent ed14eb19bd
commit 2ea0155129
3 changed files with 17 additions and 8 deletions
+5 -2
View File
@@ -1144,8 +1144,11 @@ void otPlatRadioSetMacKey(otInstance *aInstance,
otEXPECT(aPrevKey != NULL && aCurrKey != NULL && aNextKey != NULL);
sRadioContext.mKeyId = aKeyId;
sRadioContext.mKeyType = aKeyType;
sRadioContext.mKeyId = aKeyId;
sRadioContext.mKeyType = aKeyType;
sRadioContext.mPrevMacFrameCounter = sRadioContext.mMacFrameCounter;
sRadioContext.mMacFrameCounter = 0;
memcpy(&sRadioContext.mPrevKey, aPrevKey, sizeof(otMacKeyMaterial));
memcpy(&sRadioContext.mCurrKey, aCurrKey, sizeof(otMacKeyMaterial));
memcpy(&sRadioContext.mNextKey, aNextKey, sizeof(otMacKeyMaterial));