aboutsummaryrefslogtreecommitdiff
path: root/openssl-1.1.0h/demos/bio
diff options
context:
space:
mode:
Diffstat (limited to 'openssl-1.1.0h/demos/bio')
-rw-r--r--openssl-1.1.0h/demos/bio/Makefile30
-rw-r--r--openssl-1.1.0h/demos/bio/README7
-rw-r--r--openssl-1.1.0h/demos/bio/accept.cnf17
-rw-r--r--openssl-1.1.0h/demos/bio/client-arg.c117
-rw-r--r--openssl-1.1.0h/demos/bio/client-conf.c126
-rw-r--r--openssl-1.1.0h/demos/bio/cmod.cnf24
-rw-r--r--openssl-1.1.0h/demos/bio/connect.cnf9
-rw-r--r--openssl-1.1.0h/demos/bio/descrip.mms47
-rw-r--r--openssl-1.1.0h/demos/bio/intca.pem23
-rw-r--r--openssl-1.1.0h/demos/bio/root.pem22
-rw-r--r--openssl-1.1.0h/demos/bio/saccept.c122
-rw-r--r--openssl-1.1.0h/demos/bio/sconnect.c131
-rw-r--r--openssl-1.1.0h/demos/bio/server-arg.c145
-rw-r--r--openssl-1.1.0h/demos/bio/server-cmod.c95
-rw-r--r--openssl-1.1.0h/demos/bio/server-conf.c140
-rw-r--r--openssl-1.1.0h/demos/bio/server-ec.pem17
-rw-r--r--openssl-1.1.0h/demos/bio/server.pem77
-rw-r--r--openssl-1.1.0h/demos/bio/shared.opt2
-rw-r--r--openssl-1.1.0h/demos/bio/static.opt2
19 files changed, 1153 insertions, 0 deletions
diff --git a/openssl-1.1.0h/demos/bio/Makefile b/openssl-1.1.0h/demos/bio/Makefile
new file mode 100644
index 0000000..493e8a5
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/Makefile
@@ -0,0 +1,30 @@
+# Quick instruction:
+# To build against an OpenSSL built in the source tree, do this:
+#
+# make OPENSSL_INCS_LOCATION=-I../../include OPENSSL_LIBS_LOCATION=-L../..
+#
+# To run the demos when linked with a shared library (default):
+#
+# LD_LIBRARY_PATH=../.. ./server-arg
+# LD_LIBRARY_PATH=../.. ./server-cmod
+# LD_LIBRARY_PATH=../.. ./server-conf
+# LD_LIBRARY_PATH=../.. ./client-arg
+# LD_LIBRARY_PATH=../.. ./client-conf
+# LD_LIBRARY_PATH=../.. ./saccept
+# LD_LIBRARY_PATH=../.. ./sconnect
+
+CFLAGS = $(OPENSSL_INCS_LOCATION)
+LDFLAGS = $(OPENSSL_LIBS_LOCATION) -lssl -lcrypto $(EX_LIBS)
+
+all: client-arg client-conf saccept sconnect server-arg server-cmod server-conf
+
+client-arg: client-arg.o
+client-conf: client-conf.o
+saccept: saccept.o
+sconnect: sconnect.o
+server-arg: server-arg.o
+server-cmod: server-cmod.o
+server-conf: server-conf.o
+
+client-arg client-conf saccept sconnect server-arg server-cmod server-conf:
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
diff --git a/openssl-1.1.0h/demos/bio/README b/openssl-1.1.0h/demos/bio/README
new file mode 100644
index 0000000..a36bb48
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/README
@@ -0,0 +1,7 @@
+This directory contains some simple examples of the use of BIO's
+to simplify socket programming.
+
+The client-conf, server-conf, client-arg and client-conf include examples
+of how to use the SSL_CONF API for configuration file or command line
+processing.
+
diff --git a/openssl-1.1.0h/demos/bio/accept.cnf b/openssl-1.1.0h/demos/bio/accept.cnf
new file mode 100644
index 0000000..eb69658
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/accept.cnf
@@ -0,0 +1,17 @@
+# Example configuration file
+# Port to listen on
+Port = 4433
+# Disable TLS v1.2 for test.
+# Protocol = ALL, -TLSv1.2
+# Only support 3 curves
+Curves = P-521:P-384:P-256
+# Restricted signature algorithms
+SignatureAlgorithms = RSA+SHA512:ECDSA+SHA512
+Certificate=server.pem
+PrivateKey=server.pem
+ChainCAFile=root.pem
+VerifyCAFile=root.pem
+
+# Request certificate
+VerifyMode=Request
+ClientCAFile=root.pem
diff --git a/openssl-1.1.0h/demos/bio/client-arg.c b/openssl-1.1.0h/demos/bio/client-arg.c
new file mode 100644
index 0000000..e8d5e46
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/client-arg.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <string.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+int main(int argc, char **argv)
+{
+ BIO *sbio = NULL, *out = NULL;
+ int len;
+ char tmpbuf[1024];
+ SSL_CTX *ctx;
+ SSL_CONF_CTX *cctx;
+ SSL *ssl;
+ char **args = argv + 1;
+ const char *connect_str = "localhost:4433";
+ int nargs = argc - 1;
+
+ ctx = SSL_CTX_new(TLS_client_method());
+ cctx = SSL_CONF_CTX_new();
+ SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT);
+ SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
+ while (*args && **args == '-') {
+ int rv;
+ /* Parse standard arguments */
+ rv = SSL_CONF_cmd_argv(cctx, &nargs, &args);
+ if (rv == -3) {
+ fprintf(stderr, "Missing argument for %s\n", *args);
+ goto end;
+ }
+ if (rv < 0) {
+ fprintf(stderr, "Error in command %s\n", *args);
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+ /* If rv > 0 we processed something so proceed to next arg */
+ if (rv > 0)
+ continue;
+ /* Otherwise application specific argument processing */
+ if (strcmp(*args, "-connect") == 0) {
+ connect_str = args[1];
+ if (connect_str == NULL) {
+ fprintf(stderr, "Missing -connect argument\n");
+ goto end;
+ }
+ args += 2;
+ nargs -= 2;
+ continue;
+ } else {
+ fprintf(stderr, "Unknown argument %s\n", *args);
+ goto end;
+ }
+ }
+
+ if (!SSL_CONF_CTX_finish(cctx)) {
+ fprintf(stderr, "Finish error\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ /*
+ * We'd normally set some stuff like the verify paths and * mode here
+ * because as things stand this will connect to * any server whose
+ * certificate is signed by any CA.
+ */
+
+ sbio = BIO_new_ssl_connect(ctx);
+
+ BIO_get_ssl(sbio, &ssl);
+
+ if (!ssl) {
+ fprintf(stderr, "Can't locate SSL pointer\n");
+ goto end;
+ }
+
+ /* Don't want any retries */
+ SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
+
+ /* We might want to do other things with ssl here */
+
+ BIO_set_conn_hostname(sbio, connect_str);
+
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ if (BIO_do_connect(sbio) <= 0) {
+ fprintf(stderr, "Error connecting to server\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ if (BIO_do_handshake(sbio) <= 0) {
+ fprintf(stderr, "Error establishing SSL connection\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ /* Could examine ssl here to get connection info */
+
+ BIO_puts(sbio, "GET / HTTP/1.0\n\n");
+ for (;;) {
+ len = BIO_read(sbio, tmpbuf, 1024);
+ if (len <= 0)
+ break;
+ BIO_write(out, tmpbuf, len);
+ }
+ end:
+ SSL_CONF_CTX_free(cctx);
+ BIO_free_all(sbio);
+ BIO_free(out);
+ return 0;
+}
diff --git a/openssl-1.1.0h/demos/bio/client-conf.c b/openssl-1.1.0h/demos/bio/client-conf.c
new file mode 100644
index 0000000..e819030
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/client-conf.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <string.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+#include <openssl/conf.h>
+
+int main(int argc, char **argv)
+{
+ BIO *sbio = NULL, *out = NULL;
+ int i, len, rv;
+ char tmpbuf[1024];
+ SSL_CTX *ctx = NULL;
+ SSL_CONF_CTX *cctx = NULL;
+ SSL *ssl = NULL;
+ CONF *conf = NULL;
+ STACK_OF(CONF_VALUE) *sect = NULL;
+ CONF_VALUE *cnf;
+ const char *connect_str = "localhost:4433";
+ long errline = -1;
+
+ conf = NCONF_new(NULL);
+
+ if (NCONF_load(conf, "connect.cnf", &errline) <= 0) {
+ if (errline <= 0)
+ fprintf(stderr, "Error processing config file\n");
+ else
+ fprintf(stderr, "Error on line %ld\n", errline);
+ goto end;
+ }
+
+ sect = NCONF_get_section(conf, "default");
+
+ if (sect == NULL) {
+ fprintf(stderr, "Error retrieving default section\n");
+ goto end;
+ }
+
+ ctx = SSL_CTX_new(TLS_client_method());
+ cctx = SSL_CONF_CTX_new();
+ SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT);
+ SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_FILE);
+ SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
+ for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
+ cnf = sk_CONF_VALUE_value(sect, i);
+ rv = SSL_CONF_cmd(cctx, cnf->name, cnf->value);
+ if (rv > 0)
+ continue;
+ if (rv != -2) {
+ fprintf(stderr, "Error processing %s = %s\n",
+ cnf->name, cnf->value);
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+ if (strcmp(cnf->name, "Connect") == 0) {
+ connect_str = cnf->value;
+ } else {
+ fprintf(stderr, "Unknown configuration option %s\n", cnf->name);
+ goto end;
+ }
+ }
+
+ if (!SSL_CONF_CTX_finish(cctx)) {
+ fprintf(stderr, "Finish error\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ /*
+ * We'd normally set some stuff like the verify paths and * mode here
+ * because as things stand this will connect to * any server whose
+ * certificate is signed by any CA.
+ */
+
+ sbio = BIO_new_ssl_connect(ctx);
+
+ BIO_get_ssl(sbio, &ssl);
+
+ if (!ssl) {
+ fprintf(stderr, "Can't locate SSL pointer\n");
+ goto end;
+ }
+
+ /* Don't want any retries */
+ SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
+
+ /* We might want to do other things with ssl here */
+
+ BIO_set_conn_hostname(sbio, connect_str);
+
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ if (BIO_do_connect(sbio) <= 0) {
+ fprintf(stderr, "Error connecting to server\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ if (BIO_do_handshake(sbio) <= 0) {
+ fprintf(stderr, "Error establishing SSL connection\n");
+ ERR_print_errors_fp(stderr);
+ goto end;
+ }
+
+ /* Could examine ssl here to get connection info */
+
+ BIO_puts(sbio, "GET / HTTP/1.0\n\n");
+ for (;;) {
+ len = BIO_read(sbio, tmpbuf, 1024);
+ if (len <= 0)
+ break;
+ BIO_write(out, tmpbuf, len);
+ }
+ end:
+ SSL_CONF_CTX_free(cctx);
+ BIO_free_all(sbio);
+ BIO_free(out);
+ NCONF_free(conf);
+ return 0;
+}
diff --git a/openssl-1.1.0h/demos/bio/cmod.cnf b/openssl-1.1.0h/demos/bio/cmod.cnf
new file mode 100644
index 0000000..39ac54e
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/cmod.cnf
@@ -0,0 +1,24 @@
+# Example config module configuration
+
+# Name supplied by application to CONF_modules_load_file
+# and section containing configuration
+testapp = test_sect
+
+[test_sect]
+# list of configuration modules
+
+# SSL configuration module
+ssl_conf = ssl_sect
+
+[ssl_sect]
+# list of SSL configurations
+server = server_sect
+
+[server_sect]
+# Only support 3 curves
+Curves = P-521:P-384:P-256
+# Restricted signature algorithms
+SignatureAlgorithms = RSA+SHA512:ECDSA+SHA512
+# Certificates and keys
+RSA.Certificate=server.pem
+ECDSA.Certificate=server-ec.pem
diff --git a/openssl-1.1.0h/demos/bio/connect.cnf b/openssl-1.1.0h/demos/bio/connect.cnf
new file mode 100644
index 0000000..4dee03c
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/connect.cnf
@@ -0,0 +1,9 @@
+# Example configuration file
+# Connects to the default port of s_server
+Connect = localhost:4433
+# Disable TLS v1.2 for test.
+# Protocol = ALL, -TLSv1.2
+# Only support 3 curves
+Curves = P-521:P-384:P-256
+# Restricted signature algorithms
+SignatureAlgorithms = RSA+SHA512:ECDSA+SHA512
diff --git a/openssl-1.1.0h/demos/bio/descrip.mms b/openssl-1.1.0h/demos/bio/descrip.mms
new file mode 100644
index 0000000..8e127b0
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/descrip.mms
@@ -0,0 +1,47 @@
+# This build description trusts that the following logical names are defined:
+#
+# For compilation: OPENSSL
+# For linking with shared libraries: OSSL$LIBCRYPTO_SHR and OSSL$LIBSSL_SHR
+# For linking with static libraries: OSSL$LIBCRYPTO and OSSL$LIBSSL
+#
+# These are normally defined with the OpenSSL startup procedure
+
+# By default, we link with the shared libraries
+SHARED = TRUE
+
+# Alternative, for linking with static libraries
+#SHARED = FALSE
+
+.FIRST :
+ IF "$(SHARED)" .EQS. "TRUE" THEN DEFINE OPT []shared.opt
+ IF "$(SHARED)" .NES. "TRUE" THEN DEFINE OPT []static.opt
+
+.LAST :
+ DEASSIGN OPT
+
+.DEFAULT :
+ @ !
+
+# Because we use an option file, we need to redefine this
+.obj.exe :
+ $(LINK) $(LINKFLAGS) $<,OPT:/OPT
+
+all : client-arg.exe client-conf.exe saccept.exe sconnect.exe -
+ server-arg.exe server-cmod.exe server-conf.exe
+
+client-arg.exe : client-arg.obj
+client-conf.exe : client-conf.obj
+saccept.exe : saccept.obj
+sconnect.exe : sconnect.obj
+server-arg.exe : server-arg.obj
+server-cmod.exe : server-cmod.obj
+server-conf.exe : server-conf.obj
+
+# Stoopid MMS doesn't infer this automatically...
+client-arg.obj : client-arg.c
+client-conf.obj : client-conf.c
+saccept.obj : saccept.c
+sconnect.obj : sconnect.c
+server-arg.obj : server-arg.c
+server-cmod.obj : server-cmod.c
+server-conf.obj : server-conf.c
diff --git a/openssl-1.1.0h/demos/bio/intca.pem b/openssl-1.1.0h/demos/bio/intca.pem
new file mode 100644
index 0000000..3551ea9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audadGz/dfYnwvSwT0RMFcXLcMVVRNqP0HeR8OP8qLaP7onRbNnEXNfos9pxXYlg
+j+/WjWTBLVcr3pX2Xtmcaqw3CGN9qbQI8B3JkYeijZmc5+3r5MzK/9R0w8Y/T9Xt
+CXEiQhtWHpPrFEfrExeVy2kjJNRctEfq3OTd1bjgX64zvTU7eR+MHFYKPoyMqwIR
+gjoVKinvovEwWoZe5kfMQwJNA3IgoJexX9BXbS8efAYF/ku3tS0laoZS/q6V/o5I
+RvG0OqnNgxhul+96PE5ujSaprsyvBswIUKt+e/BCxGaS6f2AJ8RmtoPOSfT4b9qN
+thI=
+-----END CERTIFICATE-----
diff --git a/openssl-1.1.0h/demos/bio/root.pem b/openssl-1.1.0h/demos/bio/root.pem
new file mode 100644
index 0000000..3bd0e9b
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/root.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDtjCCAp6gAwIBAgIJAKkg71CjIAovMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV
+BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
+VElORyBQVVJQT1NFUyBPTkxZMR0wGwYDVQQDDBRPcGVuU1NMIFRlc3QgUm9vdCBD
+QTAeFw0xNDAyMjMxMzA1MTNaFw0yNDAyMjExMzA1MTNaMGgxCzAJBgNVBAYTAlVL
+MRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVTVElORyBQ
+VVJQT1NFUyBPTkxZMR0wGwYDVQQDDBRPcGVuU1NMIFRlc3QgUm9vdCBDQTCCASIw
+DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANMaarigKGOra5Mc/LrhOkcmHzDs
+vkYL7dfaaht8fLBKRTYwzSBvO9x54koTWjq7HkbaxkYAg3HnDTkNCyzkGKNdM89H
+q/PtGIFFlceQIOat3Kjd05Iw3PtLEWTDjT6FMA9Mkjk/XbpmycqRIwNKtgICoFsG
+juIpc4P31kxK7i3ri+JnlyvVmRZjJxrheJB0qHGXilrOVDPOliDn//jXbcyzXemu
+R8KgAeQM4IIs9jYHJOgHrTItIpwa9wNTEp9KCGkO6xr20NkKyDp6XRyd+hmnUB7r
+77WTptvKPFFTjTDFqEtcif9U2kVkCfn2mSRO8noCbVH++fuR8LMWlD99gt8CAwEA
+AaNjMGEwHQYDVR0OBBYEFIwZD9dCMXcFBuHTsZ/rOft4cTpFMB8GA1UdIwQYMBaA
+FIwZD9dCMXcFBuHTsZ/rOft4cTpFMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/
+BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCsoxVi49anYZ1aI/2rVJ5bvEd3ZvGn
+wx1Y+l75SQVYU2qX9CHNBVg1t8reIBN8yPEfBM1WcFPEg7Vy3zFaklMPm/oYXwVI
+/lX/LsfPUxdnQmONxLw4x/0booN1LV/dtRcebewUSqog6W9Z2fbTEe6srIBE4M5G
+Wa943lthlmQM6HzlU4D606PQ3zQbX08mue4eqQB813r4uSoI1MpGLqxkziBRFGGN
+T4VNYp8DeSVr3jHjNBmKCAPZxJIYElnLEK027OG00RH7sF7SGFDNsCjN1NmCvuRz
+9AHnjVIBNzIvI3uiOn9tngRDXBRIcUBsdYG19tal8yWBgrr9SdlqFy/Y
+-----END CERTIFICATE-----
diff --git a/openssl-1.1.0h/demos/bio/saccept.c b/openssl-1.1.0h/demos/bio/saccept.c
new file mode 100644
index 0000000..66c5c61
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/saccept.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*-
+ * A minimal program to serve an SSL connection.
+ * It uses blocking.
+ * saccept host:port
+ * host is the interface IP to use. If any interface, use *:port
+ * The default it *:4433
+ *
+ * cc -I../../include saccept.c -L../.. -lssl -lcrypto -ldl
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+#define CERT_FILE "server.pem"
+
+static int done = 0;
+
+void interrupt(int sig)
+{
+ done = 1;
+}
+
+void sigsetup(void)
+{
+ struct sigaction sa;
+
+ /*
+ * Catch at most once, and don't restart the accept system call.
+ */
+ sa.sa_flags = SA_RESETHAND;
+ sa.sa_handler = interrupt;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, NULL);
+}
+
+int main(int argc, char *argv[])
+{
+ char *port = NULL;
+ BIO *in = NULL;
+ BIO *ssl_bio, *tmp;
+ SSL_CTX *ctx;
+ char buf[512];
+ int ret = 1, i;
+
+ if (argc <= 1)
+ port = "*:4433";
+ else
+ port = argv[1];
+
+ ctx = SSL_CTX_new(TLS_server_method());
+ if (!SSL_CTX_use_certificate_chain_file(ctx, CERT_FILE))
+ goto err;
+ if (!SSL_CTX_use_PrivateKey_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
+ goto err;
+ if (!SSL_CTX_check_private_key(ctx))
+ goto err;
+
+ /* Setup server side SSL bio */
+ ssl_bio = BIO_new_ssl(ctx, 0);
+
+ if ((in = BIO_new_accept(port)) == NULL)
+ goto err;
+
+ /*
+ * This means that when a new connection is accepted on 'in', The ssl_bio
+ * will be 'duplicated' and have the new socket BIO push into it.
+ * Basically it means the SSL BIO will be automatically setup
+ */
+ BIO_set_accept_bios(in, ssl_bio);
+
+ /* Arrange to leave server loop on interrupt */
+ sigsetup();
+
+ again:
+ /*
+ * The first call will setup the accept socket, and the second will get a
+ * socket. In this loop, the first actual accept will occur in the
+ * BIO_read() function.
+ */
+
+ if (BIO_do_accept(in) <= 0)
+ goto err;
+
+ while (!done) {
+ i = BIO_read(in, buf, 512);
+ if (i == 0) {
+ /*
+ * If we have finished, remove the underlying BIO stack so the
+ * next time we call any function for this BIO, it will attempt
+ * to do an accept
+ */
+ printf("Done\n");
+ tmp = BIO_pop(in);
+ BIO_free_all(tmp);
+ goto again;
+ }
+ if (i < 0)
+ goto err;
+ fwrite(buf, 1, i, stdout);
+ fflush(stdout);
+ }
+
+ ret = 0;
+ err:
+ if (ret) {
+ ERR_print_errors_fp(stderr);
+ }
+ BIO_free(in);
+ exit(ret);
+ return (!ret);
+}
diff --git a/openssl-1.1.0h/demos/bio/sconnect.c b/openssl-1.1.0h/demos/bio/sconnect.c
new file mode 100644
index 0000000..664a1e0
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/sconnect.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*-
+ * A minimal program to do SSL to a passed host and port.
+ * It is actually using non-blocking IO but in a very simple manner
+ * sconnect host:port - it does a 'GET / HTTP/1.0'
+ *
+ * cc -I../../include sconnect.c -L../.. -lssl -lcrypto
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+#define HOSTPORT "localhost:4433"
+#define CAFILE "root.pem"
+
+extern int errno;
+
+int main(argc, argv)
+int argc;
+char *argv[];
+{
+ const char *hostport = HOSTPORT;
+ const char *CAfile = CAFILE;
+ char *hostname;
+ char *cp;
+ BIO *out = NULL;
+ char buf[1024 * 10], *p;
+ SSL_CTX *ssl_ctx = NULL;
+ SSL *ssl;
+ BIO *ssl_bio;
+ int i, len, off, ret = 1;
+
+ if (argc > 1)
+ hostport = argv[1];
+ if (argc > 2)
+ CAfile = argv[2];
+
+ hostname = OPENSSL_strdup(hostport);
+ if ((cp = strchr(hostname, ':')) != NULL)
+ *cp = 0;
+
+#ifdef WATT32
+ dbug_init();
+ sock_init();
+#endif
+
+ ssl_ctx = SSL_CTX_new(TLS_client_method());
+
+ /* Enable trust chain verification */
+ SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);
+ SSL_CTX_load_verify_locations(ssl_ctx, CAfile, NULL);
+
+ /* Lets make a SSL structure */
+ ssl = SSL_new(ssl_ctx);
+ SSL_set_connect_state(ssl);
+
+ /* Enable peername verification */
+ if (SSL_set1_host(ssl, hostname) <= 0)
+ goto err;
+
+ /* Use it inside an SSL BIO */
+ ssl_bio = BIO_new(BIO_f_ssl());
+ BIO_set_ssl(ssl_bio, ssl, BIO_CLOSE);
+
+ /* Lets use a connect BIO under the SSL BIO */
+ out = BIO_new(BIO_s_connect());
+ BIO_set_conn_hostname(out, hostport);
+ BIO_set_nbio(out, 1);
+ out = BIO_push(ssl_bio, out);
+
+ p = "GET / HTTP/1.0\r\n\r\n";
+ len = strlen(p);
+
+ off = 0;
+ for (;;) {
+ i = BIO_write(out, &(p[off]), len);
+ if (i <= 0) {
+ if (BIO_should_retry(out)) {
+ fprintf(stderr, "write DELAY\n");
+ sleep(1);
+ continue;
+ } else {
+ goto err;
+ }
+ }
+ off += i;
+ len -= i;
+ if (len <= 0)
+ break;
+ }
+
+ for (;;) {
+ i = BIO_read(out, buf, sizeof(buf));
+ if (i == 0)
+ break;
+ if (i < 0) {
+ if (BIO_should_retry(out)) {
+ fprintf(stderr, "read DELAY\n");
+ sleep(1);
+ continue;
+ }
+ goto err;
+ }
+ fwrite(buf, 1, i, stdout);
+ }
+
+ ret = 1;
+ goto done;
+
+ err:
+ if (ERR_peek_error() == 0) { /* system call error */
+ fprintf(stderr, "errno=%d ", errno);
+ perror("error");
+ } else
+ ERR_print_errors_fp(stderr);
+ done:
+ BIO_free_all(out);
+ SSL_CTX_free(ssl_ctx);
+ return (ret == 1);
+}
diff --git a/openssl-1.1.0h/demos/bio/server-arg.c b/openssl-1.1.0h/demos/bio/server-arg.c
new file mode 100644
index 0000000..6056969
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/server-arg.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * A minimal program to serve an SSL connection. It uses blocking. It use the
+ * SSL_CONF API with the command line. cc -I../../include server-arg.c
+ * -L../.. -lssl -lcrypto -ldl
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+int main(int argc, char *argv[])
+{
+ char *port = "*:4433";
+ BIO *ssl_bio, *tmp;
+ SSL_CTX *ctx;
+ SSL_CONF_CTX *cctx;
+ char buf[512];
+ BIO *in = NULL;
+ int ret = 1, i;
+ char **args = argv + 1;
+ int nargs = argc - 1;
+
+ 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);
+ SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
+ while (*args && **args == '-') {
+ int rv;
+ /* Parse standard arguments */
+ rv = SSL_CONF_cmd_argv(cctx, &nargs, &args);
+ if (rv == -3) {
+ fprintf(stderr, "Missing argument for %s\n", *args);
+ goto err;
+ }
+ if (rv < 0) {
+ fprintf(stderr, "Error in command %s\n", *args);
+ ERR_print_errors_fp(stderr);
+ goto err;
+ }
+ /* If rv > 0 we processed something so proceed to next arg */
+ if (rv > 0)
+ continue;
+ /* Otherwise application specific argument processing */
+ if (strcmp(*args, "-port") == 0) {
+ port = args[1];
+ if (port == NULL) {
+ fprintf(stderr, "Missing -port argument\n");
+ goto err;
+ }
+ args += 2;
+ nargs -= 2;
+ continue;
+ } else {
+ fprintf(stderr, "Unknown argument %s\n", *args);
+ goto err;
+ }
+ }
+
+ if (!SSL_CONF_CTX_finish(cctx)) {
+ fprintf(stderr, "Finish error\n");
+ ERR_print_errors_fp(stderr);
+ goto err;
+ }
+#ifdef ITERATE_CERTS
+ /*
+ * Demo of how to iterate over all certificates in an SSL_CTX structure.
+ */
+ {
+ X509 *x;
+ int rv;
+ rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_FIRST);
+ while (rv) {
+ X509 *x = SSL_CTX_get0_certificate(ctx);
+ X509_NAME_print_ex_fp(stdout, X509_get_subject_name(x), 0,
+ XN_FLAG_ONELINE);
+ printf("\n");
+ rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_NEXT);
+ }
+ fflush(stdout);
+ }
+#endif
+ /* Setup server side SSL bio */
+ ssl_bio = BIO_new_ssl(ctx, 0);
+
+ if ((in = BIO_new_accept(port)) == NULL)
+ goto err;
+
+ /*
+ * This means that when a new connection is accepted on 'in', The ssl_bio
+ * will be 'duplicated' and have the new socket BIO push into it.
+ * Basically it means the SSL BIO will be automatically setup
+ */
+ BIO_set_accept_bios(in, ssl_bio);
+
+ again:
+ /*
+ * The first call will setup the accept socket, and the second will get a
+ * socket. In this loop, the first actual accept will occur in the
+ * BIO_read() function.
+ */
+
+ if (BIO_do_accept(in) <= 0)
+ goto err;
+
+ for (;;) {
+ i = BIO_read(in, buf, 512);
+ if (i == 0) {
+ /*
+ * If we have finished, remove the underlying BIO stack so the
+ * next time we call any function for this BIO, it will attempt
+ * to do an accept
+ */
+ printf("Done\n");
+ tmp = BIO_pop(in);
+ BIO_free_all(tmp);
+ goto again;
+ }
+ if (i < 0)
+ goto err;
+ fwrite(buf, 1, i, stdout);
+ fflush(stdout);
+ }
+
+ ret = 0;
+ err:
+ if (ret) {
+ ERR_print_errors_fp(stderr);
+ }
+ BIO_free(in);
+ exit(ret);
+ return (!ret);
+}
diff --git a/openssl-1.1.0h/demos/bio/server-cmod.c b/openssl-1.1.0h/demos/bio/server-cmod.c
new file mode 100644
index 0000000..9cb2463
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/server-cmod.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * A minimal TLS server it ses SSL_CTX_config and a configuration file to
+ * set most server parameters.
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+#include <openssl/conf.h>
+
+int main(int argc, char *argv[])
+{
+ unsigned char buf[512];
+ char *port = "*:4433";
+ BIO *in = NULL;
+ BIO *ssl_bio, *tmp;
+ 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;
+ }
+
+ if (SSL_CTX_config(ctx, "server") == 0) {
+ fprintf(stderr, "Error configuring server.\n");
+ goto err;
+ }
+
+ /* Setup server side SSL bio */
+ ssl_bio = BIO_new_ssl(ctx, 0);
+
+ if ((in = BIO_new_accept(port)) == NULL)
+ goto err;
+
+ /*
+ * This means that when a new connection is accepted on 'in', The ssl_bio
+ * will be 'duplicated' and have the new socket BIO push into it.
+ * Basically it means the SSL BIO will be automatically setup
+ */
+ BIO_set_accept_bios(in, ssl_bio);
+
+ again:
+ /*
+ * The first call will setup the accept socket, and the second will get a
+ * socket. In this loop, the first actual accept will occur in the
+ * BIO_read() function.
+ */
+
+ if (BIO_do_accept(in) <= 0)
+ goto err;
+
+ for (;;) {
+ i = BIO_read(in, buf, sizeof(buf));
+ if (i == 0) {
+ /*
+ * If we have finished, remove the underlying BIO stack so the
+ * next time we call any function for this BIO, it will attempt
+ * to do an accept
+ */
+ printf("Done\n");
+ tmp = BIO_pop(in);
+ BIO_free_all(tmp);
+ goto again;
+ }
+ if (i < 0) {
+ if (BIO_should_retry(in))
+ continue;
+ goto err;
+ }
+ fwrite(buf, 1, i, stdout);
+ fflush(stdout);
+ }
+
+ ret = 0;
+ err:
+ if (ret) {
+ ERR_print_errors_fp(stderr);
+ }
+ BIO_free(in);
+ exit(ret);
+ return (!ret);
+}
diff --git a/openssl-1.1.0h/demos/bio/server-conf.c b/openssl-1.1.0h/demos/bio/server-conf.c
new file mode 100644
index 0000000..41b1308
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/server-conf.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * A minimal program to serve an SSL connection. It uses blocking. It uses
+ * the SSL_CONF API with a configuration file. cc -I../../include saccept.c
+ * -L../.. -lssl -lcrypto -ldl
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+#include <openssl/conf.h>
+
+int main(int argc, char *argv[])
+{
+ char *port = "*:4433";
+ BIO *in = NULL;
+ BIO *ssl_bio, *tmp;
+ SSL_CTX *ctx;
+ SSL_CONF_CTX *cctx = NULL;
+ CONF *conf = NULL;
+ STACK_OF(CONF_VALUE) *sect = NULL;
+ CONF_VALUE *cnf;
+ long errline = -1;
+ char buf[512];
+ int ret = 1, i;
+
+ ctx = SSL_CTX_new(TLS_server_method());
+
+ conf = NCONF_new(NULL);
+
+ if (NCONF_load(conf, "accept.cnf", &errline) <= 0) {
+ if (errline <= 0)
+ fprintf(stderr, "Error processing config file\n");
+ else
+ fprintf(stderr, "Error on line %ld\n", errline);
+ goto err;
+ }
+
+ sect = NCONF_get_section(conf, "default");
+
+ if (sect == NULL) {
+ fprintf(stderr, "Error retrieving default section\n");
+ goto err;
+ }
+
+ 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);
+ SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_FILE);
+ SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
+ for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
+ int rv;
+ cnf = sk_CONF_VALUE_value(sect, i);
+ rv = SSL_CONF_cmd(cctx, cnf->name, cnf->value);
+ if (rv > 0)
+ continue;
+ if (rv != -2) {
+ fprintf(stderr, "Error processing %s = %s\n",
+ cnf->name, cnf->value);
+ ERR_print_errors_fp(stderr);
+ goto err;
+ }
+ if (strcmp(cnf->name, "Port") == 0) {
+ port = cnf->value;
+ } else {
+ fprintf(stderr, "Unknown configuration option %s\n", cnf->name);
+ goto err;
+ }
+ }
+
+ if (!SSL_CONF_CTX_finish(cctx)) {
+ fprintf(stderr, "Finish error\n");
+ ERR_print_errors_fp(stderr);
+ goto err;
+ }
+
+ /* Setup server side SSL bio */
+ ssl_bio = BIO_new_ssl(ctx, 0);
+
+ if ((in = BIO_new_accept(port)) == NULL)
+ goto err;
+
+ /*
+ * This means that when a new connection is accepted on 'in', The ssl_bio
+ * will be 'duplicated' and have the new socket BIO push into it.
+ * Basically it means the SSL BIO will be automatically setup
+ */
+ BIO_set_accept_bios(in, ssl_bio);
+
+ again:
+ /*
+ * The first call will setup the accept socket, and the second will get a
+ * socket. In this loop, the first actual accept will occur in the
+ * BIO_read() function.
+ */
+
+ if (BIO_do_accept(in) <= 0)
+ goto err;
+
+ for (;;) {
+ i = BIO_read(in, buf, 512);
+ if (i == 0) {
+ /*
+ * If we have finished, remove the underlying BIO stack so the
+ * next time we call any function for this BIO, it will attempt
+ * to do an accept
+ */
+ printf("Done\n");
+ tmp = BIO_pop(in);
+ BIO_free_all(tmp);
+ goto again;
+ }
+ if (i < 0) {
+ if (BIO_should_retry(in))
+ continue;
+ goto err;
+ }
+ fwrite(buf, 1, i, stdout);
+ fflush(stdout);
+ }
+
+ ret = 0;
+ err:
+ if (ret) {
+ ERR_print_errors_fp(stderr);
+ }
+ BIO_free(in);
+ exit(ret);
+ return (!ret);
+}
diff --git a/openssl-1.1.0h/demos/bio/server-ec.pem b/openssl-1.1.0h/demos/bio/server-ec.pem
new file mode 100644
index 0000000..a13fdc7
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/server-ec.pem
@@ -0,0 +1,17 @@
+-----BEGIN PRIVATE KEY-----
+MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg/5kYU3PUlHwfdjEN
+lC1xTZEx3o55RgtSOuOCTryDfomhRANCAARW/qUFg+qZzjcFWrST4bmkRCFu8/rn
+KTHjW2vpBXYGXKDn4AbAfYXYhM9J7v1HkkrZBPPGx53eVzs61/Pgr6Rc
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIIBsTCCAVegAwIBAgIJALChLe0vZzgoMAoGCCqGSM49BAMCMDUxHzAdBgNVBAsM
+FlRlc3QgRUNEU0EgQ2VydGlmaWNhdGUxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0x
+NTEyMjIxNDUxMDRaFw00NDAxMDQxNDUxMDRaMDUxHzAdBgNVBAsMFlRlc3QgRUNE
+U0EgQ2VydGlmaWNhdGUxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG
+CCqGSM49AwEHA0IABFb+pQWD6pnONwVatJPhuaREIW7z+ucpMeNba+kFdgZcoOfg
+BsB9hdiEz0nu/UeSStkE88bHnd5XOzrX8+CvpFyjUDBOMB0GA1UdDgQWBBROhkTJ
+lsm8Qd8pEgrrapccfFY5gjAfBgNVHSMEGDAWgBROhkTJlsm8Qd8pEgrrapccfFY5
+gjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0gAMEUCIFhyU/WZRcihilTpwFVm
+fly1JhwisouiZjLnPkRYZVzHAiEAgqxXfRQl1/phnEgO9gRcv2nFp9xvJiDgKPse
+VktDYjE=
+-----END CERTIFICATE-----
diff --git a/openssl-1.1.0h/demos/bio/server.pem b/openssl-1.1.0h/demos/bio/server.pem
new file mode 100644
index 0000000..8a4a51f
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/server.pem
@@ -0,0 +1,77 @@
+subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = Test Server Cert
+issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
+-----BEGIN CERTIFICATE-----
+MIIDyTCCArGgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJVSzEW
+MBQGA1UECgwNT3BlblNTTCBHcm91cDEiMCAGA1UECwwZRk9SIFRFU1RJTkcgUFVS
+UE9TRVMgT05MWTElMCMGA1UEAwwcT3BlblNTTCBUZXN0IEludGVybWVkaWF0ZSBD
+QTAgFw0xNjAxMDQwODU0NDZaGA8yMTE2MDEwNTA4NTQ0NlowZDELMAkGA1UEBhMC
+VUsxFjAUBgNVBAoMDU9wZW5TU0wgR3JvdXAxIjAgBgNVBAsMGUZPUiBURVNUSU5H
+IFBVUlBPU0VTIE9OTFkxGTAXBgNVBAMMEFRlc3QgU2VydmVyIENlcnQwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDzhPOSNtyyRspmeuUpxfNJKCLTuf7g
+3uQ4zu4iHOmRO5TQci+HhVlLZrHF9XqFXcIP0y4pWDbMSGuiorUmzmfiR7bfSdI/
++qIQt8KXRH6HNG1t8ou0VSvWId5TS5Dq/er5ODUr9OaaDva7EquHIcMvvPQGuI+O
+EAcnleVCy9HVEIySrO4P3CNIicnGkwwiAud05yUAq/gPXBC1hTtmlPD7TVcGVSEi
+Jdvzqqlgv02qedGrkki6GY4S7GjZxrrf7Foc2EP+51LJzwLQx3/JfrCU41NEWAsu
+/Sl0tQabXESN+zJ1pDqoZ3uHMgpQjeGiE0olr+YcsSW/tJmiU9OiAr8RAgMBAAGj
+eDB2MB0GA1UdDgQWBBSCvM8AABPR9zklmifnr9LvIBturDAfBgNVHSMEGDAWgBQ2
+w2yI55X+sL3szj49hqshgYfa2jAJBgNVHRMEAjAAMBMGA1UdJQQMMAoGCCsGAQUF
+BwMBMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAQEAC78R
+sAr4uvkYOu/pSwQ3MYOFqZ0BnPuP0/AZW2zF7TLNy8g36GyH9rKxz2ffQEHRmPQN
+Z11Ohg3z03jw/sVzkgt2U5Ipv923sSeCZcu0nuNex3v9/x72ldYikZNhQOsw+2kr
+hx3OvE9R7xl9eyjz7BknsbY7PC3kiUY8SDdc5Fr/XMkHm3ge65oWYOHBjC5tAr5K
+FGCEjM3syxS+Li5X6yfDGiVSjOU4gJuZDCYbl7cEQexU2deds8EmpJJrrI7s4JcQ
+rraHI8+Hu8X9VLpZE1jl/fKJw3D0i53PoN2WhukIOg1Zv+ajMKQ4ubVfISH2ebox
++ybAZO8hxL6/I08/GQ==
+-----END CERTIFICATE-----
+subject= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Intermediate CA
+issuer= C = UK, O = OpenSSL Group, OU = FOR TESTING PURPOSES ONLY, CN = OpenSSL Test Root CA
+-----BEGIN CERTIFICATE-----
+MIIDvjCCAqagAwIBAgIJAPzCy4CUW9/qMA0GCSqGSIb3DQEBCwUAMGgxCzAJBgNV
+BAYTAlVLMRYwFAYDVQQKDA1PcGVuU1NMIEdyb3VwMSIwIAYDVQQLDBlGT1IgVEVT
+VElORyBQVVJQT1NFUyBPTkxZMR0wGwYDVQQDDBRPcGVuU1NMIFRlc3QgUm9vdCBD
+QTAeFw0xNTA3MTQxMzIyMDVaFw0yNTA2MjExMzIyMDVaMHAxCzAJ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ZbKqUws7x8
+bp+6iBfUPJUbcqNqFmi/08Yt7vrDnMnyMw2A/sECgYEAiiuRMxnuzVm34hQcsbhH
+6ymVqf7j0PW2qK0F4H1ocT9qhzWFd+RB3kHWrCjnqODQoI6GbGr/4JepHUpre1ex
+4UEN5oSS3G0ru0rC3U4C59dZ5KwDHFm7ffZ1pr52ljfQDUsrjjIMRtuiwNK2OoRa
+WSsqiaL+SDzSB+nBmpnAizECgYBdt/y6rerWUx4MhDwwtTnel7JwHyo2MDFS6/5g
+n8qC2Lj6/fMDRE22w+CA2esp7EJNQJGv+b27iFpbJEDh+/Lf5YzIT4MwVskQ5bYB
+JFcmRxUVmf4e09D7o705U/DjCgMH09iCsbLmqQ38ONIRSHZaJtMDtNTHD1yi+jF+
+OT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX
+xT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK
+UM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==
+-----END RSA PRIVATE KEY-----
diff --git a/openssl-1.1.0h/demos/bio/shared.opt b/openssl-1.1.0h/demos/bio/shared.opt
new file mode 100644
index 0000000..4141b93
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/shared.opt
@@ -0,0 +1,2 @@
+OSSL$LIBSSL_SHR/SHARE
+OSSL$LIBCRYPTO_SHR/SHARE
diff --git a/openssl-1.1.0h/demos/bio/static.opt b/openssl-1.1.0h/demos/bio/static.opt
new file mode 100644
index 0000000..9ca1588
--- /dev/null
+++ b/openssl-1.1.0h/demos/bio/static.opt
@@ -0,0 +1,2 @@
+OSSL$LIBSSL/LIB
+OSSL$LIBCRYPTO/LIB