1 /** 2 * \file aes_alt.h 3 * 4 * \brief AES block cipher 5 * 6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 7 * SPDX-License-Identifier: Apache-2.0 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may 10 * not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 * 22 */ 23 #ifndef AES_ALT_H 24 #define AES_ALT_H 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #if defined(MBEDTLS_AES_ALT) 31 #include "aes/esp_aes.h" 32 33 typedef esp_aes_context mbedtls_aes_context; 34 35 #define mbedtls_aes_init esp_aes_init 36 #define mbedtls_aes_free esp_aes_free 37 #define mbedtls_aes_setkey_enc esp_aes_setkey 38 #define mbedtls_aes_setkey_dec esp_aes_setkey 39 #define mbedtls_aes_crypt_ecb esp_aes_crypt_ecb 40 #if defined(MBEDTLS_CIPHER_MODE_CBC) 41 #define mbedtls_aes_crypt_cbc esp_aes_crypt_cbc 42 #endif 43 #if defined(MBEDTLS_CIPHER_MODE_CFB) 44 #define mbedtls_aes_crypt_cfb128 esp_aes_crypt_cfb128 45 #define mbedtls_aes_crypt_cfb8 esp_aes_crypt_cfb8 46 #endif 47 #if defined(MBEDTLS_CIPHER_MODE_CTR) 48 #define mbedtls_aes_crypt_ctr esp_aes_crypt_ctr 49 #endif 50 #if defined(MBEDTLS_CIPHER_MODE_OFB) 51 #define mbedtls_aes_crypt_ofb esp_aes_crypt_ofb 52 #endif 53 #if defined(MBEDTLS_CIPHER_MODE_XTS) 54 typedef esp_aes_xts_context mbedtls_aes_xts_context; 55 #define mbedtls_aes_xts_init esp_aes_xts_init 56 #define mbedtls_aes_xts_free esp_aes_xts_free 57 #define mbedtls_aes_xts_setkey_enc esp_aes_xts_setkey_enc 58 #define mbedtls_aes_xts_setkey_dec esp_aes_xts_setkey_dec 59 #define mbedtls_aes_crypt_xts esp_aes_crypt_xts 60 #endif 61 #define mbedtls_internal_aes_encrypt esp_internal_aes_encrypt 62 #define mbedtls_internal_aes_decrypt esp_internal_aes_decrypt 63 #endif /* MBEDTLS_AES_ALT */ 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif 70