mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-09-02 16:01:16 +03:00
tests: psa: Add mbedtls/MBEDTLS prefix to test driver symbols
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
@@ -28,133 +28,134 @@
|
||||
|
||||
#include "test/drivers/hash.h"
|
||||
|
||||
test_driver_hash_hooks_t test_driver_hash_hooks = TEST_DRIVER_HASH_INIT;
|
||||
mbedtls_test_driver_hash_hooks_t
|
||||
mbedtls_test_driver_hash_hooks = MBEDTLS_TEST_DRIVER_HASH_INIT;
|
||||
|
||||
psa_status_t test_transparent_hash_compute(
|
||||
psa_status_t mbedtls_test_transparent_hash_compute(
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *hash, size_t hash_size, size_t *hash_length )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_compute(
|
||||
alg, input, input_length,
|
||||
hash, hash_size, hash_length );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_hash_setup(
|
||||
psa_status_t mbedtls_test_transparent_hash_setup(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
psa_algorithm_t alg )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_setup( operation, alg );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_hash_clone(
|
||||
psa_status_t mbedtls_test_transparent_hash_clone(
|
||||
const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
|
||||
mbedtls_transparent_test_driver_hash_operation_t *target_operation )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_clone( source_operation,
|
||||
target_operation );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_hash_update(
|
||||
psa_status_t mbedtls_test_transparent_hash_update(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_update(
|
||||
operation, input, input_length );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_hash_finish(
|
||||
psa_status_t mbedtls_test_transparent_hash_finish(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
uint8_t *hash,
|
||||
size_t hash_size,
|
||||
size_t *hash_length )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_finish(
|
||||
operation, hash, hash_size, hash_length );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_hash_abort(
|
||||
psa_status_t mbedtls_test_transparent_hash_abort(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation )
|
||||
{
|
||||
test_driver_hash_hooks.hits++;
|
||||
mbedtls_test_driver_hash_hooks.hits++;
|
||||
|
||||
if( test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
test_driver_hash_hooks.forced_status;
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_hash_hooks.driver_status =
|
||||
mbedtls_test_driver_hash_hooks.driver_status =
|
||||
mbedtls_transparent_test_driver_hash_abort( operation );
|
||||
}
|
||||
|
||||
return( test_driver_hash_hooks.driver_status );
|
||||
return( mbedtls_test_driver_hash_hooks.driver_status );
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <psa/crypto_extra.h>
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include <test/drivers/test_driver.h>
|
||||
#include <test/drivers/mbedtls_test_driver.h>
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
|
@@ -28,9 +28,10 @@
|
||||
|
||||
#include "test/drivers/aead.h"
|
||||
|
||||
test_driver_aead_hooks_t test_driver_aead_hooks = TEST_DRIVER_AEAD_INIT;
|
||||
mbedtls_test_driver_aead_hooks_t
|
||||
mbedtls_test_driver_aead_hooks = MBEDTLS_TEST_DRIVER_AEAD_INIT;
|
||||
|
||||
psa_status_t test_transparent_aead_encrypt(
|
||||
psa_status_t mbedtls_test_transparent_aead_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
@@ -39,16 +40,16 @@ psa_status_t test_transparent_aead_encrypt(
|
||||
const uint8_t *plaintext, size_t plaintext_length,
|
||||
uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_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 =
|
||||
test_driver_aead_hooks.forced_status;
|
||||
mbedtls_test_driver_aead_hooks.driver_status =
|
||||
mbedtls_test_driver_aead_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_aead_hooks.driver_status =
|
||||
mbedtls_test_driver_aead_hooks.driver_status =
|
||||
mbedtls_psa_aead_encrypt(
|
||||
attributes, key_buffer, key_buffer_size,
|
||||
alg,
|
||||
@@ -58,10 +59,10 @@ psa_status_t test_transparent_aead_encrypt(
|
||||
ciphertext, ciphertext_size, ciphertext_length );
|
||||
}
|
||||
|
||||
return( test_driver_aead_hooks.driver_status );
|
||||
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_aead_decrypt(
|
||||
psa_status_t mbedtls_test_transparent_aead_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
@@ -70,16 +71,16 @@ psa_status_t test_transparent_aead_decrypt(
|
||||
const uint8_t *ciphertext, size_t ciphertext_length,
|
||||
uint8_t *plaintext, size_t plaintext_size, 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 =
|
||||
test_driver_aead_hooks.forced_status;
|
||||
mbedtls_test_driver_aead_hooks.driver_status =
|
||||
mbedtls_test_driver_aead_hooks.forced_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_driver_aead_hooks.driver_status =
|
||||
mbedtls_test_driver_aead_hooks.driver_status =
|
||||
mbedtls_psa_aead_decrypt(
|
||||
attributes, key_buffer, key_buffer_size,
|
||||
alg,
|
||||
@@ -89,7 +90,7 @@ psa_status_t test_transparent_aead_decrypt(
|
||||
plaintext, plaintext_size, plaintext_length );
|
||||
}
|
||||
|
||||
return( test_driver_aead_hooks.driver_status );
|
||||
return( mbedtls_test_driver_aead_hooks.driver_status );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
|
||||
|
@@ -36,9 +36,10 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
test_driver_cipher_hooks_t test_driver_cipher_hooks = TEST_DRIVER_CIPHER_INIT;
|
||||
mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
|
||||
MBEDTLS_TEST_DRIVER_CIPHER_INIT;
|
||||
|
||||
static psa_status_t test_transparent_cipher_oneshot(
|
||||
static psa_status_t mbedtls_test_transparent_cipher_oneshot(
|
||||
mbedtls_operation_t direction,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
@@ -46,7 +47,7 @@ static psa_status_t test_transparent_cipher_oneshot(
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
/* Test driver supports AES-CTR only, to verify operation calls. */
|
||||
if( alg != PSA_ALG_CTR ||
|
||||
@@ -54,21 +55,21 @@ static psa_status_t test_transparent_cipher_oneshot(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
|
||||
/* If test driver response code is not SUCCESS, we can return early */
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
/* If test driver output is overridden, we don't need to do actual crypto */
|
||||
if( test_driver_cipher_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
|
||||
{
|
||||
if( output_size < test_driver_cipher_hooks.forced_output_length )
|
||||
if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
|
||||
memcpy( output,
|
||||
test_driver_cipher_hooks.forced_output,
|
||||
test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = test_driver_cipher_hooks.forced_output_length;
|
||||
mbedtls_test_driver_cipher_hooks.forced_output,
|
||||
mbedtls_test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
|
||||
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
}
|
||||
|
||||
/* Run AES-CTR using the cipher module */
|
||||
@@ -166,7 +167,7 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_encrypt(
|
||||
psa_status_t mbedtls_test_transparent_cipher_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
@@ -174,7 +175,7 @@ psa_status_t test_transparent_cipher_encrypt(
|
||||
uint8_t *output, size_t output_size, size_t *output_length)
|
||||
{
|
||||
return (
|
||||
test_transparent_cipher_oneshot(
|
||||
mbedtls_test_transparent_cipher_oneshot(
|
||||
MBEDTLS_ENCRYPT,
|
||||
attributes,
|
||||
key, key_length,
|
||||
@@ -183,7 +184,7 @@ psa_status_t test_transparent_cipher_encrypt(
|
||||
output, output_size, output_length) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_decrypt(
|
||||
psa_status_t mbedtls_test_transparent_cipher_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
@@ -191,7 +192,7 @@ psa_status_t test_transparent_cipher_decrypt(
|
||||
uint8_t *output, size_t output_size, size_t *output_length)
|
||||
{
|
||||
return (
|
||||
test_transparent_cipher_oneshot(
|
||||
mbedtls_test_transparent_cipher_oneshot(
|
||||
MBEDTLS_DECRYPT,
|
||||
attributes,
|
||||
key, key_length,
|
||||
@@ -200,13 +201,13 @@ psa_status_t test_transparent_cipher_decrypt(
|
||||
output, output_size, output_length) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_encrypt_setup(
|
||||
psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
/* Wiping the entire struct here, instead of member-by-member. This is
|
||||
* useful for the test suite, since it gives a chance of catching memory
|
||||
@@ -214,32 +215,32 @@ psa_status_t test_transparent_cipher_encrypt_setup(
|
||||
* our context struct. */
|
||||
memset( operation, 0, sizeof( *operation ) );
|
||||
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
return ( mbedtls_transparent_test_driver_cipher_encrypt_setup(
|
||||
operation, attributes, key, key_length, alg ) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_decrypt_setup(
|
||||
psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
return ( mbedtls_transparent_test_driver_cipher_decrypt_setup(
|
||||
operation, attributes, key, key_length, alg ) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_abort(
|
||||
psa_status_t mbedtls_test_transparent_cipher_abort(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
if( operation->alg == 0 )
|
||||
return( PSA_SUCCESS );
|
||||
@@ -252,24 +253,24 @@ psa_status_t test_transparent_cipher_abort(
|
||||
* our context struct. */
|
||||
memset( operation, 0, sizeof( *operation ) );
|
||||
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_set_iv(
|
||||
psa_status_t mbedtls_test_transparent_cipher_set_iv(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *iv,
|
||||
size_t iv_length)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
return( mbedtls_transparent_test_driver_cipher_set_iv(
|
||||
operation, iv, iv_length ) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_update(
|
||||
psa_status_t mbedtls_test_transparent_cipher_update(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
@@ -277,52 +278,52 @@ psa_status_t test_transparent_cipher_update(
|
||||
size_t output_size,
|
||||
size_t *output_length)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
if( test_driver_cipher_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
|
||||
{
|
||||
if( output_size < test_driver_cipher_hooks.forced_output_length )
|
||||
if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
|
||||
return PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
|
||||
memcpy( output,
|
||||
test_driver_cipher_hooks.forced_output,
|
||||
test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = test_driver_cipher_hooks.forced_output_length;
|
||||
mbedtls_test_driver_cipher_hooks.forced_output,
|
||||
mbedtls_test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
|
||||
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
}
|
||||
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
return( mbedtls_transparent_test_driver_cipher_update(
|
||||
operation, input, input_length,
|
||||
output, output_size, output_length ) );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_cipher_finish(
|
||||
psa_status_t mbedtls_test_transparent_cipher_finish(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
size_t *output_length)
|
||||
{
|
||||
test_driver_cipher_hooks.hits++;
|
||||
mbedtls_test_driver_cipher_hooks.hits++;
|
||||
|
||||
if( test_driver_cipher_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
|
||||
{
|
||||
if( output_size < test_driver_cipher_hooks.forced_output_length )
|
||||
if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
|
||||
return PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
|
||||
memcpy( output,
|
||||
test_driver_cipher_hooks.forced_output,
|
||||
test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = test_driver_cipher_hooks.forced_output_length;
|
||||
mbedtls_test_driver_cipher_hooks.forced_output,
|
||||
mbedtls_test_driver_cipher_hooks.forced_output_length );
|
||||
*output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
|
||||
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
}
|
||||
|
||||
if( test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_cipher_hooks.forced_status );
|
||||
if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_cipher_hooks.forced_status );
|
||||
|
||||
return( mbedtls_transparent_test_driver_cipher_finish(
|
||||
operation, output, output_size, output_length ) );
|
||||
@@ -331,7 +332,7 @@ psa_status_t test_transparent_cipher_finish(
|
||||
/*
|
||||
* opaque versions, to do
|
||||
*/
|
||||
psa_status_t test_opaque_cipher_encrypt(
|
||||
psa_status_t mbedtls_test_opaque_cipher_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
@@ -350,7 +351,7 @@ psa_status_t test_opaque_cipher_encrypt(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_decrypt(
|
||||
psa_status_t mbedtls_test_opaque_cipher_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
@@ -369,7 +370,7 @@ psa_status_t test_opaque_cipher_decrypt(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_encrypt_setup(
|
||||
psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
@@ -383,7 +384,7 @@ psa_status_t test_opaque_cipher_encrypt_setup(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_decrypt_setup(
|
||||
psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
@@ -397,14 +398,14 @@ psa_status_t test_opaque_cipher_decrypt_setup(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_abort(
|
||||
psa_status_t mbedtls_test_opaque_cipher_abort(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation )
|
||||
{
|
||||
(void) operation;
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_set_iv(
|
||||
psa_status_t mbedtls_test_opaque_cipher_set_iv(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *iv,
|
||||
size_t iv_length)
|
||||
@@ -415,7 +416,7 @@ psa_status_t test_opaque_cipher_set_iv(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_update(
|
||||
psa_status_t mbedtls_test_opaque_cipher_update(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
@@ -432,7 +433,7 @@ psa_status_t test_opaque_cipher_update(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_cipher_finish(
|
||||
psa_status_t mbedtls_test_opaque_cipher_finish(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
|
@@ -38,18 +38,18 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
test_driver_key_management_hooks_t test_driver_key_management_hooks =
|
||||
TEST_DRIVER_KEY_MANAGEMENT_INIT;
|
||||
mbedtls_test_driver_key_management_hooks_t
|
||||
mbedtls_test_driver_key_management_hooks = MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
|
||||
|
||||
const uint8_t test_driver_aes_key[16] =
|
||||
const uint8_t mbedtls_test_driver_aes_key[16] =
|
||||
{ 0x36, 0x77, 0x39, 0x7A, 0x24, 0x43, 0x26, 0x46,
|
||||
0x29, 0x4A, 0x40, 0x4E, 0x63, 0x52, 0x66, 0x55 };
|
||||
const uint8_t test_driver_ecdsa_key[32] =
|
||||
const uint8_t mbedtls_test_driver_ecdsa_key[32] =
|
||||
{ 0xdc, 0x7d, 0x9d, 0x26, 0xd6, 0x7a, 0x4f, 0x63,
|
||||
0x2c, 0x34, 0xc2, 0xdc, 0x0b, 0x69, 0x86, 0x18,
|
||||
0x38, 0x82, 0xc2, 0x06, 0xdf, 0x04, 0xcd, 0xb7,
|
||||
0xd6, 0x9a, 0xab, 0xe2, 0x8b, 0xe4, 0xf8, 0x1a };
|
||||
const uint8_t test_driver_ecdsa_pubkey[65] =
|
||||
const uint8_t mbedtls_test_driver_ecdsa_pubkey[65] =
|
||||
{ 0x04,
|
||||
0x85, 0xf6, 0x4d, 0x89, 0xf0, 0x0b, 0xe6, 0x6c,
|
||||
0x88, 0xdd, 0x93, 0x7e, 0xfd, 0x6d, 0x7c, 0x44,
|
||||
@@ -60,22 +60,23 @@ const uint8_t test_driver_ecdsa_pubkey[65] =
|
||||
0xbc, 0x25, 0x16, 0xc3, 0xd2, 0x70, 0x2d, 0x79,
|
||||
0x2f, 0x13, 0x1a, 0x92, 0x20, 0x95, 0xfd, 0x6c };
|
||||
|
||||
psa_status_t test_transparent_generate_key(
|
||||
psa_status_t mbedtls_test_transparent_generate_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
uint8_t *key, size_t key_size, size_t *key_length )
|
||||
{
|
||||
++test_driver_key_management_hooks.hits;
|
||||
++mbedtls_test_driver_key_management_hooks.hits;
|
||||
|
||||
if( test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_key_management_hooks.forced_status );
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_key_management_hooks.forced_status );
|
||||
|
||||
if( test_driver_key_management_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_output != NULL )
|
||||
{
|
||||
if( test_driver_key_management_hooks.forced_output_length > key_size )
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_output_length >
|
||||
key_size )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
memcpy( key, test_driver_key_management_hooks.forced_output,
|
||||
test_driver_key_management_hooks.forced_output_length );
|
||||
*key_length = test_driver_key_management_hooks.forced_output_length;
|
||||
memcpy( key, mbedtls_test_driver_key_management_hooks.forced_output,
|
||||
mbedtls_test_driver_key_management_hooks.forced_output_length );
|
||||
*key_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ psa_status_t test_transparent_generate_key(
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_generate_key(
|
||||
psa_status_t mbedtls_test_opaque_generate_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
uint8_t *key, size_t key_size, size_t *key_length )
|
||||
{
|
||||
@@ -113,7 +114,7 @@ psa_status_t test_opaque_generate_key(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_import_key(
|
||||
psa_status_t mbedtls_test_transparent_import_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *data,
|
||||
size_t data_length,
|
||||
@@ -122,10 +123,10 @@ psa_status_t test_transparent_import_key(
|
||||
size_t *key_buffer_length,
|
||||
size_t *bits)
|
||||
{
|
||||
++test_driver_key_management_hooks.hits;
|
||||
++mbedtls_test_driver_key_management_hooks.hits;
|
||||
|
||||
if( test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_key_management_hooks.forced_status );
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_key_management_hooks.forced_status );
|
||||
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
psa_key_type_t type = psa_get_key_type( attributes );
|
||||
@@ -168,7 +169,7 @@ psa_status_t test_transparent_import_key(
|
||||
return( status );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_export_key(
|
||||
psa_status_t mbedtls_test_opaque_export_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
@@ -199,12 +200,12 @@ psa_status_t test_opaque_export_key(
|
||||
PSA_KEY_USAGE_EXPORT ) == 0 )
|
||||
return( PSA_ERROR_CORRUPTION_DETECTED );
|
||||
|
||||
if( data_size < sizeof( test_driver_ecdsa_key ) )
|
||||
if( data_size < sizeof( mbedtls_test_driver_ecdsa_key ) )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
|
||||
memcpy( data, test_driver_ecdsa_key,
|
||||
sizeof( test_driver_ecdsa_key ) );
|
||||
*data_length = sizeof( test_driver_ecdsa_key );
|
||||
memcpy( data, mbedtls_test_driver_ecdsa_key,
|
||||
sizeof( mbedtls_test_driver_ecdsa_key ) );
|
||||
*data_length = sizeof( mbedtls_test_driver_ecdsa_key );
|
||||
return( PSA_SUCCESS );
|
||||
|
||||
case PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT:
|
||||
@@ -220,12 +221,12 @@ psa_status_t test_opaque_export_key(
|
||||
PSA_KEY_USAGE_EXPORT ) == 0 )
|
||||
return( PSA_ERROR_CORRUPTION_DETECTED );
|
||||
|
||||
if( data_size < sizeof( test_driver_aes_key ) )
|
||||
if( data_size < sizeof( mbedtls_test_driver_aes_key ) )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
|
||||
memcpy( data, test_driver_aes_key,
|
||||
sizeof( test_driver_aes_key ) );
|
||||
*data_length = sizeof( test_driver_aes_key );
|
||||
memcpy( data, mbedtls_test_driver_aes_key,
|
||||
sizeof( mbedtls_test_driver_aes_key ) );
|
||||
*data_length = sizeof( mbedtls_test_driver_aes_key );
|
||||
return( PSA_SUCCESS );
|
||||
|
||||
default:
|
||||
@@ -233,23 +234,24 @@ psa_status_t test_opaque_export_key(
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_export_public_key(
|
||||
psa_status_t mbedtls_test_transparent_export_public_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
{
|
||||
++test_driver_key_management_hooks.hits;
|
||||
++mbedtls_test_driver_key_management_hooks.hits;
|
||||
|
||||
if( test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_key_management_hooks.forced_status );
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_key_management_hooks.forced_status );
|
||||
|
||||
if( test_driver_key_management_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_output != NULL )
|
||||
{
|
||||
if( test_driver_key_management_hooks.forced_output_length > data_size )
|
||||
if( mbedtls_test_driver_key_management_hooks.forced_output_length >
|
||||
data_size )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
memcpy( data, test_driver_key_management_hooks.forced_output,
|
||||
test_driver_key_management_hooks.forced_output_length );
|
||||
*data_length = test_driver_key_management_hooks.forced_output_length;
|
||||
memcpy( data, mbedtls_test_driver_key_management_hooks.forced_output,
|
||||
mbedtls_test_driver_key_management_hooks.forced_output_length );
|
||||
*data_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
@@ -288,7 +290,7 @@ psa_status_t test_transparent_export_public_key(
|
||||
return( status );
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_export_public_key(
|
||||
psa_status_t mbedtls_test_opaque_export_public_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
@@ -315,12 +317,12 @@ psa_status_t test_opaque_export_public_key(
|
||||
PSA_ALG_ECDSA( PSA_ALG_ANY_HASH ) )
|
||||
return( PSA_ERROR_CORRUPTION_DETECTED );
|
||||
|
||||
if( data_size < sizeof( test_driver_ecdsa_pubkey ) )
|
||||
if( data_size < sizeof( mbedtls_test_driver_ecdsa_pubkey ) )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
|
||||
memcpy( data, test_driver_ecdsa_pubkey,
|
||||
sizeof( test_driver_ecdsa_pubkey ) );
|
||||
*data_length = sizeof( test_driver_ecdsa_pubkey );
|
||||
memcpy( data, mbedtls_test_driver_ecdsa_pubkey,
|
||||
sizeof( mbedtls_test_driver_ecdsa_pubkey ) );
|
||||
*data_length = sizeof( mbedtls_test_driver_ecdsa_pubkey );
|
||||
return( PSA_SUCCESS );
|
||||
|
||||
default:
|
||||
@@ -338,7 +340,7 @@ psa_status_t test_opaque_export_public_key(
|
||||
* (i.e. for an actual driver this would mean 'builtin_key_size' =
|
||||
* sizeof(psa_drv_slot_number_t)).
|
||||
*/
|
||||
psa_status_t test_opaque_get_builtin_key(
|
||||
psa_status_t mbedtls_test_opaque_get_builtin_key(
|
||||
psa_drv_slot_number_t slot_number,
|
||||
psa_key_attributes_t *attributes,
|
||||
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length )
|
||||
|
@@ -41,28 +41,32 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
test_driver_signature_hooks_t test_driver_signature_sign_hooks = TEST_DRIVER_SIGNATURE_INIT;
|
||||
test_driver_signature_hooks_t test_driver_signature_verify_hooks = TEST_DRIVER_SIGNATURE_INIT;
|
||||
mbedtls_test_driver_signature_hooks_t
|
||||
mbedtls_test_driver_signature_sign_hooks = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
|
||||
mbedtls_test_driver_signature_hooks_t
|
||||
mbedtls_test_driver_signature_verify_hooks = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
|
||||
|
||||
psa_status_t test_transparent_signature_sign_hash(
|
||||
psa_status_t mbedtls_test_transparent_signature_sign_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
uint8_t *signature, size_t signature_size, size_t *signature_length )
|
||||
{
|
||||
++test_driver_signature_sign_hooks.hits;
|
||||
++mbedtls_test_driver_signature_sign_hooks.hits;
|
||||
|
||||
if( test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_signature_sign_hooks.forced_status );
|
||||
if( mbedtls_test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_signature_sign_hooks.forced_status );
|
||||
|
||||
if( test_driver_signature_sign_hooks.forced_output != NULL )
|
||||
if( mbedtls_test_driver_signature_sign_hooks.forced_output != NULL )
|
||||
{
|
||||
if( test_driver_signature_sign_hooks.forced_output_length > signature_size )
|
||||
if( mbedtls_test_driver_signature_sign_hooks.forced_output_length >
|
||||
signature_size )
|
||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||
memcpy( signature, test_driver_signature_sign_hooks.forced_output,
|
||||
test_driver_signature_sign_hooks.forced_output_length );
|
||||
*signature_length = test_driver_signature_sign_hooks.forced_output_length;
|
||||
memcpy( signature,
|
||||
mbedtls_test_driver_signature_sign_hooks.forced_output,
|
||||
mbedtls_test_driver_signature_sign_hooks.forced_output_length );
|
||||
*signature_length = mbedtls_test_driver_signature_sign_hooks.forced_output_length;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
@@ -120,7 +124,7 @@ psa_status_t test_transparent_signature_sign_hash(
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_signature_sign_hash(
|
||||
psa_status_t mbedtls_test_opaque_signature_sign_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
@@ -140,17 +144,17 @@ psa_status_t test_opaque_signature_sign_hash(
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_signature_verify_hash(
|
||||
psa_status_t mbedtls_test_transparent_signature_verify_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
const uint8_t *signature, size_t signature_length )
|
||||
{
|
||||
++test_driver_signature_verify_hooks.hits;
|
||||
++mbedtls_test_driver_signature_verify_hooks.hits;
|
||||
|
||||
if( test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS )
|
||||
return( test_driver_signature_verify_hooks.forced_status );
|
||||
if( mbedtls_test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS )
|
||||
return( mbedtls_test_driver_signature_verify_hooks.forced_status );
|
||||
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
|
||||
defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
|
||||
@@ -200,7 +204,7 @@ psa_status_t test_transparent_signature_verify_hash(
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_opaque_signature_verify_hash(
|
||||
psa_status_t mbedtls_test_opaque_signature_verify_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
|
@@ -28,8 +28,8 @@
|
||||
|
||||
#include "test/drivers/size.h"
|
||||
|
||||
#ifdef TEST_KEY_CONTEXT_SIZE_FUNCTION
|
||||
size_t test_size_function(
|
||||
#ifdef MBEDTLS_TEST_KEY_CONTEXT_SIZE_FUNCTION
|
||||
size_t mbedtls_test_size_function(
|
||||
const psa_key_type_t key_type,
|
||||
const size_t key_bits )
|
||||
{
|
||||
@@ -37,6 +37,6 @@ size_t test_size_function(
|
||||
(void) key_bits;
|
||||
return 0;
|
||||
}
|
||||
#endif /*TEST_KEY_CONTEXT_SIZE_FUNCTION */
|
||||
#endif /*MBEDTLS_TEST_KEY_CONTEXT_SIZE_FUNCTION */
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
|
||||
|
Reference in New Issue
Block a user