From b90348c7c57f2a6ba129fd2cb9a5889401fe3f91 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 9 Sep 2016 09:32:00 +0200 Subject: [PATCH] Fixup BIO demos for OpenSSL 1.1.x Call SSL_CTX_new() before doing any configuration. (or call OPENSSL_ssl_init()) Reviewed-by: Rich Salz (cherry picked from commit 54d72ef0f019db383f8e98342b9b77c5da8541e5) --- demos/bio/server-cmod.c | 4 ++-- demos/bio/server-conf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/bio/server-cmod.c b/demos/bio/server-cmod.c index dfe233538e..9cb246375c 100644 --- a/demos/bio/server-cmod.c +++ b/demos/bio/server-cmod.c @@ -27,13 +27,13 @@ int main(int argc, char *argv[]) SSL_CTX *ctx; int ret = 1, i; + ctx = SSL_CTX_new(TLS_server_method()); + if (CONF_modules_load_file("cmod.cnf", "testapp", 0) <= 0) { fprintf(stderr, "Error processing config file\n"); goto err; } - ctx = SSL_CTX_new(TLS_server_method()); - if (SSL_CTX_config(ctx, "server") == 0) { fprintf(stderr, "Error configuring server.\n"); goto err; diff --git a/demos/bio/server-conf.c b/demos/bio/server-conf.c index 84d39f5f70..41b13089c6 100644 --- a/demos/bio/server-conf.c +++ b/demos/bio/server-conf.c @@ -34,6 +34,7 @@ int main(int argc, char *argv[]) char buf[512]; int ret = 1, i; + ctx = SSL_CTX_new(TLS_server_method()); conf = NCONF_new(NULL); @@ -52,7 +53,6 @@ int main(int argc, char *argv[]) goto err; } - ctx = SSL_CTX_new(TLS_server_method()); cctx = SSL_CONF_CTX_new(); SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_SERVER); SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CERTIFICATE); -- 2.25.1