Make more code paths conditional in psa_crypto.c
This commit is contained in:
parent
663ee2019a
commit
792b16d83b
@ -2091,7 +2091,9 @@ psa_status_t psa_hash_abort( psa_hash_operation_t *operation )
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
mbedtls_sha512_free( &operation->ctx.sha512 );
|
||||
break;
|
||||
@ -2157,10 +2159,12 @@ psa_status_t psa_hash_setup( psa_hash_operation_t *operation,
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
mbedtls_sha512_init( &operation->ctx.sha512 );
|
||||
ret = mbedtls_sha512_starts_ret( &operation->ctx.sha512, 1 );
|
||||
break;
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
mbedtls_sha512_init( &operation->ctx.sha512 );
|
||||
ret = mbedtls_sha512_starts_ret( &operation->ctx.sha512, 0 );
|
||||
@ -2229,7 +2233,9 @@ psa_status_t psa_hash_update( psa_hash_operation_t *operation,
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
|
||||
input, input_length );
|
||||
@ -2302,7 +2308,9 @@ psa_status_t psa_hash_finish( psa_hash_operation_t *operation,
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
|
||||
break;
|
||||
@ -2391,7 +2399,9 @@ psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation,
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
mbedtls_sha512_clone( &target_operation->ctx.sha512,
|
||||
&source_operation->ctx.sha512 );
|
||||
@ -2519,8 +2529,10 @@ static size_t psa_get_hash_block_size( psa_algorithm_t alg )
|
||||
return( 64 );
|
||||
case PSA_ALG_SHA_256:
|
||||
return( 64 );
|
||||
#if !defined(MBEDTLS_SHA512_NO_SHA384)
|
||||
case PSA_ALG_SHA_384:
|
||||
return( 128 );
|
||||
#endif
|
||||
case PSA_ALG_SHA_512:
|
||||
return( 128 );
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user