File tree Expand file tree Collapse file tree 6 files changed +17
-23
lines changed Expand file tree Collapse file tree 6 files changed +17
-23
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,6 @@ Library
127127 OpenSSL.BIO
128128 OpenSSL.ERR
129129 OpenSSL.Objects
130- OpenSSL.SSL
131130 OpenSSL.SSL.Option
132131 OpenSSL.Stack
133132 OpenSSL.Utils
Original file line number Diff line number Diff line change @@ -46,13 +46,15 @@ module OpenSSL
4646 where
4747import Control.Concurrent.MVar
4848import Control.Monad
49- import OpenSSL.SSL
5049import System.IO.Unsafe
5150
5251#if !MIN_VERSION_base(4,6,0)
5352import Control.Exception (onException , mask_ )
5453#endif
5554
55+ foreign import ccall " HsOpenSSL_init"
56+ initSSL :: IO ()
57+
5658foreign import ccall " HsOpenSSL_setupMutex"
5759 setupMutex :: IO ()
5860
@@ -81,9 +83,7 @@ withOpenSSL io
8183 -- We don't want our initialisation sequence to be interrupted
8284 -- halfway.
8385 = do modifyMVarMasked_ isInitialised $ \ done ->
84- do unless done $ do loadErrorStrings
85- addAllAlgorithms
86- libraryInit
86+ do unless done $ do initSSL
8787 setupMutex
8888 return True
8989 io
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -136,7 +136,11 @@ data SSLMethod_
136136
137137foreign import ccall unsafe " SSL_CTX_new" _ssl_ctx_new :: Ptr SSLMethod_ -> IO (Ptr SSLContext_ )
138138foreign import ccall unsafe " SSL_CTX_free" _ssl_ctx_free :: Ptr SSLContext_ -> IO ()
139+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L
140+ foreign import ccall unsafe " TLS_method" _ssl_method :: IO (Ptr SSLMethod_ )
141+ #else
139142foreign import ccall unsafe " SSLv23_method" _ssl_method :: IO (Ptr SSLMethod_ )
143+ #endif
140144
141145-- | Create a new SSL context.
142146context :: IO SSLContext
Original file line number Diff line number Diff line change 44#include "mutex.h"
55
66/* OpenSSL ********************************************************************/
7- void HsOpenSSL_OpenSSL_add_all_algorithms () {
7+ void HsOpenSSL_init () {
8+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L
9+ // OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
10+ // unnecessary in OpenSSL 1.1.0
11+ #else
12+ SSL_load_error_strings ();
813 OpenSSL_add_all_algorithms ();
14+ SSL_library_init ();
15+ #endif
916}
1017
1118void HsOpenSSL_OPENSSL_free (void * ptr ) {
Original file line number Diff line number Diff line change 3333#endif
3434
3535/* OpenSSL ********************************************************************/
36- void HsOpenSSL_OpenSSL_add_all_algorithms ();
36+ void HsOpenSSL_init ();
3737void HsOpenSSL_OPENSSL_free (void * ptr );
3838
3939/* BIO ************************************************************************/
You can’t perform that action at this time.
0 commit comments