1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Fix {sign|verify}_get_num_ops

Move the obfuscation of the internal library only returning a delta of ops done
into the driver wrapper, thus meaning driver wrapper and API call both return
absolute values of work done. Document the differences at the internal
implementation level.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott
2023-02-07 12:43:11 +00:00
parent 939bd9485d
commit de1114c883
3 changed files with 32 additions and 24 deletions

View File

@ -453,7 +453,11 @@ uint32_t psa_driver_wrapper_sign_hash_get_num_ops(
return 0;
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
return( mbedtls_psa_sign_hash_get_num_ops(
/* Internal implementation returns a delta of ops completed in the
* last call to complete(), so need to add in ops already completed
* before this.*/
return( operation->num_ops +
mbedtls_psa_sign_hash_get_num_ops(
&operation->ctx.mbedtls_ctx )
);
@ -478,7 +482,11 @@ uint32_t psa_driver_wrapper_verify_hash_get_num_ops(
return 0;
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
return( mbedtls_psa_verify_hash_get_num_ops(
/* Internal implementation returns a delta of ops completed in the
* last call to complete(), so need to add in ops already completed
* before this.*/
return ( operation->num_ops +
mbedtls_psa_verify_hash_get_num_ops(
&operation->ctx.mbedtls_ctx )
);