mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-22 18:39:58 +00:00
Refactor and improve interuptible key agreement builtin implementation
- rename psa_driver_wrapper_key_agreement_xxx to psa_driver_wrapper_key_agreement_iop_xxx. - reorganise the paraemters of psa_driver_wrapper_key_agreement_setup Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
parent
86e518b7bd
commit
18df1c560a
@ -702,7 +702,7 @@ psa_status_t psa_key_agreement_raw_builtin(
|
||||
|
||||
/**
|
||||
* \brief Get the total number of ops that a key agreement operation has taken
|
||||
* Since its start.
|
||||
* since its start.
|
||||
*
|
||||
* \note The signature of this function is that of a PSA driver
|
||||
* key_agreement_get_num_ops entry point. This function behaves as an
|
||||
@ -714,7 +714,7 @@ psa_status_t psa_key_agreement_raw_builtin(
|
||||
*
|
||||
* \return Total number of operations.
|
||||
*/
|
||||
uint32_t mbedtls_psa_key_agreement_get_num_ops(
|
||||
uint32_t mbedtls_psa_key_agreement_iop_get_num_ops(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation);
|
||||
|
||||
/**
|
||||
@ -748,13 +748,13 @@ uint32_t mbedtls_psa_key_agreement_get_num_ops(
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
|
||||
* There was insufficient memory to load the key representation.
|
||||
*/
|
||||
psa_status_t mbedtls_psa_key_agreement_setup(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_setup(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||
const psa_key_attributes_t *private_key_attributes,
|
||||
const uint8_t *private_key_buffer,
|
||||
size_t private_key_buffer_len,
|
||||
const uint8_t *peer_key,
|
||||
size_t peer_key_length,
|
||||
const psa_key_attributes_t *attributes);
|
||||
size_t peer_key_length);
|
||||
|
||||
/**
|
||||
* \brief Continue and eventually complete a key agreement operation.
|
||||
@ -780,7 +780,7 @@ psa_status_t mbedtls_psa_key_agreement_setup(
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* \p shared_secret_size is too small
|
||||
*/
|
||||
psa_status_t mbedtls_psa_key_agreement_complete(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_complete(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||
uint8_t *shared_secret,
|
||||
size_t shared_secret_size,
|
||||
@ -800,7 +800,7 @@ psa_status_t mbedtls_psa_key_agreement_complete(
|
||||
* \retval #PSA_SUCCESS
|
||||
* The operation was aborted successfully.
|
||||
*/
|
||||
psa_status_t mbedtls_psa_key_agreement_abort(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_abort(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation);
|
||||
|
||||
|
||||
|
@ -632,19 +632,19 @@ psa_status_t mbedtls_psa_generate_key_iop_abort(
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
|
||||
uint32_t mbedtls_psa_key_agreement_get_num_ops(
|
||||
uint32_t mbedtls_psa_key_agreement_iop_get_num_ops(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation)
|
||||
{
|
||||
return operation->num_ops;
|
||||
}
|
||||
|
||||
psa_status_t mbedtls_psa_key_agreement_setup(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_setup(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||
const psa_key_attributes_t *private_key_attributes,
|
||||
const uint8_t *private_key_buffer,
|
||||
size_t private_key_buffer_len,
|
||||
const uint8_t *peer_key,
|
||||
size_t peer_key_length,
|
||||
const psa_key_attributes_t *attributes)
|
||||
size_t peer_key_length)
|
||||
{
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
mbedtls_ecp_keypair *our_key = NULL;
|
||||
@ -658,8 +658,8 @@ psa_status_t mbedtls_psa_key_agreement_setup(
|
||||
operation->num_ops = 0;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(
|
||||
psa_get_key_type(attributes),
|
||||
psa_get_key_bits(attributes),
|
||||
psa_get_key_type(private_key_attributes),
|
||||
psa_get_key_bits(private_key_attributes),
|
||||
private_key_buffer,
|
||||
private_key_buffer_len,
|
||||
&our_key);
|
||||
@ -678,8 +678,8 @@ psa_status_t mbedtls_psa_key_agreement_setup(
|
||||
our_key = NULL;
|
||||
|
||||
status = mbedtls_psa_ecp_load_representation(
|
||||
PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(psa_get_key_type(attributes)),
|
||||
psa_get_key_bits(attributes),
|
||||
PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(psa_get_key_type(private_key_attributes)),
|
||||
psa_get_key_bits(private_key_attributes),
|
||||
peer_key,
|
||||
peer_key_length,
|
||||
&their_key);
|
||||
@ -705,7 +705,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
psa_status_t mbedtls_psa_key_agreement_complete(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_complete(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||
uint8_t *shared_secret,
|
||||
size_t shared_secret_size,
|
||||
@ -726,7 +726,7 @@ psa_status_t mbedtls_psa_key_agreement_complete(
|
||||
return status;
|
||||
}
|
||||
|
||||
psa_status_t mbedtls_psa_key_agreement_abort(
|
||||
psa_status_t mbedtls_psa_key_agreement_iop_abort(
|
||||
mbedtls_psa_key_agreement_interruptible_operation_t *operation)
|
||||
{
|
||||
operation->num_ops = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user