mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-11 18:40:53 +00:00
Assume get_num_ops cannot fail
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
fe43d12f60
commit
3572bde9c9
@ -3448,7 +3448,6 @@ psa_status_t psa_sign_hash_complete(
|
|||||||
size_t *signature_length)
|
size_t *signature_length)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
psa_status_t numops_status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
||||||
|
|
||||||
*signature_length = 0;
|
*signature_length = 0;
|
||||||
|
|
||||||
@ -3471,10 +3470,7 @@ psa_status_t psa_sign_hash_complete(
|
|||||||
signature_length);
|
signature_length);
|
||||||
|
|
||||||
/* Update ops count with work done. */
|
/* Update ops count with work done. */
|
||||||
numops_status = psa_driver_wrapper_sign_hash_get_num_ops(operation, &operation->num_ops);
|
operation->num_ops = psa_driver_wrapper_sign_hash_get_num_ops(operation);
|
||||||
if (status == PSA_SUCCESS) {
|
|
||||||
status = numops_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
@ -3594,7 +3590,6 @@ psa_status_t psa_verify_hash_complete(
|
|||||||
psa_verify_hash_interruptible_operation_t *operation)
|
psa_verify_hash_interruptible_operation_t *operation)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
psa_status_t numops_status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
||||||
|
|
||||||
/* Check that start has been called first, and that operation has not
|
/* Check that start has been called first, and that operation has not
|
||||||
* previously errored. */
|
* previously errored. */
|
||||||
@ -3606,10 +3601,8 @@ 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. */
|
||||||
numops_status = psa_driver_wrapper_verify_hash_get_num_ops(operation, &operation->num_ops);
|
operation->num_ops = psa_driver_wrapper_verify_hash_get_num_ops(
|
||||||
if (status == PSA_SUCCESS) {
|
operation);
|
||||||
status = numops_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
|
@ -472,19 +472,17 @@ static inline psa_status_t psa_driver_wrapper_verify_hash(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline psa_status_t psa_driver_wrapper_sign_hash_get_num_ops(
|
static inline uint32_t psa_driver_wrapper_sign_hash_get_num_ops(
|
||||||
psa_sign_hash_interruptible_operation_t *operation, uint32_t *num_ops )
|
psa_sign_hash_interruptible_operation_t *operation )
|
||||||
{
|
{
|
||||||
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:
|
||||||
*num_ops = 0;
|
return 0;
|
||||||
return PSA_SUCCESS;
|
|
||||||
|
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
*num_ops = mbedtls_psa_sign_hash_get_num_ops(&operation->ctx.mbedtls_ctx);
|
return(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)
|
||||||
@ -494,22 +492,21 @@ static inline psa_status_t psa_driver_wrapper_sign_hash_get_num_ops(
|
|||||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||||
}
|
}
|
||||||
|
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
/* Can't happen (see discussion in #8271) */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline psa_status_t psa_driver_wrapper_verify_hash_get_num_ops(
|
static inline uint32_t psa_driver_wrapper_verify_hash_get_num_ops(
|
||||||
psa_verify_hash_interruptible_operation_t *operation, uint32_t *num_ops )
|
psa_verify_hash_interruptible_operation_t *operation )
|
||||||
{
|
{
|
||||||
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:
|
||||||
*num_ops = 0;
|
return 0;
|
||||||
return PSA_SUCCESS;
|
|
||||||
|
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
*num_ops = mbedtls_psa_verify_hash_get_num_ops(&operation->ctx.mbedtls_ctx);
|
return (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)
|
||||||
@ -520,7 +517,8 @@ static inline psa_status_t psa_driver_wrapper_verify_hash_get_num_ops(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( PSA_ERROR_INVALID_ARGUMENT );
|
/* Can't happen (see discussion in #8271) */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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