mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 06:07:48 +00:00
[mac] put transmission AES-CCM* to SubMac layer (#4919)
In Thread 1.2, it is possible to receive an IEEE 802.15.4-2015 packet. Per specification, receiver should acknowledge this packet with an IEEE 802.15.4-2015 ACK(Enh-ACK). This Enh-ACK can include header IE with it and requires security enabled bit in FCF be set to true. It is impractical for the host to generate the Enh-ACK and send to RCP for transmission within AIFS time(192us). So RCP should prepare the Enh-ACK by itself, which requires it to fill in the frame counter and do the encryption/authentication. This commit tries to address the need of transmission security/authentication by including the following changes, - Move Key ID mode 1 AES-CCM* related functions from MAC layer to SubMac layer, which is mirrored in RCP. - Distribute the MAC key and MAC key ID to RCP in posix app using newly added spinel properties. - Make it possible for radio(either in radio driver or hardware) to do transmission AES-CCM* if the platform supports by adding radio capability OT_RADIO_CAPS_TRANSMIT_SEC. - Enable this for RCP mode on simulation platform.
This commit is contained in:
@@ -330,6 +330,27 @@ otError otLinkRawSrcMatchClearShortEntries(otInstance *aInstance);
|
||||
*/
|
||||
otError otLinkRawSrcMatchClearExtEntries(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Update MAC keys and key index.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aKeyIdMode The key ID mode.
|
||||
* @param[in] aKeyId The key index.
|
||||
* @param[in] aPrevKey The previous MAC key.
|
||||
* @param[in] aCurrKey The current MAC key.
|
||||
* @param[in] aNextKey The next MAC key.
|
||||
*
|
||||
* @retval OT_ERROR_NONE If successful.
|
||||
* @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled.
|
||||
*
|
||||
*/
|
||||
otError otLinkRawSetMacKey(otInstance * aInstance,
|
||||
uint8_t aKeyIdMode,
|
||||
uint8_t aKeyId,
|
||||
const uint8_t *aPrevKey,
|
||||
const uint8_t *aCurrKey,
|
||||
const uint8_t *aNextKey);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -124,6 +124,7 @@ enum
|
||||
OT_RADIO_CAPS_TRANSMIT_RETRIES = 1 << 2, ///< Radio supports tx retry logic with collision avoidance (CSMA).
|
||||
OT_RADIO_CAPS_CSMA_BACKOFF = 1 << 3, ///< Radio supports CSMA backoff for frame transmission (but no retry).
|
||||
OT_RADIO_CAPS_SLEEP_TO_TX = 1 << 4, ///< Radio supports direct transition from sleep to TX with CSMA.
|
||||
OT_RADIO_CAPS_TRANSMIT_SEC = 1 << 5, ///< Radio supports tx security.
|
||||
};
|
||||
|
||||
#define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID
|
||||
@@ -196,6 +197,7 @@ typedef struct otRadioFrame
|
||||
uint8_t mMaxFrameRetries; ///< Maximum number of retries allowed after a transmission failure.
|
||||
bool mIsARetx : 1; ///< True if this frame is a retransmission (ignored by radio driver).
|
||||
bool mCsmaCaEnabled : 1; ///< Set to true to enable CSMA-CA for this packet, false otherwise.
|
||||
bool mIsSecurityProcessed : 1; ///< True if SubMac should skip the AES processing of this frame.
|
||||
} mTxInfo;
|
||||
|
||||
/**
|
||||
@@ -433,6 +435,28 @@ bool otPlatRadioGetPromiscuous(otInstance *aInstance);
|
||||
*/
|
||||
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable);
|
||||
|
||||
/**
|
||||
* Update MAC keys and key index
|
||||
*
|
||||
* This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aKeyIdMode The key ID mode.
|
||||
* @param[in] aKeyId Current MAC key index.
|
||||
* @param[in] aKeySize The key size.
|
||||
* @param[in] aPrevKey A pointer to the previous MAC key.
|
||||
* @param[in] aCurrKey A pointer to the current MAC key.
|
||||
* @param[in] aNextKey A pointer to the next MAC key.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioSetMacKey(otInstance * aInstance,
|
||||
uint8_t aKeyIdMode,
|
||||
uint8_t aKeyId,
|
||||
uint8_t aKeySize,
|
||||
const uint8_t *aPrevKey,
|
||||
const uint8_t *aCurrKey,
|
||||
const uint8_t *aNextKey);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user