Move ECJPAKE_TEST_SET_PASSWORD into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
diff --git a/tests/include/test/ssl_helpers.h b/tests/include/test/ssl_helpers.h
index fecfad9..eb89d19 100644
--- a/tests/include/test/ssl_helpers.h
+++ b/tests/include/test/ssl_helpers.h
@@ -523,6 +523,22 @@
unsigned char *buf, unsigned char **end, int tweak,
int *expected_result, mbedtls_ssl_chk_buf_ptr_args *args);
#endif /* MBEDTLS_TEST_HOOKS */
+
+#define ECJPAKE_TEST_PWD "bla"
+
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+#define ECJPAKE_TEST_SET_PASSWORD(exp_ret_val) \
+ ret = (use_opaque_arg) ? \
+ mbedtls_ssl_set_hs_ecjpake_password_opaque(&ssl, pwd_slot) : \
+ mbedtls_ssl_set_hs_ecjpake_password(&ssl, pwd_string, pwd_len); \
+ TEST_EQUAL(ret, exp_ret_val)
+#else
+#define ECJPAKE_TEST_SET_PASSWORD(exp_ret_val) \
+ ret = mbedtls_ssl_set_hs_ecjpake_password(&ssl, \
+ pwd_string, pwd_len); \
+ TEST_EQUAL(ret, exp_ret_val)
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
#endif /* MBEDTLS_SSL_TLS_C */
#endif /* SSL_HELPERS_H */