Support MBEDTLS_MD_SHA3_xxx_VIA_PSA
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
76814b6207
commit
852b6c30b7
2 changed files with 37 additions and 0 deletions
|
@ -85,6 +85,26 @@
|
|||
#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 */
|
||||
|
@ -117,6 +137,7 @@
|
|||
#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
|
||||
|
|
16
library/md.c
16
library/md.c
|
@ -258,6 +258,22 @@ static psa_algorithm_t psa_alg_of_md(const mbedtls_md_info_t *info)
|
|||
#if defined(MBEDTLS_MD_SHA512_VIA_PSA)
|
||||
case MBEDTLS_MD_SHA512:
|
||||
return PSA_ALG_SHA_512;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD_SHA3_224_VIA_PSA)
|
||||
case MBEDTLS_MD_SHA3_224:
|
||||
return PSA_ALG_SHA3_224;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD_SHA3_256_VIA_PSA)
|
||||
case MBEDTLS_MD_SHA3_256:
|
||||
return PSA_ALG_SHA3_256;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD_SHA3_384_VIA_PSA)
|
||||
case MBEDTLS_MD_SHA3_384:
|
||||
return PSA_ALG_SHA3_384;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD_SHA3_512_VIA_PSA)
|
||||
case MBEDTLS_MD_SHA3_512:
|
||||
return PSA_ALG_SHA3_512;
|
||||
#endif
|
||||
default:
|
||||
return PSA_ALG_NONE;
|
||||
|
|
Loading…
Reference in a new issue