md: move definitions of MBEDTLS_MD_CAN to config_adjust_legacy_crypto.h
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
0d315378bf
commit
85d2a98549
2 changed files with 114 additions and 114 deletions
|
@ -56,6 +56,120 @@
|
||||||
#define MBEDTLS_MD_LIGHT
|
#define MBEDTLS_MD_LIGHT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_MD_LIGHT)
|
||||||
|
/*
|
||||||
|
* - MBEDTLS_MD_CAN_xxx is defined if the md module can perform xxx.
|
||||||
|
* - MBEDTLS_MD_xxx_VIA_PSA is defined if the md module may perform xxx via PSA
|
||||||
|
* (see below).
|
||||||
|
* - MBEDTLS_MD_SOME_PSA is defined if at least one algorithm may be performed
|
||||||
|
* via PSA (see below).
|
||||||
|
* - MBEDTLS_MD_SOME_LEGACY is defined if at least one algorithm may be performed
|
||||||
|
* via a direct legacy call (see below).
|
||||||
|
*
|
||||||
|
* The md module performs an algorithm via PSA if there is a PSA hash
|
||||||
|
* accelerator and the PSA driver subsytem is initialized at the time the
|
||||||
|
* operation is started, and makes a direct legacy call otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* PSA accelerated implementations */
|
||||||
|
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
||||||
|
#define MBEDTLS_MD_CAN_MD5
|
||||||
|
#define MBEDTLS_MD_MD5_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA1
|
||||||
|
#define MBEDTLS_MD_SHA1_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA224
|
||||||
|
#define MBEDTLS_MD_SHA224_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA256
|
||||||
|
#define MBEDTLS_MD_SHA256_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA384
|
||||||
|
#define MBEDTLS_MD_SHA384_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA512
|
||||||
|
#define MBEDTLS_MD_SHA512_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
||||||
|
#define MBEDTLS_MD_CAN_RIPEMD160
|
||||||
|
#define MBEDTLS_MD_RIPEMD160_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_224
|
||||||
|
#define MBEDTLS_MD_SHA3_224_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_256
|
||||||
|
#define MBEDTLS_MD_SHA3_256_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_384
|
||||||
|
#define MBEDTLS_MD_SHA3_384_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_512
|
||||||
|
#define MBEDTLS_MD_SHA3_512_VIA_PSA
|
||||||
|
#define MBEDTLS_MD_SOME_PSA
|
||||||
|
#endif
|
||||||
|
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||||
|
|
||||||
|
/* Built-in implementations */
|
||||||
|
#if defined(MBEDTLS_MD5_C)
|
||||||
|
#define MBEDTLS_MD_CAN_MD5
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA1_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA1
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA224_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA224
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA256_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA256
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA384_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA384
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA512_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA512
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SHA3_C)
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_224
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_256
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_384
|
||||||
|
#define MBEDTLS_MD_CAN_SHA3_512
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_RIPEMD160_C)
|
||||||
|
#define MBEDTLS_MD_CAN_RIPEMD160
|
||||||
|
#define MBEDTLS_MD_SOME_LEGACY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_MD_LIGHT */
|
||||||
|
|
||||||
/* MBEDTLS_ECP_LIGHT is auto-enabled by the following symbols:
|
/* MBEDTLS_ECP_LIGHT is auto-enabled by the following symbols:
|
||||||
* - MBEDTLS_ECP_C because now it consists of MBEDTLS_ECP_LIGHT plus functions
|
* - MBEDTLS_ECP_C because now it consists of MBEDTLS_ECP_LIGHT plus functions
|
||||||
* for curve arithmetic. As a consequence if MBEDTLS_ECP_C is required for
|
* for curve arithmetic. As a consequence if MBEDTLS_ECP_C is required for
|
||||||
|
|
|
@ -32,120 +32,6 @@
|
||||||
#include "mbedtls/build_info.h"
|
#include "mbedtls/build_info.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_LIGHT)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* - MBEDTLS_MD_CAN_xxx is defined if the md module can perform xxx.
|
|
||||||
* - MBEDTLS_MD_xxx_VIA_PSA is defined if the md module may perform xxx via PSA
|
|
||||||
* (see below).
|
|
||||||
* - MBEDTLS_MD_SOME_PSA is defined if at least one algorithm may be performed
|
|
||||||
* via PSA (see below).
|
|
||||||
* - MBEDTLS_MD_SOME_LEGACY is defined if at least one algorithm may be performed
|
|
||||||
* via a direct legacy call (see below).
|
|
||||||
*
|
|
||||||
* The md module performs an algorithm via PSA if there is a PSA hash
|
|
||||||
* accelerator and the PSA driver subsytem is initialized at the time the
|
|
||||||
* operation is started, and makes a direct legacy call otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* PSA accelerated implementations */
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
|
||||||
#define MBEDTLS_MD_CAN_MD5
|
|
||||||
#define MBEDTLS_MD_MD5_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA1
|
|
||||||
#define MBEDTLS_MD_SHA1_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA224
|
|
||||||
#define MBEDTLS_MD_SHA224_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA256
|
|
||||||
#define MBEDTLS_MD_SHA256_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA384
|
|
||||||
#define MBEDTLS_MD_SHA384_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA512
|
|
||||||
#define MBEDTLS_MD_SHA512_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
|
||||||
#define MBEDTLS_MD_CAN_RIPEMD160
|
|
||||||
#define MBEDTLS_MD_RIPEMD160_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_224
|
|
||||||
#define MBEDTLS_MD_SHA3_224_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_256
|
|
||||||
#define MBEDTLS_MD_SHA3_256_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_384
|
|
||||||
#define MBEDTLS_MD_SHA3_384_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_512
|
|
||||||
#define MBEDTLS_MD_SHA3_512_VIA_PSA
|
|
||||||
#define MBEDTLS_MD_SOME_PSA
|
|
||||||
#endif
|
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
|
||||||
|
|
||||||
/* Built-in implementations */
|
|
||||||
#if defined(MBEDTLS_MD5_C)
|
|
||||||
#define MBEDTLS_MD_CAN_MD5
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA1_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA1
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA224_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA224
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA256_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA256
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA384_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA384
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA512_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA512
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SHA3_C)
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_224
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_256
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_384
|
|
||||||
#define MBEDTLS_MD_CAN_SHA3_512
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_RIPEMD160_C)
|
|
||||||
#define MBEDTLS_MD_CAN_RIPEMD160
|
|
||||||
#define MBEDTLS_MD_SOME_LEGACY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* MBEDTLS_MD_LIGHT */
|
|
||||||
|
|
||||||
/** The selected feature is not available. */
|
/** The selected feature is not available. */
|
||||||
#define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
|
#define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
|
||||||
/** Bad input parameters to function. */
|
/** Bad input parameters to function. */
|
||||||
|
|
Loading…
Reference in a new issue