mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-31 10:20:45 +00:00
Add copying in PAKE set peer and user functions
Add copying to: * psa_pake_set_user() * psa_pake_set_peer() Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
9c5c9c351d
commit
4f534ae9c2
@ -8079,10 +8079,11 @@ exit:
|
|||||||
|
|
||||||
psa_status_t psa_pake_set_user(
|
psa_status_t psa_pake_set_user(
|
||||||
psa_pake_operation_t *operation,
|
psa_pake_operation_t *operation,
|
||||||
const uint8_t *user_id,
|
const uint8_t *user_id_external,
|
||||||
size_t user_id_len)
|
size_t user_id_len)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
LOCAL_INPUT_DECLARE(user_id_external, user_id);
|
||||||
|
|
||||||
if (operation->stage != PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS) {
|
if (operation->stage != PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS) {
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
@ -8105,21 +8106,28 @@ psa_status_t psa_pake_set_user(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCAL_INPUT_ALLOC(user_id_external, user_id_len, user_id);
|
||||||
|
|
||||||
memcpy(operation->data.inputs.user, user_id, user_id_len);
|
memcpy(operation->data.inputs.user, user_id, user_id_len);
|
||||||
operation->data.inputs.user_len = user_id_len;
|
operation->data.inputs.user_len = user_id_len;
|
||||||
|
|
||||||
return PSA_SUCCESS;
|
status = PSA_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
psa_pake_abort(operation);
|
LOCAL_INPUT_FREE(user_id_external, user_id);
|
||||||
|
if (status != PSA_SUCCESS) {
|
||||||
|
psa_pake_abort(operation);
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_pake_set_peer(
|
psa_status_t psa_pake_set_peer(
|
||||||
psa_pake_operation_t *operation,
|
psa_pake_operation_t *operation,
|
||||||
const uint8_t *peer_id,
|
const uint8_t *peer_id_external,
|
||||||
size_t peer_id_len)
|
size_t peer_id_len)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
LOCAL_INPUT_DECLARE(peer_id_external, peer_id);
|
||||||
|
|
||||||
if (operation->stage != PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS) {
|
if (operation->stage != PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS) {
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
@ -8142,12 +8150,18 @@ psa_status_t psa_pake_set_peer(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCAL_INPUT_ALLOC(peer_id_external, peer_id_len, peer_id);
|
||||||
|
|
||||||
memcpy(operation->data.inputs.peer, peer_id, peer_id_len);
|
memcpy(operation->data.inputs.peer, peer_id, peer_id_len);
|
||||||
operation->data.inputs.peer_len = peer_id_len;
|
operation->data.inputs.peer_len = peer_id_len;
|
||||||
|
|
||||||
return PSA_SUCCESS;
|
status = PSA_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
psa_pake_abort(operation);
|
LOCAL_INPUT_FREE(peer_id_external, peer_id);
|
||||||
|
if (status != PSA_SUCCESS) {
|
||||||
|
psa_pake_abort(operation);
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user