Changing buffer size checks.
Signed-off-by: pespacek <peter.spacek@silabs.com>
diff --git a/library/x509_crt.c b/library/x509_crt.c
index b0c2d48..c12685d 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 @@
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 @@
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 b0589cc..6703474 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -236,9 +236,9 @@
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 @@
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 a58374f..591fb6d 100644
--- a/library/x509write_csr.c
+++ b/library/x509write_csr.c
@@ -222,7 +222,7 @@
c,
len,
hash,
- PSA_HASH_MAX_SIZE,
+ sizeof( hash ),
&hash_len ) != PSA_SUCCESS )
{
return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );