mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-26 15:07:59 +08:00
Fix error handling in psa_driver_wrapper_xxx_hash_get_num_ops
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
7f288566c3
commit
321c7e9ed9
@ -3470,7 +3470,9 @@ psa_status_t psa_sign_hash_complete(
|
|||||||
signature_length);
|
signature_length);
|
||||||
|
|
||||||
/* Update ops count with work done. */
|
/* Update ops count with work done. */
|
||||||
operation->num_ops = psa_driver_wrapper_sign_hash_get_num_ops(operation);
|
if (status == PSA_SUCCESS) {
|
||||||
|
status = psa_driver_wrapper_sign_hash_get_num_ops(operation, &operation->num_ops);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
@ -3601,8 +3603,9 @@ psa_status_t psa_verify_hash_complete(
|
|||||||
status = psa_driver_wrapper_verify_hash_complete(operation);
|
status = psa_driver_wrapper_verify_hash_complete(operation);
|
||||||
|
|
||||||
/* Update ops count with work done. */
|
/* Update ops count with work done. */
|
||||||
operation->num_ops = psa_driver_wrapper_verify_hash_get_num_ops(
|
if (status == PSA_SUCCESS) {
|
||||||
operation);
|
status = psa_driver_wrapper_verify_hash_get_num_ops(operation, &operation->num_ops);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
|
@ -472,17 +472,19 @@ static inline psa_status_t psa_driver_wrapper_verify_hash(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t psa_driver_wrapper_sign_hash_get_num_ops(
|
static inline int psa_driver_wrapper_sign_hash_get_num_ops(
|
||||||
psa_sign_hash_interruptible_operation_t *operation )
|
psa_sign_hash_interruptible_operation_t *operation, uint32_t *num_ops )
|
||||||
{
|
{
|
||||||
switch( operation->id )
|
switch( operation->id )
|
||||||
{
|
{
|
||||||
/* If uninitialised, return 0, as no work can have been done. */
|
/* If uninitialised, return 0, as no work can have been done. */
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
*num_ops = 0;
|
||||||
|
return PSA_SUCCESS;
|
||||||
|
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return(mbedtls_psa_sign_hash_get_num_ops(&operation->ctx.mbedtls_ctx));
|
*num_ops = mbedtls_psa_sign_hash_get_num_ops(&operation->ctx.mbedtls_ctx);
|
||||||
|
return PSA_SUCCESS;
|
||||||
|
|
||||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
@ -495,17 +497,19 @@ static inline uint32_t psa_driver_wrapper_sign_hash_get_num_ops(
|
|||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t psa_driver_wrapper_verify_hash_get_num_ops(
|
static inline int psa_driver_wrapper_verify_hash_get_num_ops(
|
||||||
psa_verify_hash_interruptible_operation_t *operation )
|
psa_verify_hash_interruptible_operation_t *operation, uint32_t *num_ops )
|
||||||
{
|
{
|
||||||
switch( operation->id )
|
switch( operation->id )
|
||||||
{
|
{
|
||||||
/* If uninitialised, return 0, as no work can have been done. */
|
/* If uninitialised, return 0, as no work can have been done. */
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
*num_ops = 0;
|
||||||
|
return PSA_SUCCESS;
|
||||||
|
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return (mbedtls_psa_verify_hash_get_num_ops(&operation->ctx.mbedtls_ctx));
|
*num_ops = mbedtls_psa_verify_hash_get_num_ops(&operation->ctx.mbedtls_ctx);
|
||||||
|
return PSA_SUCCESS;
|
||||||
|
|
||||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||||
@ -516,7 +520,7 @@ static inline uint32_t psa_driver_wrapper_verify_hash_get_num_ops(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
return ( PSA_ERROR_INVALID_ARGUMENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline psa_status_t psa_driver_wrapper_sign_hash_start(
|
static inline psa_status_t psa_driver_wrapper_sign_hash_start(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user