1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /*! 8 @addtogroup chacha_ext_dma 9 10 @{ 11 */ 12 13 /*! 14 @file 15 @brief This file contains all the CryptoCell ChaCha external DMA APIs, their 16 enums and definitions. 17 */ 18 19 #ifndef _MBEDTLS_CHACHA_EXT_DMA_H 20 #define _MBEDTLS_CHACHA_EXT_DMA_H 21 22 #include "cc_pal_types.h" 23 #include "mbedtls_cc_chacha.h" 24 25 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 31 /*! 32 @brief This function initializes the external DMA control. 33 34 It configures the ChaCha mode, the initial hash value, and other 35 configurations in the ChaCha engine. 36 37 @return \c 0 on success. 38 @return A non-zero value from mbedtls_ext_dma_error.h on failure. 39 */ 40 int mbedtls_ext_dma_chacha_init( 41 /*! [in] The nonce buffer. */ 42 uint8_t * pNonce, 43 /*! [in] The nonce size flag. */ 44 mbedtls_chacha_nonce_size_t nonceSizeFlag, 45 /*! [in] The key buffer. */ 46 uint8_t * pKey, 47 /*! [in] The size of the key buffer. Must be 32 bytes. */ 48 uint32_t keySizeBytes, 49 /*! [in] Initial counter value. */ 50 uint32_t initialCounter, 51 /*! [in] The ChaCha operation: Encrypt or Decrypt. */ 52 mbedtls_chacha_encrypt_mode_t EncryptDecryptFlag, 53 /*! [in] Input data length in bytes */ 54 uint32_t dataSize 55 ); 56 57 58 /*! 59 @brief This function frees used resources. 60 61 @return \c CC_OK on success. 62 @return A non-zero value from mbedtls_ext_dma_error.h on failure. 63 */ 64 int mbedtls_chacha_ext_dma_finish(void); 65 66 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 /*! 73 @} 74 */ 75 #endif /* #ifndef _MBEDTLS_CHACHA_EXT_DMA_H */ 76 77 78