mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-10-31 21:50:31 +03:00
test_driver_cipher: add forced return status for encrypt and set_iv
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@@ -41,7 +41,7 @@ psa_status_t mbedtls_test_transparent_cipher_encrypt(
|
||||
size_t *output_length)
|
||||
{
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.cipher_encrypt_hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits_encrypt++;
|
||||
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_output != NULL) {
|
||||
if (output_size < mbedtls_test_driver_cipher_hooks.forced_output_length) {
|
||||
@@ -59,6 +59,9 @@ psa_status_t mbedtls_test_transparent_cipher_encrypt(
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
|
||||
return mbedtls_test_driver_cipher_hooks.forced_status;
|
||||
}
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_status_encrypt != PSA_SUCCESS) {
|
||||
return mbedtls_test_driver_cipher_hooks.forced_status_encrypt;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||
@@ -209,10 +212,14 @@ psa_status_t mbedtls_test_transparent_cipher_set_iv(
|
||||
size_t iv_length)
|
||||
{
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits_set_iv++;
|
||||
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
|
||||
return mbedtls_test_driver_cipher_hooks.forced_status;
|
||||
}
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_status_set_iv != PSA_SUCCESS) {
|
||||
return mbedtls_test_driver_cipher_hooks.forced_status_set_iv;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
|
||||
defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||
@@ -249,7 +256,6 @@ psa_status_t mbedtls_test_transparent_cipher_update(
|
||||
}
|
||||
|
||||
if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
|
||||
++mbedtls_test_driver_cipher_hooks.cipher_update_forced_status_hits;
|
||||
return mbedtls_test_driver_cipher_hooks.forced_status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user