Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header and documentation for interruptible ECC export public-key #9778

Open
wants to merge 8 commits into
base: development
Choose a base branch
from
19 changes: 19 additions & 0 deletions tests/include/test/psa_test_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,25 @@ psa_status_t mbedtls_test_wrap_psa_export_public_key(
#define psa_export_public_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length) \
mbedtls_test_wrap_psa_export_public_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length)

psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_abort(
psa_export_public_key_iop_t *arg0_operation);
#define psa_export_public_key_iop_abort(arg0_operation) \
mbedtls_test_wrap_psa_export_public_key_iop_abort(arg0_operation)

psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_complete(
psa_export_public_key_iop_t *arg0_operation,
uint8_t *arg1_data,
size_t arg2_data_size,
size_t *arg3_data_length);
#define psa_export_public_key_iop_complete(arg0_operation, arg1_data, arg2_data_size, arg3_data_length) \
mbedtls_test_wrap_psa_export_public_key_iop_complete(arg0_operation, arg1_data, arg2_data_size, arg3_data_length)

psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_setup(
psa_export_public_key_iop_t *arg0_operation,
psa_key_id_t arg1_key);
#define psa_export_public_key_iop_setup(arg0_operation, arg1_key) \
mbedtls_test_wrap_psa_export_public_key_iop_setup(arg0_operation, arg1_key)

psa_status_t mbedtls_test_wrap_psa_generate_key(
const psa_key_attributes_t *arg0_attributes,
mbedtls_svc_key_id_t *arg1_key);
Expand Down
34 changes: 34 additions & 0 deletions tests/src/psa_test_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,40 @@ psa_status_t mbedtls_test_wrap_psa_export_public_key(
return status;
}

/* Wrapper for psa_export_public_key_iop_abort */
psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_abort(
psa_export_public_key_iop_t *arg0_operation)
{
psa_status_t status = (psa_export_public_key_iop_abort)(arg0_operation);
return status;
}

/* Wrapper for psa_export_public_key_iop_complete */
psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_complete(
psa_export_public_key_iop_t *arg0_operation,
uint8_t *arg1_data,
size_t arg2_data_size,
size_t *arg3_data_length)
{
#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
MBEDTLS_TEST_MEMORY_POISON(arg1_data, arg2_data_size);
#endif /* !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) */
psa_status_t status = (psa_export_public_key_iop_complete)(arg0_operation, arg1_data, arg2_data_size, arg3_data_length);
#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
MBEDTLS_TEST_MEMORY_UNPOISON(arg1_data, arg2_data_size);
#endif /* !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) */
return status;
}

/* Wrapper for psa_export_public_key_iop_setup */
psa_status_t mbedtls_test_wrap_psa_export_public_key_iop_setup(
psa_export_public_key_iop_t *arg0_operation,
psa_key_id_t arg1_key)
{
psa_status_t status = (psa_export_public_key_iop_setup)(arg0_operation, arg1_key);
return status;
}

/* Wrapper for psa_generate_key */
psa_status_t mbedtls_test_wrap_psa_generate_key(
const psa_key_attributes_t *arg0_attributes,
Expand Down
39 changes: 39 additions & 0 deletions tf-psa-crypto/core/psa_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,45 @@ psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key,
return (status == PSA_SUCCESS) ? unlock_status : status;
}

/****************************************************************/
/* Interruptible ECC Export Public-key */
/****************************************************************/

uint32_t psa_export_public_key_iop_get_num_ops(psa_export_public_key_iop_t *operation)
{
(void) operation;
return 0;
}

psa_status_t psa_export_public_key_iop_setup(psa_export_public_key_iop_t *operation,
psa_key_id_t key)
{
(void) operation;
(void) key;

return PSA_ERROR_NOT_SUPPORTED;
}

psa_status_t psa_export_public_key_iop_complete(psa_export_public_key_iop_t *operation,
uint8_t *data,
size_t data_size,
size_t *data_length)
{
(void) operation;
(void) data;
(void) data_size;
(void) data_length;

return PSA_ERROR_NOT_SUPPORTED;
}

psa_status_t psa_export_public_key_iop_abort(psa_export_public_key_iop_t *operation)
{
(void) operation;

return PSA_ERROR_NOT_SUPPORTED;
}

/** Validate that a key policy is internally well-formed.
*
* This function only rejects invalid policies. It does not validate the
Expand Down
Loading