Move jpake role check to psa_pake_complete_inputs()
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 9c12863..0fd0eff 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -7483,6 +7483,12 @@
return PSA_ERROR_BAD_STATE;
}
+ if (operation->alg == PSA_ALG_JPAKE &&
+ inputs.role != PSA_PAKE_ROLE_CLIENT &&
+ inputs.role != PSA_PAKE_ROLE_SERVER) {
+ return PSA_ERROR_NOT_SUPPORTED;
+ }
+
/* Clear driver context */
mbedtls_platform_zeroize(&operation->data, sizeof(operation->data));
diff --git a/library/psa_crypto_pake.c b/library/psa_crypto_pake.c
index 2d84f57..382f021 100644
--- a/library/psa_crypto_pake.c
+++ b/library/psa_crypto_pake.c
@@ -221,13 +221,6 @@
return PSA_ERROR_NOT_SUPPORTED;
}
- if (role != PSA_PAKE_ROLE_CLIENT &&
- role != PSA_PAKE_ROLE_SERVER) {
- return PSA_ERROR_NOT_SUPPORTED;
- }
-
-
-
operation->password = mbedtls_calloc(1, password_len);
if (operation->password == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;