From f309d6b7fb0edff13d88df10b1d9e3bffe34472f Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Fri, 10 Mar 2023 09:54:45 +0100 Subject: [PATCH] Fix peer user mismatch after rebase Signed-off-by: Przemek Stekiel --- library/psa_crypto.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index dea2a365a..767dbfcd1 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -7400,7 +7400,7 @@ psa_status_t psa_pake_set_user( goto exit; } - if (operation->data.inputs.peer_len != 0) { + if (operation->data.inputs.user_len != 0) { status = PSA_ERROR_BAD_STATE; goto exit; } @@ -7412,14 +7412,14 @@ psa_status_t psa_pake_set_user( goto exit; } - operation->data.inputs.peer = mbedtls_calloc(1, peer_id_len); - if (operation->data.inputs.peer == NULL) { + operation->data.inputs.user = mbedtls_calloc(1, user_id_len); + if (operation->data.inputs.user == NULL) { status = PSA_ERROR_INSUFFICIENT_MEMORY; goto exit; } - memcpy(operation->data.inputs.peer, peer_id, peer_id_len); - operation->data.inputs.peer_len = peer_id_len; + memcpy(operation->data.inputs.user, user_id, user_id_len); + operation->data.inputs.user_len = user_id_len; return PSA_SUCCESS; exit: @@ -7444,7 +7444,7 @@ psa_status_t psa_pake_set_peer( goto exit; } - if (operation->data.inputs.user_len != 0) { + if (operation->data.inputs.peer_len != 0) { status = PSA_ERROR_BAD_STATE; goto exit; } @@ -7456,14 +7456,14 @@ psa_status_t psa_pake_set_peer( goto exit; } - operation->data.inputs.user = mbedtls_calloc(1, user_id_len); - if (operation->data.inputs.user == NULL) { + operation->data.inputs.peer = mbedtls_calloc(1, peer_id_len); + if (operation->data.inputs.peer == NULL) { status = PSA_ERROR_INSUFFICIENT_MEMORY; goto exit; } - memcpy(operation->data.inputs.user, user_id, user_id_len); - operation->data.inputs.user_len = user_id_len; + memcpy(operation->data.inputs.peer, peer_id, peer_id_len); + operation->data.inputs.peer_len = peer_id_len; return PSA_SUCCESS; exit: