mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-28 07:51:36 -04: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
|
* \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
|
* \note The signature of this function is that of a PSA driver
|
||||||
* key_agreement_get_num_ops entry point. This function behaves as an
|
* 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.
|
* \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);
|
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
|
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
|
||||||
* There was insufficient memory to load the key representation.
|
* 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,
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||||
|
const psa_key_attributes_t *private_key_attributes,
|
||||||
const uint8_t *private_key_buffer,
|
const uint8_t *private_key_buffer,
|
||||||
size_t private_key_buffer_len,
|
size_t private_key_buffer_len,
|
||||||
const uint8_t *peer_key,
|
const uint8_t *peer_key,
|
||||||
size_t peer_key_length,
|
size_t peer_key_length);
|
||||||
const psa_key_attributes_t *attributes);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Continue and eventually complete a key agreement operation.
|
* \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
|
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||||
* \p shared_secret_size is 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,
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||||
uint8_t *shared_secret,
|
uint8_t *shared_secret,
|
||||||
size_t shared_secret_size,
|
size_t shared_secret_size,
|
||||||
@ -800,7 +800,7 @@ psa_status_t mbedtls_psa_key_agreement_complete(
|
|||||||
* \retval #PSA_SUCCESS
|
* \retval #PSA_SUCCESS
|
||||||
* The operation was aborted successfully.
|
* 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);
|
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)
|
#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)
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation)
|
||||||
{
|
{
|
||||||
return operation->num_ops;
|
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,
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||||
|
const psa_key_attributes_t *private_key_attributes,
|
||||||
const uint8_t *private_key_buffer,
|
const uint8_t *private_key_buffer,
|
||||||
size_t private_key_buffer_len,
|
size_t private_key_buffer_len,
|
||||||
const uint8_t *peer_key,
|
const uint8_t *peer_key,
|
||||||
size_t peer_key_length,
|
size_t peer_key_length)
|
||||||
const psa_key_attributes_t *attributes)
|
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
mbedtls_ecp_keypair *our_key = NULL;
|
mbedtls_ecp_keypair *our_key = NULL;
|
||||||
@ -658,8 +658,8 @@ psa_status_t mbedtls_psa_key_agreement_setup(
|
|||||||
operation->num_ops = 0;
|
operation->num_ops = 0;
|
||||||
|
|
||||||
status = mbedtls_psa_ecp_load_representation(
|
status = mbedtls_psa_ecp_load_representation(
|
||||||
psa_get_key_type(attributes),
|
psa_get_key_type(private_key_attributes),
|
||||||
psa_get_key_bits(attributes),
|
psa_get_key_bits(private_key_attributes),
|
||||||
private_key_buffer,
|
private_key_buffer,
|
||||||
private_key_buffer_len,
|
private_key_buffer_len,
|
||||||
&our_key);
|
&our_key);
|
||||||
@ -678,8 +678,8 @@ psa_status_t mbedtls_psa_key_agreement_setup(
|
|||||||
our_key = NULL;
|
our_key = NULL;
|
||||||
|
|
||||||
status = mbedtls_psa_ecp_load_representation(
|
status = mbedtls_psa_ecp_load_representation(
|
||||||
PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(psa_get_key_type(attributes)),
|
PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(psa_get_key_type(private_key_attributes)),
|
||||||
psa_get_key_bits(attributes),
|
psa_get_key_bits(private_key_attributes),
|
||||||
peer_key,
|
peer_key,
|
||||||
peer_key_length,
|
peer_key_length,
|
||||||
&their_key);
|
&their_key);
|
||||||
@ -705,7 +705,7 @@ exit:
|
|||||||
return status;
|
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,
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation,
|
||||||
uint8_t *shared_secret,
|
uint8_t *shared_secret,
|
||||||
size_t shared_secret_size,
|
size_t shared_secret_size,
|
||||||
@ -726,7 +726,7 @@ psa_status_t mbedtls_psa_key_agreement_complete(
|
|||||||
return status;
|
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)
|
mbedtls_psa_key_agreement_interruptible_operation_t *operation)
|
||||||
{
|
{
|
||||||
operation->num_ops = 0;
|
operation->num_ops = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user