make JPAKE work again, fix memory leaks
diff --git a/apps/s_server.c b/apps/s_server.c
index f0ec4db..7cb9a08 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -938,6 +938,9 @@
#ifndef OPENSSL_NO_JPAKE
static char *jpake_secret = NULL;
+#define no_jpake !jpake_secret
+#else
+#define no_jpake 1
#endif
#ifndef OPENSSL_NO_SRP
static srpsrvparm srp_callback_parm;
@@ -1465,14 +1468,7 @@
goto end;
}
psk_identity = "JPAKE";
- if (cipher)
- {
- BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
- goto end;
- }
- cipher = "PSK";
}
-
#endif
SSL_load_error_strings();
@@ -1719,8 +1715,7 @@
SSL_CTX_set1_param(ctx, vpm);
ssl_ctx_add_crls(ctx, crls, 0);
-
- if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, no_ecdhe))
+ if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, no_ecdhe, no_jpake))
goto end;
if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
@@ -1788,8 +1783,7 @@
SSL_CTX_set1_param(ctx2, vpm);
ssl_ctx_add_crls(ctx2, crls, 0);
-
- if (!args_ssl_call(ctx2, bio_err, cctx, ssl_args, no_ecdhe))
+ if (!args_ssl_call(ctx2, bio_err, cctx, ssl_args, no_ecdhe, no_jpake))
goto end;
}
@@ -2033,6 +2027,10 @@
sk_OPENSSL_STRING_free(ssl_args);
if (cctx)
SSL_CONF_CTX_free(cctx);
+#ifndef OPENSSL_NO_JPAKE
+ if (jpake_secret && psk_key)
+ OPENSSL_free(psk_key);
+#endif
if (bio_s_out != NULL)
{
BIO_free(bio_s_out);