mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-09-12 05:09:55 +00:00
Add preprocessor code, for compatibility with older mbedtls version, namely, now the inclusioin of header files in the private/ folder is conditional
Signed-off-by: Anton Matkin <[email protected]>
This commit is contained in:
@@ -17,7 +17,11 @@
|
|||||||
|
|
||||||
#if defined(MBEDTLS_BIGNUM_C)
|
#if defined(MBEDTLS_BIGNUM_C)
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/bignum.h>
|
#include <mbedtls/private/bignum.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/bignum.h>
|
||||||
|
#endif
|
||||||
#include <bignum_mod.h>
|
#include <bignum_mod.h>
|
||||||
|
|
||||||
/** Allocate and populate a core MPI from a test case argument.
|
/** Allocate and populate a core MPI from a test case argument.
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
#include <psa/crypto_driver_common.h>
|
#include <psa/crypto_driver_common.h>
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
|
||||||
|
#if MBEDTLS_MAJOR_VERSION >= 4
|
||||||
#include "mbedtls/private/cipher.h"
|
#include "mbedtls/private/cipher.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/cipher.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* If non-null, on success, copy this to the output. */
|
/* If non-null, on success, copy this to the output. */
|
||||||
|
|||||||
@@ -51,7 +51,13 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_BIGNUM_C)
|
#if defined(MBEDTLS_BIGNUM_C)
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/bignum.h"
|
#include "mbedtls/private/bignum.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/bignum.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** The type of test case arguments that contain binary data. */
|
/** The type of test case arguments that contain binary data. */
|
||||||
|
|||||||
@@ -17,7 +17,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/ctr_drbg.h>
|
#include <mbedtls/private/ctr_drbg.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/ctr_drbg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
/** Initialize the PSA Crypto subsystem. */
|
/** Initialize the PSA Crypto subsystem. */
|
||||||
|
|||||||
@@ -18,7 +18,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/bignum.h>
|
#include <mbedtls/private/bignum.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/bignum.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <bignum_core.h>
|
#include <bignum_core.h>
|
||||||
#include <bignum_mod.h>
|
#include <bignum_mod.h>
|
||||||
#include <bignum_mod_raw.h>
|
#include <bignum_mod_raw.h>
|
||||||
|
|||||||
@@ -9,7 +9,13 @@
|
|||||||
|
|
||||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/rsa.h"
|
#include "mbedtls/private/rsa.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/rsa.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "psa_crypto_rsa.h"
|
#include "psa_crypto_rsa.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "test/drivers/asymmetric_encryption.h"
|
#include "test/drivers/asymmetric_encryption.h"
|
||||||
|
|||||||
@@ -12,7 +12,12 @@
|
|||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
#include "psa_crypto_cipher.h"
|
#include "psa_crypto_cipher.h"
|
||||||
#include "psa_crypto_core.h"
|
#include "psa_crypto_core.h"
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/cipher.h"
|
#include "mbedtls/private/cipher.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/cipher.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "test/drivers/cipher.h"
|
#include "test/drivers/cipher.h"
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,13 @@
|
|||||||
#include "psa_crypto_ecp.h"
|
#include "psa_crypto_ecp.h"
|
||||||
#include "psa_crypto_rsa.h"
|
#include "psa_crypto_rsa.h"
|
||||||
#include "psa_crypto_ffdh.h"
|
#include "psa_crypto_ffdh.h"
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/ecp.h"
|
#include "mbedtls/private/ecp.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/ecp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mbedtls/error.h"
|
#include "mbedtls/error.h"
|
||||||
|
|
||||||
#include "test/drivers/key_management.h"
|
#include "test/drivers/key_management.h"
|
||||||
|
|||||||
@@ -15,13 +15,22 @@
|
|||||||
#include "psa_crypto_ecp.h"
|
#include "psa_crypto_ecp.h"
|
||||||
#include "psa_crypto_hash.h"
|
#include "psa_crypto_hash.h"
|
||||||
#include "psa_crypto_rsa.h"
|
#include "psa_crypto_rsa.h"
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/ecp.h"
|
#include "mbedtls/private/ecp.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/ecp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "test/drivers/hash.h"
|
#include "test/drivers/hash.h"
|
||||||
#include "test/drivers/signature.h"
|
#include "test/drivers/signature.h"
|
||||||
#include "test/drivers/hash.h"
|
#include "test/drivers/hash.h"
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include "mbedtls/private/ecdsa.h"
|
#include "mbedtls/private/ecdsa.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/ecdsa.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "test/random.h"
|
#include "test/random.h"
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,12 @@ psa_status_t mbedtls_psa_external_get_random(
|
|||||||
#if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
|
#if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
|
||||||
|
|
||||||
#include <test/random.h>
|
#include <test/random.h>
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/entropy.h>
|
#include <mbedtls/private/entropy.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/entropy.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static int platform_get_entropy_force_failure;
|
static int platform_get_entropy_force_failure;
|
||||||
static size_t platform_get_entropy_forced_entropy_content = SIZE_MAX;
|
static size_t platform_get_entropy_forced_entropy_content = SIZE_MAX;
|
||||||
|
|||||||
@@ -14,7 +14,11 @@
|
|||||||
#include <test/psa_crypto_helpers.h>
|
#include <test/psa_crypto_helpers.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/ctr_drbg.h>
|
#include <mbedtls/private/ctr_drbg.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/ctr_drbg.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
@@ -249,7 +253,12 @@ exit:
|
|||||||
|
|
||||||
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
|
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/entropy.h>
|
#include <mbedtls/private/entropy.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/entropy.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <psa_crypto_its.h>
|
#include <psa_crypto_its.h>
|
||||||
|
|
||||||
int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len)
|
int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len)
|
||||||
|
|||||||
@@ -25,7 +25,13 @@
|
|||||||
#include <pk_internal.h>
|
#include <pk_internal.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/ecp.h>
|
#include <mbedtls/private/ecp.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/ecp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_RSA_C)
|
#if defined(MBEDTLS_RSA_C)
|
||||||
#include <rsa_internal.h>
|
#include <rsa_internal.h>
|
||||||
|
|||||||
@@ -23,7 +23,11 @@
|
|||||||
#include <test/random.h>
|
#include <test/random.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if MBEDTLS_VERSION_MAJOR >= 4
|
||||||
#include <mbedtls/private/entropy.h>
|
#include <mbedtls/private/entropy.h>
|
||||||
|
#else
|
||||||
|
#include <mbedtls/entropy.h>
|
||||||
|
#endif
|
||||||
#include <alignment.h>
|
#include <alignment.h>
|
||||||
|
|
||||||
int mbedtls_test_rnd_std_rand(void *rng_state,
|
int mbedtls_test_rnd_std_rand(void *rng_state,
|
||||||
|
|||||||
Reference in New Issue
Block a user