mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-26 12:39:55 +00:00
Fix missing mbedtls_mpi_free() on signing.
After moving the MPIs used to output from the operation into the complete function, I failed to move the accompanying free as well. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
c08112160a
commit
724bd25f4b
@ -3617,10 +3617,10 @@ psa_status_t mbedtls_psa_sign_hash_complete(
|
|||||||
MBEDTLS_PSA_RANDOM_STATE,
|
MBEDTLS_PSA_RANDOM_STATE,
|
||||||
&operation->restart_ctx));
|
&operation->restart_ctx));
|
||||||
#else /* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) */
|
#else /* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) */
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
status = PSA_ERROR_NOT_SUPPORTED;
|
||||||
|
goto exit;
|
||||||
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) */
|
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) */
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
status = mbedtls_to_psa_error(
|
status = mbedtls_to_psa_error(
|
||||||
mbedtls_ecdsa_sign_restartable(&operation->ctx->grp,
|
mbedtls_ecdsa_sign_restartable(&operation->ctx->grp,
|
||||||
&r,
|
&r,
|
||||||
@ -3635,9 +3635,7 @@ psa_status_t mbedtls_psa_sign_hash_complete(
|
|||||||
&operation->restart_ctx));
|
&operation->restart_ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != PSA_SUCCESS) {
|
if (status == PSA_SUCCESS) {
|
||||||
return status;
|
|
||||||
} else {
|
|
||||||
status = mbedtls_to_psa_error(
|
status = mbedtls_to_psa_error(
|
||||||
mbedtls_mpi_write_binary(&r,
|
mbedtls_mpi_write_binary(&r,
|
||||||
signature,
|
signature,
|
||||||
@ -3645,7 +3643,7 @@ psa_status_t mbedtls_psa_sign_hash_complete(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
return status;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = mbedtls_to_psa_error(
|
status = mbedtls_to_psa_error(
|
||||||
@ -3656,13 +3654,20 @@ psa_status_t mbedtls_psa_sign_hash_complete(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
return status;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
*signature_length = operation->coordinate_bytes * 2;
|
*signature_length = operation->coordinate_bytes * 2;
|
||||||
|
|
||||||
return PSA_SUCCESS;
|
status = PSA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
|
||||||
|
mbedtls_mpi_free(&r);
|
||||||
|
mbedtls_mpi_free(&s);
|
||||||
|
return status;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
(void) operation;
|
(void) operation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user