|
|
8be31c7 |
diff -up openwsman-2.6.8/src/server/shttpd/compat_unix.h.orig openwsman-2.6.8/src/server/shttpd/compat_unix.h
|
|
|
8be31c7 |
--- openwsman-2.6.8/src/server/shttpd/compat_unix.h.orig 2018-10-12 12:06:26.000000000 +0200
|
|
|
8be31c7 |
+++ openwsman-2.6.8/src/server/shttpd/compat_unix.h 2018-11-22 13:30:10.756423510 +0100
|
|
|
84d17f6 |
@@ -27,10 +27,6 @@
|
|
|
39db6f6 |
pthread_create(&tid, NULL, (void *(*)(void *))a, c); } while (0)
|
|
|
39db6f6 |
#endif /* !NO_THREADS */
|
|
|
c4e0090 |
|
|
|
84d17f6 |
-#ifndef SSL_LIB
|
|
|
39db6f6 |
-#define SSL_LIB "libssl.so"
|
|
|
84d17f6 |
-#endif
|
|
|
84d17f6 |
-
|
|
|
39db6f6 |
#define DIRSEP '/'
|
|
|
39db6f6 |
#define IS_DIRSEP_CHAR(c) ((c) == '/')
|
|
|
39db6f6 |
#define O_BINARY 0
|
|
|
8be31c7 |
diff -up openwsman-2.6.8/src/server/shttpd/io_ssl.c.orig openwsman-2.6.8/src/server/shttpd/io_ssl.c
|
|
|
8be31c7 |
--- openwsman-2.6.8/src/server/shttpd/io_ssl.c.orig 2018-10-12 12:06:26.000000000 +0200
|
|
|
8be31c7 |
+++ openwsman-2.6.8/src/server/shttpd/io_ssl.c 2018-11-22 13:30:10.757423510 +0100
|
|
|
39db6f6 |
@@ -11,23 +11,6 @@
|
|
|
39db6f6 |
#include "defs.h"
|
|
|
c4e0090 |
|
|
|
c4e0090 |
#if !defined(NO_SSL)
|
|
|
c4e0090 |
-struct ssl_func ssl_sw[] = {
|
|
|
c4e0090 |
- {"SSL_free", {0}},
|
|
|
c4e0090 |
- {"SSL_accept", {0}},
|
|
|
c4e0090 |
- {"SSL_connect", {0}},
|
|
|
c4e0090 |
- {"SSL_read", {0}},
|
|
|
c4e0090 |
- {"SSL_write", {0}},
|
|
|
c4e0090 |
- {"SSL_get_error", {0}},
|
|
|
c4e0090 |
- {"SSL_set_fd", {0}},
|
|
|
c4e0090 |
- {"SSL_new", {0}},
|
|
|
c4e0090 |
- {"SSL_CTX_new", {0}},
|
|
|
c4e0090 |
- {"SSLv23_server_method", {0}},
|
|
|
c4e0090 |
- {"SSL_library_init", {0}},
|
|
|
c4e0090 |
- {"SSL_CTX_use_PrivateKey_file", {0}},
|
|
|
c4e0090 |
- {"SSL_CTX_use_certificate_file",{0}},
|
|
|
c4e0090 |
- {NULL, {0}}
|
|
|
c4e0090 |
-};
|
|
|
39db6f6 |
-
|
|
|
c4e0090 |
void
|
|
|
39db6f6 |
_shttpd_ssl_handshake(struct stream *stream)
|
|
|
39db6f6 |
{
|
|
|
8be31c7 |
diff -up openwsman-2.6.8/src/server/shttpd/shttpd.c.orig openwsman-2.6.8/src/server/shttpd/shttpd.c
|
|
|
8be31c7 |
--- openwsman-2.6.8/src/server/shttpd/shttpd.c.orig 2018-10-12 12:06:26.000000000 +0200
|
|
|
8be31c7 |
+++ openwsman-2.6.8/src/server/shttpd/shttpd.c 2018-11-22 13:30:41.314416695 +0100
|
|
|
84d17f6 |
@@ -1476,20 +1476,14 @@ set_ssl(struct shttpd_ctx *ctx, const ch
|
|
|
39db6f6 |
int retval = FALSE;
|
|
|
84d17f6 |
EC_KEY* key;
|
|
|
39db6f6 |
|
|
|
39db6f6 |
- /* Load SSL library dynamically */
|
|
|
39db6f6 |
- if ((lib = dlopen(SSL_LIB, RTLD_LAZY)) == NULL) {
|
|
|
39db6f6 |
- _shttpd_elog(E_LOG, NULL, "set_ssl: cannot load %s", SSL_LIB);
|
|
|
39db6f6 |
- return (FALSE);
|
|
|
39db6f6 |
- }
|
|
|
39db6f6 |
-
|
|
|
39db6f6 |
- for (fp = ssl_sw; fp->name != NULL; fp++)
|
|
|
39db6f6 |
- if ((fp->ptr.v_void = dlsym(lib, fp->name)) == NULL) {
|
|
|
39db6f6 |
- _shttpd_elog(E_LOG, NULL,"set_ssl: cannot find %s", fp->name);
|
|
|
39db6f6 |
- return (FALSE);
|
|
|
39db6f6 |
- }
|
|
|
39db6f6 |
-
|
|
|
39db6f6 |
/* Initialize SSL crap */
|
|
|
39db6f6 |
+ debug("Initialize SSL");
|
|
|
39db6f6 |
+ SSL_load_error_strings();
|
|
|
2b47725 |
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
|
|
39db6f6 |
+ OPENSSL_init_ssl(0, NULL);
|
|
|
2b47725 |
+#else
|
|
|
2b47725 |
SSL_library_init();
|
|
|
2b47725 |
+#endif
|
|
|
39db6f6 |
|
|
|
39db6f6 |
if ((CTX = SSL_CTX_new(SSLv23_server_method())) == NULL)
|
|
|
39db6f6 |
_shttpd_elog(E_LOG, NULL, "SSL_CTX_new error");
|
|
|
8be31c7 |
diff -up openwsman-2.6.8/src/server/shttpd/ssl.h.orig openwsman-2.6.8/src/server/shttpd/ssl.h
|
|
|
8be31c7 |
--- openwsman-2.6.8/src/server/shttpd/ssl.h.orig 2018-10-12 12:06:26.000000000 +0200
|
|
|
8be31c7 |
+++ openwsman-2.6.8/src/server/shttpd/ssl.h 2018-11-22 13:30:10.757423510 +0100
|
|
|
8be31c7 |
@@ -12,52 +12,4 @@
|
|
|
c4e0090 |
|
|
|
39db6f6 |
#include <openssl/ssl.h>
|
|
|
c4e0090 |
|
|
|
c4e0090 |
-#else
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-/*
|
|
|
c4e0090 |
- * Snatched from OpenSSL includes. I put the prototypes here to be independent
|
|
|
c4e0090 |
- * from the OpenSSL source installation. Having this, shttpd + SSL can be
|
|
|
c4e0090 |
- * built on any system with binary SSL libraries installed.
|
|
|
c4e0090 |
- */
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-typedef struct ssl_st SSL;
|
|
|
c4e0090 |
-typedef struct ssl_method_st SSL_METHOD;
|
|
|
c4e0090 |
-typedef struct ssl_ctx_st SSL_CTX;
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-#define SSL_ERROR_WANT_READ 2
|
|
|
c4e0090 |
-#define SSL_ERROR_WANT_WRITE 3
|
|
|
39db6f6 |
-#define SSL_ERROR_SYSCALL 5
|
|
|
39db6f6 |
-#define SSL_FILETYPE_PEM 1
|
|
|
c4e0090 |
-
|
|
|
8be31c7 |
-#endif
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-/*
|
|
|
c4e0090 |
- * Dynamically loaded SSL functionality
|
|
|
c4e0090 |
- */
|
|
|
c4e0090 |
-struct ssl_func {
|
|
|
c4e0090 |
- const char *name; /* SSL function name */
|
|
|
c4e0090 |
- union variant ptr; /* Function pointer */
|
|
|
c4e0090 |
-};
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-extern struct ssl_func ssl_sw[];
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-#define FUNC(x) ssl_sw[x].ptr.v_func
|
|
|
c4e0090 |
-
|
|
|
c4e0090 |
-#define SSL_free(x) (* (void (*)(SSL *)) FUNC(0))(x)
|
|
|
c4e0090 |
-#define SSL_accept(x) (* (int (*)(SSL *)) FUNC(1))(x)
|
|
|
c4e0090 |
-#define SSL_connect(x) (* (int (*)(SSL *)) FUNC(2))(x)
|
|
|
c4e0090 |
-#define SSL_read(x,y,z) (* (int (*)(SSL *, void *, int)) FUNC(3))((x),(y),(z))
|
|
|
c4e0090 |
-#define SSL_write(x,y,z) \
|
|
|
c4e0090 |
- (* (int (*)(SSL *, const void *,int)) FUNC(4))((x), (y), (z))
|
|
|
c4e0090 |
-#define SSL_get_error(x,y)(* (int (*)(SSL *, int)) FUNC(5))((x), (y))
|
|
|
c4e0090 |
-#define SSL_set_fd(x,y) (* (int (*)(SSL *, int)) FUNC(6))((x), (y))
|
|
|
c4e0090 |
-#define SSL_new(x) (* (SSL * (*)(SSL_CTX *)) FUNC(7))(x)
|
|
|
8be31c7 |
-#define SSL_CTX_new(x) (* (SSL_CTX * (*)(const SSL_METHOD *)) FUNC(8))(x)
|
|
|
8be31c7 |
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
|
c4e0090 |
-#define SSLv23_server_method() (* (SSL_METHOD * (*)(void)) FUNC(9))()
|
|
|
c4e0090 |
-#define SSL_library_init() (* (int (*)(void)) FUNC(10))()
|
|
|
8be31c7 |
#endif
|
|
|
c4e0090 |
-#define SSL_CTX_use_PrivateKey_file(x,y,z) (* (int (*)(SSL_CTX *, \
|
|
|
c4e0090 |
- const char *, int)) FUNC(11))((x), (y), (z))
|
|
|
c4e0090 |
-#define SSL_CTX_use_certificate_file(x,y,z) (* (int (*)(SSL_CTX *, \
|
|
|
c4e0090 |
- const char *, int)) FUNC(12))((x), (y), (z))
|