Use more standard PSA macro names
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
e43076700e
commit
f66cd61daa
4 changed files with 96 additions and 13 deletions
|
@ -114,7 +114,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA3_C)
|
||||
#define PSA_WANT_ALG_SHA_3 1
|
||||
#define PSA_WANT_ALG_SHA3_224 1
|
||||
#define PSA_WANT_ALG_SHA3_256 1
|
||||
#define PSA_WANT_ALG_SHA3_384 1
|
||||
#define PSA_WANT_ALG_SHA3_512 1
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -274,8 +277,23 @@ extern "C" {
|
|||
#define MBEDTLS_SHA512_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_3) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_3)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_3 1
|
||||
#if defined(PSA_WANT_ALG_SHA3_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_3_224)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_224 1
|
||||
#define MBEDTLS_SHA3_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_3_256)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_256 1
|
||||
#define MBEDTLS_SHA3_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_3_384)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_384 1
|
||||
#define MBEDTLS_SHA3_C
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_3_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_512 1
|
||||
#define MBEDTLS_SHA3_C
|
||||
#endif
|
||||
|
||||
|
@ -875,8 +893,14 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA3_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_3 1
|
||||
#define PSA_WANT_ALG_SHA_3 1
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_224 1
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_256 1
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_384 1
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA3_512 1
|
||||
#define PSA_WANT_ALG_SHA3_224 1
|
||||
#define PSA_WANT_ALG_SHA3_256 1
|
||||
#define PSA_WANT_ALG_SHA3_384 1
|
||||
#define PSA_WANT_ALG_SHA3_512 1
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_AES_C)
|
||||
|
|
|
@ -54,7 +54,10 @@
|
|||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_HASH
|
||||
#endif
|
||||
|
||||
|
@ -79,7 +82,10 @@ typedef struct {
|
|||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||
mbedtls_sha512_context sha512;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
mbedtls_sha3_context sha3;
|
||||
#endif
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
|
|
|
@ -86,7 +86,10 @@
|
|||
#define PSA_WANT_ALG_SHA_256 1
|
||||
#define PSA_WANT_ALG_SHA_384 1
|
||||
#define PSA_WANT_ALG_SHA_512 1
|
||||
#define PSA_WANT_ALG_SHA_3 1
|
||||
#define PSA_WANT_ALG_SHA3_224 1
|
||||
#define PSA_WANT_ALG_SHA3_256 1
|
||||
#define PSA_WANT_ALG_SHA3_384 1
|
||||
#define PSA_WANT_ALG_SHA3_512 1
|
||||
#define PSA_WANT_ALG_STREAM_CIPHER 1
|
||||
#define PSA_WANT_ALG_TLS12_PRF 1
|
||||
#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
|
||||
|
|
|
@ -74,11 +74,22 @@ psa_status_t mbedtls_psa_hash_abort(
|
|||
mbedtls_sha512_free(&operation->ctx.sha512);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
||||
case PSA_ALG_SHA3_224:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
||||
case PSA_ALG_SHA3_256:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
||||
case PSA_ALG_SHA3_384:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
case PSA_ALG_SHA3_512:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
mbedtls_sha3_free(&operation->ctx.sha3);
|
||||
break;
|
||||
#endif
|
||||
|
@ -143,19 +154,25 @@ psa_status_t mbedtls_psa_hash_setup(
|
|||
ret = mbedtls_sha512_starts(&operation->ctx.sha512, 0);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
||||
case PSA_ALG_SHA3_224:
|
||||
mbedtls_sha3_init(&operation->ctx.sha3);
|
||||
ret = mbedtls_sha3_starts(&operation->ctx.sha3, MBEDTLS_SHA3_224);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
||||
case PSA_ALG_SHA3_256:
|
||||
mbedtls_sha3_init(&operation->ctx.sha3);
|
||||
ret = mbedtls_sha3_starts(&operation->ctx.sha3, MBEDTLS_SHA3_256);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
||||
case PSA_ALG_SHA3_384:
|
||||
mbedtls_sha3_init(&operation->ctx.sha3);
|
||||
ret = mbedtls_sha3_starts(&operation->ctx.sha3, MBEDTLS_SHA3_384);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
case PSA_ALG_SHA3_512:
|
||||
mbedtls_sha3_init(&operation->ctx.sha3);
|
||||
ret = mbedtls_sha3_starts(&operation->ctx.sha3, MBEDTLS_SHA3_512);
|
||||
|
@ -223,11 +240,22 @@ psa_status_t mbedtls_psa_hash_clone(
|
|||
&source_operation->ctx.sha512);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
||||
case PSA_ALG_SHA3_224:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
||||
case PSA_ALG_SHA3_256:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
||||
case PSA_ALG_SHA3_384:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
case PSA_ALG_SHA3_512:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
mbedtls_sha3_clone(&target_operation->ctx.sha3,
|
||||
&source_operation->ctx.sha3);
|
||||
break;
|
||||
|
@ -292,11 +320,22 @@ psa_status_t mbedtls_psa_hash_update(
|
|||
input, input_length);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
||||
case PSA_ALG_SHA3_224:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
||||
case PSA_ALG_SHA3_256:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
||||
case PSA_ALG_SHA3_384:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
case PSA_ALG_SHA3_512:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
ret = mbedtls_sha3_update(&operation->ctx.sha3,
|
||||
input, input_length);
|
||||
break;
|
||||
|
@ -371,11 +410,22 @@ psa_status_t mbedtls_psa_hash_finish(
|
|||
ret = mbedtls_sha512_finish(&operation->ctx.sha512, hash);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_3)
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
||||
case PSA_ALG_SHA3_224:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
||||
case PSA_ALG_SHA3_256:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
||||
case PSA_ALG_SHA3_384:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
case PSA_ALG_SHA3_512:
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
||||
ret = mbedtls_sha3_finish(&operation->ctx.sha3, hash, hash_size);
|
||||
break;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue