feat(hal/testapps): Added AES and SHA testcases with DMA support

This commit is contained in:
nilesh.kale
2023-10-16 17:30:36 +05:30
parent 91630fab36
commit aab3f604ec
23 changed files with 1568 additions and 233 deletions

View File

@@ -0,0 +1,14 @@
#
# The mbedtls component gets pulled in during the build(due to a dependency of component bootloader_support),
# but we needed to avoid inclusion of mbedtls in this hal layer test app, thus creating a "dummy" mbedtls component.
# This dummy mbedtls component will get the priority during the build stage and thus the "real" mbedtls component
# does not get pulled.
#
idf_build_get_property(idf_target IDF_TARGET)
idf_build_get_property(python PYTHON)
set(mbedtls_srcs ".")
set(mbedtls_include_dirs include)
idf_component_register(SRCS "${mbedtls_srcs}"
INCLUDE_DIRS "${mbedtls_include_dirs}")

View File

@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -1
#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -2
#define MBEDTLS_ERR_AES_BAD_INPUT_DATA -3
#define MBEDTLS_AES_ENCRYPT ESP_AES_ENCRYPT
#define MBEDTLS_AES_DECRYPT ESP_AES_DECRYPT

View File

@@ -0,0 +1,6 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
typedef int mbedtls_cipher_id_t;

View File

@@ -0,0 +1,6 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -1

View File

@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stddef.h>
static inline void mbedtls_platform_zeroize( void *buf, size_t len )
{
bzero(buf, len);
}

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stddef.h>
#include <stdint.h>
typedef void *bootloader_sha256_handle_t;
bootloader_sha256_handle_t bootloader_sha256_start(void);
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len);
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest);
typedef void mbedtls_sha256_context;
void mbedtls_sha256_init(mbedtls_sha256_context *ctx);
void mbedtls_sha256_free(mbedtls_sha256_context *ctx);
int mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224);
int mbedtls_sha256_update(mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen);
int mbedtls_sha256_finish(mbedtls_sha256_context *ctx,
unsigned char *output);