@@ -428,6 +428,61 @@ otError otPlatCryptoAesSetKey(otCryptoContext *aContext, const otCryptoKey *aKey
428428 */
429429otError otPlatCryptoAesEncrypt (otCryptoContext * aContext , const uint8_t * aInput , uint8_t * aOutput );
430430
431+ /**
432+ * Decrypt and verify the given AES-CCM* payload.
433+ *
434+ * @param[in] aContext AES context initialised with `otPlatCryptoAesSetKey()`.
435+ * @param[in] aNonce Nonce (13 bytes, IEEE 802.15.4 CCM* format).
436+ * @param[in] aHeader Additional authenticated data (MAC header).
437+ * @param[in] aHeaderLength Length of @p aHeader in bytes.
438+ * @param[in,out] aPayload Ciphertext on input; replaced with plaintext in place on success.
439+ * @param[in] aPayloadLength Length of @p aPayload in bytes.
440+ * @param[in] aTag MIC buffer of length @p aTagLength bytes.
441+ * @param[in] aTagLength MIC length in bytes (4, 8, or 16).
442+ *
443+ * @retval OT_ERROR_NONE Successfully decrypted and verified @p aPayload.
444+ * @retval OT_ERROR_SECURITY MIC verification failed.
445+ * @retval OT_ERROR_INVALID_ARGS @p aContext, @p aNonce, @p aPayload, or @p aTag was NULL.
446+ * @retval OT_ERROR_FAILED Other failure.
447+ *
448+ * @note This API is only used by OT core when `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_CCM_ENABLE` is enabled.
449+ */
450+ otError otPlatCryptoAesDecryptAndVerify (otCryptoContext * aContext ,
451+ const uint8_t * aNonce ,
452+ const void * aHeader ,
453+ uint16_t aHeaderLength ,
454+ void * aPayload ,
455+ uint16_t aPayloadLength ,
456+ const void * aTag ,
457+ uint8_t aTagLength );
458+
459+ /**
460+ * Encrypt and tag the given AES-CCM* payload.
461+ *
462+ * @param[in] aContext AES context initialised with `otPlatCryptoAesSetKey()`.
463+ * @param[in] aNonce Nonce (13 bytes, IEEE 802.15.4 CCM* format).
464+ * @param[in] aHeader Additional authenticated data (MAC header).
465+ * @param[in] aHeaderLength Length of @p aHeader in bytes.
466+ * @param[in,out] aPayload Plaintext on input; replaced with ciphertext in place on success.
467+ * @param[in] aPayloadLength Length of @p aPayload in bytes.
468+ * @param[out] aTag Buffer to receive the MIC; must be at least @p aTagLength bytes.
469+ * @param[in] aTagLength MIC length in bytes (4, 8, or 16).
470+ *
471+ * @retval OT_ERROR_NONE Successfully encrypted @p aPayload and generated MIC in @p aTag.
472+ * @retval OT_ERROR_INVALID_ARGS @p aContext, @p aNonce, @p aPayload, or @p aTag was NULL.
473+ * @retval OT_ERROR_FAILED Other failure.
474+ *
475+ * @note This API is only used by OT core when `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_CCM_ENABLE` is enabled.
476+ */
477+ otError otPlatCryptoAesEncryptAndTag (otCryptoContext * aContext ,
478+ const uint8_t * aNonce ,
479+ const void * aHeader ,
480+ uint16_t aHeaderLength ,
481+ void * aPayload ,
482+ uint16_t aPayloadLength ,
483+ void * aTag ,
484+ uint8_t aTagLength );
485+
431486/**
432487 * Free the AES context.
433488 *
0 commit comments