diff --git a/library/x509_crt.c b/library/x509_crt.c index b0c2d481a..c12685d1e 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -47,7 +47,6 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" #include "mbedtls/psa_util.h" -#include "psa/crypto_values.h" #endif /* MBEDTLS_USE_PSA_CRYPTO */ #if defined(MBEDTLS_PLATFORM_C) @@ -2382,7 +2381,8 @@ static int x509_crt_verifycrl( mbedtls_x509_crt *crt, mbedtls_x509_crt *ca, if(psa_hash_compute( psa_algorithm, crl_list->tbs.p, crl_list->tbs.len, - hash,PSA_HASH_MAX_SIZE, + hash, + sizeof( hash ), &hash_length ) != PSA_SUCCESS ) #else md_info = mbedtls_md_info_from_type( crl_list->sig_md ); @@ -2460,7 +2460,7 @@ static int x509_crt_check_signature( const mbedtls_x509_crt *child, child->tbs.p, child->tbs.len, hash, - PSA_HASH_MAX_SIZE, + sizeof( hash ), &hash_len ); if( status != PSA_SUCCESS ) { diff --git a/library/x509write_crt.c b/library/x509write_crt.c index b0589cc20..6703474bd 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -236,9 +236,9 @@ int mbedtls_x509write_crt_set_authority_key_identifier( mbedtls_x509write_cert * mbedtls_pk_write_pubkey( &c, buf, ctx->issuer_key ) ); #if defined(MBEDTLS_USE_PSA_CRYPTO) status = psa_hash_compute( PSA_ALG_SHA_1, - buf + sizeof( buf ) - len, + buf + sizeof(buf) - len, len, - buf + sizeof( buf ) - 20 , + buf + sizeof(buf) - 20, PSA_HASH_LENGTH(PSA_ALG_SHA_1), &hash_length ); if( status != PSA_SUCCESS ) @@ -523,7 +523,7 @@ int mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, c, len, hash, - PSA_HASH_MAX_SIZE, + sizeof( hash ), &hash_length ); if( status != PSA_SUCCESS ) { diff --git a/library/x509write_csr.c b/library/x509write_csr.c index a58374f3d..591fb6d04 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -222,7 +222,7 @@ static int x509write_csr_der_internal( mbedtls_x509write_csr *ctx, c, len, hash, - PSA_HASH_MAX_SIZE, + sizeof( hash ), &hash_len ) != PSA_SUCCESS ) { return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );