Merge upstream test driver changes locally
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
f0e21de430
commit
a218ceba93
3 changed files with 101 additions and 92 deletions
|
@ -1311,7 +1311,7 @@ psa_status_t psa_driver_wrapper_aead_encrypt_setup(
|
||||||
#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)
|
||||||
status = PSA_ERROR_NOT_SUPPORTED;
|
status = PSA_ERROR_NOT_SUPPORTED;
|
||||||
status = test_transparent_aead_encrypt_setup(
|
status = mbedtls_test_transparent_aead_encrypt_setup(
|
||||||
operation, attributes,
|
operation, attributes,
|
||||||
key_buffer, key_buffer_size,
|
key_buffer, key_buffer_size,
|
||||||
alg );
|
alg );
|
||||||
|
@ -1361,7 +1361,7 @@ psa_status_t psa_driver_wrapper_aead_decrypt_setup(
|
||||||
#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)
|
||||||
status = PSA_ERROR_NOT_SUPPORTED;
|
status = PSA_ERROR_NOT_SUPPORTED;
|
||||||
status = test_transparent_aead_decrypt_setup(
|
status = mbedtls_test_transparent_aead_decrypt_setup(
|
||||||
operation, attributes,
|
operation, attributes,
|
||||||
key_buffer, key_buffer_size,
|
key_buffer, key_buffer_size,
|
||||||
alg );
|
alg );
|
||||||
|
@ -1401,14 +1401,15 @@ psa_status_t psa_driver_wrapper_aead_set_nonce(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_set_nonce( operation, nonce, nonce_length ) );
|
return( mbedtls_psa_aead_set_nonce( operation, nonce,
|
||||||
|
nonce_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_set_nonce(
|
return( mbedtls_test_transparent_aead_set_nonce(
|
||||||
operation, nonce, nonce_length ) );
|
operation, nonce, nonce_length ) );
|
||||||
|
|
||||||
/* Add cases for opaque driver here */
|
/* Add cases for opaque driver here */
|
||||||
|
@ -1432,14 +1433,15 @@ psa_status_t psa_driver_wrapper_aead_set_lengths(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_set_lengths( operation, ad_length, plaintext_length ) );
|
return( mbedtls_psa_aead_set_lengths( operation, ad_length,
|
||||||
|
plaintext_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_set_lengths(
|
return( mbedtls_test_transparent_aead_set_lengths(
|
||||||
operation, ad_length, plaintext_length ) );
|
operation, ad_length, plaintext_length ) );
|
||||||
|
|
||||||
/* Add cases for opaque driver here */
|
/* Add cases for opaque driver here */
|
||||||
|
@ -1463,14 +1465,15 @@ psa_status_t psa_driver_wrapper_aead_update_ad(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_update_ad( operation, input, input_length ) );
|
return( mbedtls_psa_aead_update_ad( operation, input,
|
||||||
|
input_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_update_ad(
|
return( mbedtls_test_transparent_aead_update_ad(
|
||||||
operation, input, input_length ) );
|
operation, input, input_length ) );
|
||||||
|
|
||||||
/* Add cases for opaque driver here */
|
/* Add cases for opaque driver here */
|
||||||
|
@ -1497,15 +1500,16 @@ psa_status_t psa_driver_wrapper_aead_update(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_update( operation, input, input_length, output,
|
return( mbedtls_psa_aead_update( operation, input, input_length,
|
||||||
output_size, output_length ) );
|
output, output_size,
|
||||||
|
output_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_update(
|
return( mbedtls_test_transparent_aead_update(
|
||||||
operation, input, input_length, output, output_size,
|
operation, input, input_length, output, output_size,
|
||||||
output_length ) );
|
output_length ) );
|
||||||
|
|
||||||
|
@ -1537,15 +1541,17 @@ psa_status_t psa_driver_wrapper_aead_finish(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_finish( operation, ciphertext, ciphertext_size,
|
return( mbedtls_psa_aead_finish( operation, ciphertext,
|
||||||
ciphertext_length, tag, tag_size, tag_length ) );
|
ciphertext_size,
|
||||||
|
ciphertext_length, tag,
|
||||||
|
tag_size, tag_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_finish(
|
return( mbedtls_test_transparent_aead_finish(
|
||||||
operation, ciphertext, ciphertext_size,
|
operation, ciphertext, ciphertext_size,
|
||||||
ciphertext_length, tag, tag_size, tag_length ) );
|
ciphertext_length, tag, tag_size, tag_length ) );
|
||||||
|
|
||||||
|
@ -1577,15 +1583,16 @@ psa_status_t psa_driver_wrapper_aead_verify(
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
|
||||||
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
case PSA_CRYPTO_MBED_TLS_DRIVER_ID:
|
||||||
return( mbedtls_psa_aead_verify( operation, plaintext, plaintext_size,
|
return( mbedtls_psa_aead_verify( operation, plaintext,
|
||||||
plaintext_length, tag, tag_length ) );
|
plaintext_size, plaintext_length,
|
||||||
|
tag, tag_length ) );
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
|
||||||
|
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_verify(
|
return( mbedtls_test_transparent_aead_verify(
|
||||||
operation, plaintext, plaintext_size,
|
operation, plaintext, plaintext_size,
|
||||||
plaintext_length, tag, tag_length ) );
|
plaintext_length, tag, tag_length ) );
|
||||||
|
|
||||||
|
@ -1618,7 +1625,7 @@ psa_status_t psa_driver_wrapper_aead_abort(
|
||||||
#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)
|
||||||
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
|
||||||
return( test_transparent_aead_abort( operation ) );
|
return( mbedtls_test_transparent_aead_abort( operation ) );
|
||||||
|
|
||||||
/* Add cases for opaque driver here */
|
/* Add cases for opaque driver here */
|
||||||
|
|
||||||
|
|
|
@ -67,34 +67,34 @@ psa_status_t mbedtls_test_transparent_aead_decrypt(
|
||||||
const uint8_t *ciphertext, size_t ciphertext_length,
|
const uint8_t *ciphertext, size_t ciphertext_length,
|
||||||
uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length );
|
uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_encrypt_setup(
|
psa_status_t mbedtls_test_transparent_aead_encrypt_setup(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||||
psa_algorithm_t alg );
|
psa_algorithm_t alg );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_decrypt_setup(
|
psa_status_t mbedtls_test_transparent_aead_decrypt_setup(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||||
psa_algorithm_t alg );
|
psa_algorithm_t alg );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_set_nonce(
|
psa_status_t mbedtls_test_transparent_aead_set_nonce(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *nonce,
|
const uint8_t *nonce,
|
||||||
size_t nonce_length );
|
size_t nonce_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_set_lengths(
|
psa_status_t mbedtls_test_transparent_aead_set_lengths(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
size_t ad_length,
|
size_t ad_length,
|
||||||
size_t plaintext_length );
|
size_t plaintext_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_update_ad(
|
psa_status_t mbedtls_test_transparent_aead_update_ad(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *input,
|
const uint8_t *input,
|
||||||
size_t input_length );
|
size_t input_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_update(
|
psa_status_t mbedtls_test_transparent_aead_update(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *input,
|
const uint8_t *input,
|
||||||
size_t input_length,
|
size_t input_length,
|
||||||
|
@ -102,7 +102,7 @@ psa_status_t test_transparent_aead_update(
|
||||||
size_t output_size,
|
size_t output_size,
|
||||||
size_t *output_length );
|
size_t *output_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_finish(
|
psa_status_t mbedtls_test_transparent_aead_finish(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
uint8_t *ciphertext,
|
uint8_t *ciphertext,
|
||||||
size_t ciphertext_size,
|
size_t ciphertext_size,
|
||||||
|
@ -111,7 +111,7 @@ psa_status_t test_transparent_aead_finish(
|
||||||
size_t tag_size,
|
size_t tag_size,
|
||||||
size_t *tag_length );
|
size_t *tag_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_verify(
|
psa_status_t mbedtls_test_transparent_aead_verify(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
uint8_t *plaintext,
|
uint8_t *plaintext,
|
||||||
size_t plaintext_size,
|
size_t plaintext_size,
|
||||||
|
@ -119,7 +119,7 @@ psa_status_t test_transparent_aead_verify(
|
||||||
const uint8_t *tag,
|
const uint8_t *tag,
|
||||||
size_t tag_length );
|
size_t tag_length );
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_abort(
|
psa_status_t mbedtls_test_transparent_aead_abort(
|
||||||
psa_aead_operation_t *operation );
|
psa_aead_operation_t *operation );
|
||||||
|
|
||||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||||
|
|
|
@ -93,116 +93,117 @@ psa_status_t mbedtls_test_transparent_aead_decrypt(
|
||||||
return( mbedtls_test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_encrypt_setup(
|
psa_status_t mbedtls_test_transparent_aead_encrypt_setup(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||||
psa_algorithm_t alg )
|
psa_algorithm_t alg )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_encrypt_setup( operation, attributes, key_buffer,
|
mbedtls_psa_aead_encrypt_setup( operation, attributes, key_buffer,
|
||||||
key_buffer_size, alg );
|
key_buffer_size, alg );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_decrypt_setup(
|
psa_status_t mbedtls_test_transparent_aead_decrypt_setup(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||||
psa_algorithm_t alg )
|
psa_algorithm_t alg )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_decrypt_setup( operation, attributes, key_buffer,
|
mbedtls_psa_aead_decrypt_setup( operation, attributes, key_buffer,
|
||||||
key_buffer_size, alg );
|
key_buffer_size, alg );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_set_nonce(
|
psa_status_t mbedtls_test_transparent_aead_set_nonce(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *nonce,
|
const uint8_t *nonce,
|
||||||
size_t nonce_length )
|
size_t nonce_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_set_nonce( operation, nonce, nonce_length );
|
mbedtls_psa_aead_set_nonce( operation, nonce, nonce_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_set_lengths(
|
psa_status_t mbedtls_test_transparent_aead_set_lengths(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
size_t ad_length,
|
size_t ad_length,
|
||||||
size_t plaintext_length )
|
size_t plaintext_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_set_lengths( operation, ad_length, plaintext_length );
|
mbedtls_psa_aead_set_lengths( operation, ad_length,
|
||||||
|
plaintext_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_update_ad(
|
psa_status_t mbedtls_test_transparent_aead_update_ad(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *input,
|
const uint8_t *input,
|
||||||
size_t input_length )
|
size_t input_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_update_ad( operation, input, input_length );
|
mbedtls_psa_aead_update_ad( operation, input, input_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_update(
|
psa_status_t mbedtls_test_transparent_aead_update(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
const uint8_t *input,
|
const uint8_t *input,
|
||||||
size_t input_length,
|
size_t input_length,
|
||||||
|
@ -210,24 +211,24 @@ psa_status_t test_transparent_aead_update(
|
||||||
size_t output_size,
|
size_t output_size,
|
||||||
size_t *output_length )
|
size_t *output_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_update( operation, input, input_length, output,
|
mbedtls_psa_aead_update( operation, input, input_length, output,
|
||||||
output_size, output_length );
|
output_size, output_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_finish(
|
psa_status_t mbedtls_test_transparent_aead_finish(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
uint8_t *ciphertext,
|
uint8_t *ciphertext,
|
||||||
size_t ciphertext_size,
|
size_t ciphertext_size,
|
||||||
|
@ -236,24 +237,25 @@ psa_status_t test_transparent_aead_finish(
|
||||||
size_t tag_size,
|
size_t tag_size,
|
||||||
size_t *tag_length )
|
size_t *tag_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_finish( operation, ciphertext, ciphertext_size,
|
mbedtls_psa_aead_finish( operation, ciphertext, ciphertext_size,
|
||||||
ciphertext_length, tag, tag_size, tag_length );
|
ciphertext_length, tag, tag_size,
|
||||||
|
tag_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_verify(
|
psa_status_t mbedtls_test_transparent_aead_verify(
|
||||||
psa_aead_operation_t *operation,
|
psa_aead_operation_t *operation,
|
||||||
uint8_t *plaintext,
|
uint8_t *plaintext,
|
||||||
size_t plaintext_size,
|
size_t plaintext_size,
|
||||||
|
@ -261,40 +263,40 @@ psa_status_t test_transparent_aead_verify(
|
||||||
const uint8_t *tag,
|
const uint8_t *tag,
|
||||||
size_t tag_length )
|
size_t tag_length )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_verify( operation, plaintext, plaintext_size,
|
mbedtls_psa_aead_verify( operation, plaintext, plaintext_size,
|
||||||
plaintext_length, tag, tag_length );
|
plaintext_length, tag, tag_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t test_transparent_aead_abort(
|
psa_status_t mbedtls_test_transparent_aead_abort(
|
||||||
psa_aead_operation_t *operation )
|
psa_aead_operation_t *operation )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.hits++;
|
mbedtls_test_driver_aead_hooks.hits++;
|
||||||
|
|
||||||
if( test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
test_driver_aead_hooks.forced_status;
|
mbedtls_test_driver_aead_hooks.forced_status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test_driver_aead_hooks.driver_status =
|
mbedtls_test_driver_aead_hooks.driver_status =
|
||||||
mbedtls_psa_aead_abort( operation );
|
mbedtls_psa_aead_abort( operation );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( test_driver_aead_hooks.driver_status );
|
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
|
#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue