src/server/daemon/webserver.c

changeset 106
b122f34ddc80
parent 85
b62e77d8e80c
child 115
51d9a15eac98
--- a/src/server/daemon/webserver.c	Wed Oct 28 17:59:34 2015 +0100
+++ b/src/server/daemon/webserver.c	Sat Oct 31 15:01:07 2015 +0100
@@ -38,6 +38,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <openssl/bio.h> 
+#include <openssl/ssl.h> 
+#include <openssl/err.h> 
+
 #include "../public/nsapi.h"
 #include "../public/auth.h"
 #include "../util/systhr.h"
@@ -60,6 +64,11 @@
     // init NSPR
     systhread_init("webserver");
     
+    // init ssl
+    if(ws_init_ssl()) {
+        return -1;
+    }
+    
     // init NSAPI functions
     func_init();
     add_functions(webserver_funcs);
@@ -217,3 +226,12 @@
 int nsapi_runtime_version() {
     return 303;
 }
+
+
+int ws_init_ssl() {
+    // TODO: handle errors
+    SSL_load_error_strings();
+    SSL_library_init();
+    OpenSSL_add_all_algorithms();
+    return 0;
+}

mercurial