fix(mbedtls/include): Fix include libs in the driver's public headers

This commit is contained in:
harshal.patil
2026-01-31 13:30:57 +05:30
parent 4ab9ac1ccd
commit b450664e2b
15 changed files with 71 additions and 58 deletions
@@ -5,6 +5,9 @@
*/
#pragma once
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_aes_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,9 +17,6 @@ extern "C" {
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#endif
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_aes_contexts.h"
psa_status_t esp_aes_cipher_encrypt(
const psa_key_attributes_t *attributes,
const uint8_t *key_buffer,
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -23,9 +23,8 @@ extern "C" {
* crypto_driver_contexts_primitives.h.
*/
#include <stdint.h>
#include <stdbool.h>
#include "esp_types.h"
#include "psa/crypto_driver_common.h"
#if defined(ESP_AES_DRIVER_ENABLED)
#define ESP_MBEDTLS_AES_MAX_BLOCK_LENGTH 16
@@ -1,20 +1,18 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
// #include_next "mbedtls/gcm.h"
#include "sdkconfig.h"
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_aes_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ESP_AES_DRIVER_ENABLED)
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_aes_contexts.h"
psa_status_t esp_crypto_aes_gcm_encrypt_setup(
esp_aes_gcm_operation_t *esp_aes_gcm_driver_ctx,
@@ -5,15 +5,15 @@
*/
#pragma once
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_cmac_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ESP_CMAC_DRIVER_ENABLED)
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_cmac_contexts.h"
psa_status_t esp_cmac_compute(const psa_key_attributes_t *attributes,
const uint8_t *key_buffer,
size_t key_buffer_size,
@@ -6,14 +6,17 @@
#pragma once
#include "esp_types.h"
#include "psa/crypto_driver_common.h"
#include "psa_crypto_driver_esp_aes_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ESP_CMAC_DRIVER_ENABLED)
#include "psa_crypto_driver_esp_aes_contexts.h"
#define PSA_AES_BLOCK_SIZE PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES)
#define PSA_CMAC_MAX_BLOCK_SIZE PSA_AES_BLOCK_SIZE
@@ -6,17 +6,17 @@
#pragma once
#if defined(ESP_ECDSA_DRIVER_ENABLED)
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#endif
#include "psa/crypto.h"
#include "psa/crypto_types.h"
#include "soc/soc_caps.h"
#include "psa_crypto_driver_esp_ecdsa_contexts.h"
#if defined(ESP_ECDSA_DRIVER_ENABLED)
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#endif
#ifdef __cplusplus
extern "C" {
#endif
@@ -6,16 +6,15 @@
#pragma once
#include "stdint.h"
#include "stdbool.h"
#include "esp_types.h"
#include "soc/soc_caps.h"
#include "psa/crypto.h"
#include "psa/crypto_driver_common.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ESP_ECDSA_DRIVER_ENABLED)
#if SOC_ECDSA_SUPPORT_CURVE_P384
#define MAX_ECDSA_COMPONENT_LEN 48
#define MAX_ECDSA_SHA_LEN 48
@@ -75,6 +74,7 @@ typedef struct {
size_t key_len;
} esp_ecdsa_opaque_sign_hash_operation_t;
#endif /* !(__DOXYGEN__) */
#endif /* ESP_ECDSA_DRIVER_ENABLED */
#ifdef __cplusplus
}
#endif
@@ -5,6 +5,9 @@
*/
#pragma once
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_hmac_opaque_contexts.h"
#if defined(ESP_HMAC_OPAQUE_DRIVER_ENABLED)
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
@@ -14,9 +17,6 @@
extern "C" {
#endif
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_hmac_opaque_contexts.h"
/**
* @brief ESP HMAC opaque PSA driver location
*
@@ -6,15 +6,14 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "esp_types.h"
#include "soc/soc_caps.h"
#include "psa/crypto_driver_common.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ESP_HMAC_OPAQUE_DRIVER_ENABLED)
/**
* @brief Size of HMAC result in bytes (the opaque driver only supports SHA-256 based HMAC)
*/
@@ -36,6 +35,7 @@ typedef struct {
uint8_t hmac[ESP_HMAC_RESULT_SIZE]; /**< Buffer to store the HMAC result */
} esp_hmac_opaque_operation_t;
#endif /* ESP_HMAC_OPAQUE_DRIVER_ENABLED */
#ifdef __cplusplus
}
#endif
@@ -5,14 +5,14 @@
*/
#pragma once
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_hmac_transparent_contexts.h"
#if defined(ESP_HMAC_TRANSPARENT_DRIVER_ENABLED)
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#endif
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_hmac_transparent_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -6,7 +6,7 @@
#pragma once
#include <stdint.h>
#include "esp_types.h"
#include "soc/soc_caps.h"
#include "psa/crypto_driver_common.h"
#include "psa_crypto_driver_esp_sha_contexts.h"
@@ -5,14 +5,15 @@
*/
#pragma once
#include "esp_types.h"
#include "psa/crypto.h"
#include "esp_rom_md5.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "psa/crypto.h"
#include "esp_rom_md5.h"
#ifdef CONFIG_MBEDTLS_ROM_MD5
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
@@ -1,18 +1,17 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "psa/crypto.h"
#include "psa_crypto_driver_esp_sha_contexts.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "psa_crypto_driver_esp_sha_contexts.h"
#include <stdbool.h>
#include "psa/crypto.h"
#ifdef CONFIG_MBEDTLS_HARDWARE_SHA
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
@@ -1,11 +1,16 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_types.h"
#include <stdbool.h>
#include "soc/soc_caps.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -23,10 +28,6 @@ extern "C" {
* crypto_driver_contexts_primitives.h.
*/
#include <stdint.h>
#include <stdbool.h>
#include "sdkconfig.h"
typedef enum {
ESP_SHA_OPERATION_TYPE_SHA1,
ESP_SHA_OPERATION_TYPE_SHA256,
@@ -53,13 +54,13 @@ typedef enum {
ESP_SHA512_STATE_IN_PROCESS
} esp_sha512_state;
#if CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG
#if SOC_SHA_SUPPORT_PARALLEL_ENG
typedef enum {
ESP_SHA_MODE_UNUSED,
ESP_SHA_MODE_HARDWARE,
ESP_SHA_MODE_SOFTWARE
} esp_sha_mode_t;
#endif /* CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG */
#endif /* SOC_SHA_SUPPORT_PARALLEL_ENG */
/**
* \brief ESP SHA1 context structure
@@ -70,9 +71,9 @@ typedef struct {
unsigned char buffer[64]; /*!< The data block being processed. */
bool first_block; /*!< First block flag for hardware initialization */
int sha_state; /*!< SHA operation state */
#if CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG
#if SOC_SHA_SUPPORT_PARALLEL_ENG
esp_sha_mode_t operation_mode; /*!< Hardware or Software mode */
#endif /* CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG */
#endif /* SOC_SHA_SUPPORT_PARALLEL_ENG */
} esp_sha1_context;
/**
@@ -85,9 +86,9 @@ typedef struct {
bool first_block; /*!< First block flag for hardware initialization */
int sha_state; /*!< SHA operation state */
int mode; /*!< SHA2_224 or SHA2_256 */
#if CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG
#if SOC_SHA_SUPPORT_PARALLEL_ENG
esp_sha_mode_t operation_mode; /*!< Hardware or Software mode */
#endif /* CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG */
#endif /* SOC_SHA_SUPPORT_PARALLEL_ENG */
} esp_sha256_context;
/**
@@ -102,9 +103,9 @@ typedef struct {
int sha_state;
int mode;
uint32_t t_val; /*!< t_val for 512/t mode */
#if CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG
#if SOC_SHA_SUPPORT_PARALLEL_ENG
esp_sha_mode_t operation_mode; /*!< Hardware or Software mode */
#endif /* CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG */
#endif /* SOC_SHA_SUPPORT_PARALLEL_ENG */
} esp_sha512_context;
typedef void *esp_sha_context_t;
@@ -76,6 +76,18 @@ const uint8_t sha[] = {
0xb2, 0x60, 0xb2, 0x38, 0x93, 0xa6, 0x27, 0x14
};
#if !defined(ESP_ECDSA_DRIVER_ENABLED)
/**
* @brief ECDSA curve options
*/
typedef enum {
ESP_ECDSA_CURVE_SECP192R1,
ESP_ECDSA_CURVE_SECP256R1,
ESP_ECDSA_CURVE_SECP384R1,
ESP_ECDSA_CURVE_MAX,
} esp_ecdsa_curve_t;
#endif /* !defined(ESP_ECDSA_DRIVER_ENABLED) */
#if CONFIG_MBEDTLS_HARDWARE_ECC || CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY
/* Big endian */