diff --git a/components/mbedtls/port/include/aes_alt.h b/components/mbedtls/port/include/aes_alt.h deleted file mode 100644 index 2f8e958b27..0000000000 --- a/components/mbedtls/port/include/aes_alt.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * \file aes_alt.h - * - * \brief AES block cipher - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -#ifndef AES_ALT_H -#define AES_ALT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(MBEDTLS_AES_ALT) -#include "aes/esp_aes.h" - -typedef esp_aes_context mbedtls_aes_context; - -#define mbedtls_aes_init esp_aes_init -#define mbedtls_aes_free esp_aes_free -#define mbedtls_aes_setkey_enc esp_aes_setkey -#define mbedtls_aes_setkey_dec esp_aes_setkey -#define mbedtls_aes_crypt_ecb esp_aes_crypt_ecb -#if defined(MBEDTLS_CIPHER_MODE_CBC) -#define mbedtls_aes_crypt_cbc esp_aes_crypt_cbc -#endif -#if defined(MBEDTLS_CIPHER_MODE_CFB) -#define mbedtls_aes_crypt_cfb128 esp_aes_crypt_cfb128 -#define mbedtls_aes_crypt_cfb8 esp_aes_crypt_cfb8 -#endif -#if defined(MBEDTLS_CIPHER_MODE_CTR) -#define mbedtls_aes_crypt_ctr esp_aes_crypt_ctr -#endif -#if defined(MBEDTLS_CIPHER_MODE_OFB) -#define mbedtls_aes_crypt_ofb esp_aes_crypt_ofb -#endif -#if defined(MBEDTLS_CIPHER_MODE_XTS) -typedef esp_aes_xts_context mbedtls_aes_xts_context; -#define mbedtls_aes_xts_init esp_aes_xts_init -#define mbedtls_aes_xts_free esp_aes_xts_free -#define mbedtls_aes_xts_setkey_enc esp_aes_xts_setkey_enc -#define mbedtls_aes_xts_setkey_dec esp_aes_xts_setkey_dec -#define mbedtls_aes_crypt_xts esp_aes_crypt_xts -#endif -#define mbedtls_internal_aes_encrypt esp_internal_aes_encrypt -#define mbedtls_internal_aes_decrypt esp_internal_aes_decrypt -#endif /* MBEDTLS_AES_ALT */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/mbedtls/port/include/gcm_alt.h b/components/mbedtls/port/include/gcm_alt.h deleted file mode 100644 index f76970944b..0000000000 --- a/components/mbedtls/port/include/gcm_alt.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * gcm_alt.h: AES block cipher - * - * SPDX-FileCopyrightText: The Mbed TLS Contributors - * - * SPDX-License-Identifier: Apache-2.0 - * - * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD - */ -#ifndef GCM_ALT_H -#define GCM_ALT_H - -#include "soc/soc_caps.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(MBEDTLS_GCM_ALT) - - -#include "aes/esp_aes_gcm.h" - - -typedef esp_gcm_context mbedtls_gcm_context; - -#define mbedtls_gcm_init esp_aes_gcm_init -#define mbedtls_gcm_free esp_aes_gcm_free -#define mbedtls_gcm_setkey esp_aes_gcm_setkey -#define mbedtls_gcm_starts esp_aes_gcm_starts -#define mbedtls_gcm_update_ad esp_aes_gcm_update_ad -#define mbedtls_gcm_update esp_aes_gcm_update -#define mbedtls_gcm_finish esp_aes_gcm_finish -#define mbedtls_gcm_auth_decrypt esp_aes_gcm_auth_decrypt -#define mbedtls_gcm_crypt_and_tag esp_aes_gcm_crypt_and_tag - -#endif /* MBEDTLS_GCM_ALT */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/mbedtls/port/include/sha1_alt.h b/components/mbedtls/port/include/sha1_alt.h deleted file mode 100644 index 26039378b4..0000000000 --- a/components/mbedtls/port/include/sha1_alt.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SHA-1 implementation with hardware ESP32 support added. - * Uses mbedTLS software implementation for failover when concurrent - * SHA operations are in use. - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE LTD - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SHA1_ALT_H_ -#define _SHA1_ALT_H_ - -#if defined(MBEDTLS_SHA1_ALT) - -#include "hal/sha_types.h" -#include "soc/soc_caps.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if SOC_SHA_SUPPORT_PARALLEL_ENG - -typedef enum { - ESP_MBEDTLS_SHA1_UNUSED, /* first block hasn't been processed yet */ - ESP_MBEDTLS_SHA1_HARDWARE, /* using hardware SHA engine */ - ESP_MBEDTLS_SHA1_SOFTWARE, /* using software SHA */ -} esp_mbedtls_sha1_mode; - -/** - * \brief SHA-1 context structure - */ -typedef struct { - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[5]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ - esp_mbedtls_sha1_mode mode; -} mbedtls_sha1_context; - -/** - * \brief Set the SHA-1 mode for a mbedtls_sha1_context. - * - * \param ctx The SHA-1 context structure. - * \param mode The SHA-1 mode to be set. It can be one of the following: - * - ESP_MBEDTLS_SHA1_UNUSED: Indicates that the first block hasn't been processed yet. - * - ESP_MBEDTLS_SHA1_HARDWARE: Specifies the use of hardware SHA engine for SHA-1 calculations. - * - ESP_MBEDTLS_SHA1_SOFTWARE: Specifies the use of software-based SHA-1 calculations. - * - * \return None. - */ -static inline void esp_mbedtls_set_sha1_mode(mbedtls_sha1_context *ctx, esp_mbedtls_sha1_mode mode) -{ - if (ctx) { - ctx->mode = mode; - } -} - -#elif SOC_SHA_SUPPORT_DMA || SOC_SHA_SUPPORT_RESUME - -typedef enum { - ESP_SHA1_STATE_INIT, - ESP_SHA1_STATE_IN_PROCESS -} esp_sha1_state; - -/** - * \brief SHA-1 context structure - */ -typedef struct { - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[5]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ - int first_block; /*!< if first then true else false */ - esp_sha_type mode; - esp_sha1_state sha_state; -} mbedtls_sha1_context; - -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/mbedtls/port/include/sha256_alt.h b/components/mbedtls/port/include/sha256_alt.h deleted file mode 100644 index 641f5e8930..0000000000 --- a/components/mbedtls/port/include/sha256_alt.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SHA-256 implementation with hardware ESP32 support added. - * Uses mbedTLS software implementation for failover when concurrent - * SHA operations are in use. - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE LTD - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SHA256_ALT_H_ -#define _SHA256_ALT_H_ - -#if defined(MBEDTLS_SHA256_ALT) - -#include "hal/sha_types.h" -#include "soc/soc_caps.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if SOC_SHA_SUPPORT_PARALLEL_ENG -typedef enum { - ESP_MBEDTLS_SHA256_UNUSED, /* first block hasn't been processed yet */ - ESP_MBEDTLS_SHA256_HARDWARE, /* using hardware SHA engine */ - ESP_MBEDTLS_SHA256_SOFTWARE, /* using software SHA */ -} esp_mbedtls_sha256_mode; - -/** - * \brief SHA-256 context structure - */ -typedef struct { - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[8]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ - int is224; /*!< 0 => SHA-256, else SHA-224 */ - esp_mbedtls_sha256_mode mode; -} mbedtls_sha256_context; - -#elif SOC_SHA_SUPPORT_DMA || SOC_SHA_SUPPORT_RESUME -typedef enum { - ESP_SHA256_STATE_INIT, - ESP_SHA256_STATE_IN_PROCESS -} esp_sha256_state; - -/** - * \brief SHA-256 context structure - */ -typedef struct { - uint32_t total[2]; /*!< number of bytes processed */ - uint32_t state[8]; /*!< intermediate digest state */ - unsigned char buffer[64]; /*!< data block being processed */ - int first_block; /*!< if first then true, else false */ - esp_sha_type mode; - esp_sha256_state sha_state; -} mbedtls_sha256_context; - -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/mbedtls/port/include/sha512_alt.h b/components/mbedtls/port/include/sha512_alt.h deleted file mode 100644 index 51f6423494..0000000000 --- a/components/mbedtls/port/include/sha512_alt.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SHA-512 implementation with hardware ESP32 support added. - * Uses mbedTLS software implementation for failover when concurrent - * SHA operations are in use. - * - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE LTD - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SHA512_ALT_H_ -#define _SHA512_ALT_H_ - -#if defined(MBEDTLS_SHA512_ALT) - -#include "hal/sha_types.h" -#include "soc/soc_caps.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#if SOC_SHA_SUPPORT_PARALLEL_ENG - -typedef enum { - ESP_MBEDTLS_SHA512_UNUSED, /* first block hasn't been processed yet */ - ESP_MBEDTLS_SHA512_HARDWARE, /* using hardware SHA engine */ - ESP_MBEDTLS_SHA512_SOFTWARE, /* using software SHA */ -} esp_mbedtls_sha512_mode; - -/** - * \brief SHA-512 context structure - */ -typedef struct { - uint64_t total[2]; /*!< number of bytes processed */ - uint64_t state[8]; /*!< intermediate digest state */ - unsigned char buffer[128]; /*!< data block being processed */ - int is384; /*!< 0 => SHA-512, else SHA-384 */ - esp_mbedtls_sha512_mode mode; -} mbedtls_sha512_context; - -#elif SOC_SHA_SUPPORT_DMA || SOC_SHA_SUPPORT_RESUME - -typedef enum { - ESP_SHA512_STATE_INIT, - ESP_SHA512_STATE_IN_PROCESS -} esp_sha512_state; - -/** - * \brief SHA-512 context structure - */ -typedef struct { - uint64_t total[2]; /*!< number of bytes processed */ - uint64_t state[8]; /*!< intermediate digest state */ - unsigned char buffer[128]; /*!< data block being processed */ - int first_block; - esp_sha_type mode; - uint32_t t_val; /*!< t_val for 512/t mode */ - esp_sha512_state sha_state; -} mbedtls_sha512_context; - -/** - * @brief Sets the specific algorithm for SHA512 - * - * @param ctx The mbedtls sha512 context - * - * @param type The mode, used for setting SHA2_512224 and SHA2_512256: - * - */ -void esp_sha512_set_mode(mbedtls_sha512_context *ctx, esp_sha_type type); - -/* For SHA512/t mode the initial hash value will depend on t */ -void esp_sha512_set_t( mbedtls_sha512_context *ctx, uint16_t t_val); - - -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif