1 /* 2 * Copyright (c) 2021, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 /** \file cc3xx_internal_aes.h 9 * 10 * This file contains the declaration of the internal functions to 11 * perform symmetric encryption and decryption using the AES algorithm 12 * 13 */ 14 15 #ifndef CC3XX_INTERNAL_AES_H 16 #define CC3XX_INTERNAL_AES_H 17 18 #include "psa/crypto.h" 19 #include "aes_driver.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /** 26 * \brief Initialize the specified AES context. 27 */ 28 void cc3xx_aes_init(AesContext_t *ctx); 29 30 /** 31 * \brief Release and clear the specified AES context. 32 */ 33 void cc3xx_aes_free(AesContext_t *ctx); 34 35 /** 36 * \brief Set the encryption key. 37 */ 38 psa_status_t cc3xx_aes_setkey_enc( 39 AesContext_t *ctx, 40 const uint8_t *key, 41 size_t key_bits); 42 43 /** 44 * \brief Set the decryption key. 45 */ 46 psa_status_t cc3xx_aes_setkey_dec( 47 AesContext_t *ctx, 48 const uint8_t *key, 49 size_t key_bits); 50 51 /** 52 * \brief AES block encryption/decryption. 53 */ 54 psa_status_t cc3xx_aes_crypt( 55 AesContext_t *ctx, 56 aesMode_t mode, 57 size_t length, 58 uint8_t iv[AES_IV_SIZE], 59 const uint8_t *input, 60 uint8_t *output); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 #endif /* CC3XX_INTERNAL_AES_H */ 66