mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 02:25:40 +01:00
Update guards for ALG_SHA_224 and ALG_SHA_384 in crypto library
The previous revision of guards around SHA_224 and SHA_384 were not correct. This set of changes ensures the proper code is available when SHA_224 and SHA_384 are enabled for use. Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
This commit is contained in:
parent
d62b678473
commit
6ca2327150
@ -2546,16 +2546,22 @@ psa_status_t psa_hash_abort( psa_hash_operation_t *operation )
|
|||||||
mbedtls_sha1_free( &operation->ctx.sha1 );
|
mbedtls_sha1_free( &operation->ctx.sha1 );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
|
||||||
case PSA_ALG_SHA_224:
|
case PSA_ALG_SHA_224:
|
||||||
|
mbedtls_sha256_free( &operation->ctx.sha256 );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
|
||||||
case PSA_ALG_SHA_256:
|
case PSA_ALG_SHA_256:
|
||||||
mbedtls_sha256_free( &operation->ctx.sha256 );
|
mbedtls_sha256_free( &operation->ctx.sha256 );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
|
||||||
case PSA_ALG_SHA_384:
|
case PSA_ALG_SHA_384:
|
||||||
|
mbedtls_sha512_free( &operation->ctx.sha512 );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
|
||||||
case PSA_ALG_SHA_512:
|
case PSA_ALG_SHA_512:
|
||||||
mbedtls_sha512_free( &operation->ctx.sha512 );
|
mbedtls_sha512_free( &operation->ctx.sha512 );
|
||||||
break;
|
break;
|
||||||
@ -2689,17 +2695,25 @@ psa_status_t psa_hash_update( psa_hash_operation_t *operation,
|
|||||||
input, input_length );
|
input, input_length );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
|
||||||
case PSA_ALG_SHA_224:
|
case PSA_ALG_SHA_224:
|
||||||
|
ret = mbedtls_sha256_update_ret( &operation->ctx.sha256,
|
||||||
|
input, input_length );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
|
||||||
case PSA_ALG_SHA_256:
|
case PSA_ALG_SHA_256:
|
||||||
ret = mbedtls_sha256_update_ret( &operation->ctx.sha256,
|
ret = mbedtls_sha256_update_ret( &operation->ctx.sha256,
|
||||||
input, input_length );
|
input, input_length );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
|
||||||
case PSA_ALG_SHA_384:
|
case PSA_ALG_SHA_384:
|
||||||
|
ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
|
||||||
|
input, input_length );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
|
||||||
case PSA_ALG_SHA_512:
|
case PSA_ALG_SHA_512:
|
||||||
ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
|
ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
|
||||||
input, input_length );
|
input, input_length );
|
||||||
@ -2766,16 +2780,22 @@ psa_status_t psa_hash_finish( psa_hash_operation_t *operation,
|
|||||||
ret = mbedtls_sha1_finish_ret( &operation->ctx.sha1, hash );
|
ret = mbedtls_sha1_finish_ret( &operation->ctx.sha1, hash );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
|
||||||
case PSA_ALG_SHA_224:
|
case PSA_ALG_SHA_224:
|
||||||
|
ret = mbedtls_sha256_finish_ret( &operation->ctx.sha256, hash );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
|
||||||
case PSA_ALG_SHA_256:
|
case PSA_ALG_SHA_256:
|
||||||
ret = mbedtls_sha256_finish_ret( &operation->ctx.sha256, hash );
|
ret = mbedtls_sha256_finish_ret( &operation->ctx.sha256, hash );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
|
||||||
case PSA_ALG_SHA_384:
|
case PSA_ALG_SHA_384:
|
||||||
|
ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
|
||||||
case PSA_ALG_SHA_512:
|
case PSA_ALG_SHA_512:
|
||||||
ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
|
ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
|
||||||
break;
|
break;
|
||||||
@ -2908,17 +2928,25 @@ psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation,
|
|||||||
&source_operation->ctx.sha1 );
|
&source_operation->ctx.sha1 );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
|
|
||||||
case PSA_ALG_SHA_224:
|
case PSA_ALG_SHA_224:
|
||||||
|
mbedtls_sha256_clone( &target_operation->ctx.sha256,
|
||||||
|
&source_operation->ctx.sha256 );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
|
||||||
case PSA_ALG_SHA_256:
|
case PSA_ALG_SHA_256:
|
||||||
mbedtls_sha256_clone( &target_operation->ctx.sha256,
|
mbedtls_sha256_clone( &target_operation->ctx.sha256,
|
||||||
&source_operation->ctx.sha256 );
|
&source_operation->ctx.sha256 );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
||||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
|
|
||||||
case PSA_ALG_SHA_384:
|
case PSA_ALG_SHA_384:
|
||||||
|
mbedtls_sha512_clone( &target_operation->ctx.sha512,
|
||||||
|
&source_operation->ctx.sha512 );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
|
||||||
case PSA_ALG_SHA_512:
|
case PSA_ALG_SHA_512:
|
||||||
mbedtls_sha512_clone( &target_operation->ctx.sha512,
|
mbedtls_sha512_clone( &target_operation->ctx.sha512,
|
||||||
&source_operation->ctx.sha512 );
|
&source_operation->ctx.sha512 );
|
||||||
|
Loading…
Reference in New Issue
Block a user