mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-24 19:43:32 +00:00
Replace allocated hash buffer with array
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
b830b35fb1
commit
84329464d5
@ -120,7 +120,7 @@ typedef struct {
|
||||
size_t MBEDTLS_PRIVATE(coordinate_bytes);
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
mbedtls_md_type_t MBEDTLS_PRIVATE(md_alg);
|
||||
uint8_t *MBEDTLS_PRIVATE(hash);
|
||||
uint8_t MBEDTLS_PRIVATE(hash)[PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)];
|
||||
size_t MBEDTLS_PRIVATE(hash_length);
|
||||
|
||||
#else
|
||||
@ -150,7 +150,7 @@ typedef struct {
|
||||
mbedtls_ecdsa_context *MBEDTLS_PRIVATE(ctx);
|
||||
mbedtls_ecdsa_restart_ctx MBEDTLS_PRIVATE(restart_ctx);
|
||||
|
||||
uint8_t *MBEDTLS_PRIVATE(hash);
|
||||
uint8_t MBEDTLS_PRIVATE(hash)[PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)];
|
||||
size_t MBEDTLS_PRIVATE(hash_length);
|
||||
|
||||
mbedtls_mpi MBEDTLS_PRIVATE(r);
|
||||
|
@ -3561,12 +3561,6 @@ psa_status_t mbedtls_psa_sign_hash_start(
|
||||
operation->md_alg = mbedtls_hash_info_md_from_psa(hash_alg);
|
||||
operation->alg = alg;
|
||||
|
||||
operation->hash = mbedtls_calloc(1, hash_length);
|
||||
|
||||
if (operation->hash == NULL) {
|
||||
return PSA_ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(operation->hash, hash, hash_length);
|
||||
operation->hash_length = hash_length;
|
||||
|
||||
@ -3698,9 +3692,6 @@ psa_status_t mbedtls_psa_sign_hash_abort(
|
||||
operation->ctx = NULL;
|
||||
}
|
||||
|
||||
mbedtls_free(operation->hash);
|
||||
operation->hash = NULL;
|
||||
|
||||
mbedtls_ecdsa_restart_free(&operation->restart_ctx);
|
||||
|
||||
return PSA_SUCCESS;
|
||||
@ -3789,12 +3780,6 @@ psa_status_t mbedtls_psa_verify_hash_start(
|
||||
|
||||
mbedtls_ecdsa_restart_init(&operation->restart_ctx);
|
||||
|
||||
operation->hash = mbedtls_calloc(1, hash_length);
|
||||
|
||||
if (operation->hash == NULL) {
|
||||
return PSA_ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(operation->hash, hash, hash_length);
|
||||
operation->hash_length = hash_length;
|
||||
|
||||
@ -3858,9 +3843,6 @@ psa_status_t mbedtls_psa_verify_hash_abort(
|
||||
operation->ctx = NULL;
|
||||
}
|
||||
|
||||
mbedtls_free(operation->hash);
|
||||
operation->hash = NULL;
|
||||
|
||||
mbedtls_ecdsa_restart_free(&operation->restart_ctx);
|
||||
|
||||
mbedtls_mpi_free(&operation->r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user