summaryrefslogtreecommitdiffstats
path: root/ssl_openssl.c
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-29 15:15:32 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-19 22:31:46 +0200
commit95993a1df3c39fd2ea9c037b2f0bfcdf040b7d59 (patch)
tree7142b7312a929191d21069cbfa9198d73381148f /ssl_openssl.c
parent9a160b796e1a40f9635231e5533ce40d46dba25f (diff)
downloadopenvpn-95993a1df3c39fd2ea9c037b2f0bfcdf040b7d59.tar.gz
openvpn-95993a1df3c39fd2ea9c037b2f0bfcdf040b7d59.tar.xz
openvpn-95993a1df3c39fd2ea9c037b2f0bfcdf040b7d59.zip
Refactored SSL initialisation functions
Signed-off-by: Adriaan de Jong <dejong@fox-it.com> Acked-by: Gert Doering <gert@greenie.muc.de> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'ssl_openssl.c')
-rw-r--r--ssl_openssl.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ssl_openssl.c b/ssl_openssl.c
index b38af87..eff0bc4 100644
--- a/ssl_openssl.c
+++ b/ssl_openssl.c
@@ -42,3 +42,35 @@
#include <openssl/pkcs12.h>
#include <openssl/x509.h>
#include <openssl/crypto.h>
+
+/*
+ * Allocate space in SSL objects in which to store a struct tls_session
+ * pointer back to parent.
+ *
+ */
+
+int mydata_index; /* GLOBAL */
+
+void
+tls_init_lib()
+{
+ SSL_library_init();
+ SSL_load_error_strings();
+ OpenSSL_add_all_algorithms ();
+
+ mydata_index = SSL_get_ex_new_index(0, "struct session *", NULL, NULL, NULL);
+ ASSERT (mydata_index >= 0);
+}
+
+void
+tls_free_lib()
+{
+ EVP_cleanup();
+ ERR_free_strings();
+}
+
+void
+tls_clear_error()
+{
+ ERR_clear_error ();
+}