File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1+ #ifndef OPENSSL_NO_ENGINE
12#include <openssl/engine.h>
23#include <openssl/crypto.h>
34#include <openssl/opensslv.h>
@@ -39,3 +40,4 @@ int main()
3940
4041 return 0 ;
4142}
43+ #endif
Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ OSSLCryptoFactory::OSSLCryptoFactory()
141141 // Initialise OpenSSL
142142 OpenSSL_add_all_algorithms ();
143143
144+ // Initialise the one-and-only RNG
145+ rng = new OSSLRNG ();
146+
147+ #ifndef OPENSSL_NO_ENGINE
148+
144149#if !( OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) )
145150 // Make sure RDRAND is loaded first
146151 ENGINE_load_rdrand ();
@@ -221,13 +226,13 @@ OSSLCryptoFactory::OSSLCryptoFactory()
221226 eg = NULL ;
222227 return ;
223228#endif
229+ #endif // OPENSSL_NO_ENGINE
224230}
225231
226232// Destructor
227233OSSLCryptoFactory::~OSSLCryptoFactory ()
228234{
229235 bool ossl_shutdown = false ;
230-
231236#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
232237 // OpenSSL 1.1.0+ will register an atexit() handler to run
233238 // OPENSSL_cleanup(). If that has already happened we must
@@ -243,6 +248,7 @@ OSSLCryptoFactory::~OSSLCryptoFactory()
243248#endif
244249 if (!ossl_shutdown)
245250 {
251+ #ifndef OPENSSL_NO_ENGINE
246252#ifdef WITH_GOST
247253 // Finish the GOST engine
248254 if (eg != NULL )
@@ -257,7 +263,7 @@ OSSLCryptoFactory::~OSSLCryptoFactory()
257263 ENGINE_finish (rdrand_engine);
258264 ENGINE_free (rdrand_engine);
259265 rdrand_engine = NULL ;
260-
266+ # endif // OPENSSL_NO_ENGINE
261267 // Recycle locks
262268#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
263269 if (setLockingCallback)
Original file line number Diff line number Diff line change 4242#include " RNG.h"
4343#include < memory>
4444#include < openssl/conf.h>
45- #include < openssl/engine.h>
45+ #if OPENSSL_VERSION_MAJOR >= 3
46+ # define USE_PKCS11_PROVIDER
47+ # include < openssl/provider.h>
48+ # include < openssl/store.h>
49+ #else
50+ # if !defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0)
51+ # define USE_PKCS11_ENGINE
52+ # include < openssl/engine.h>
53+ # endif
54+ #endif
4655
4756class OSSLCryptoFactory : public CryptoFactory
4857{
You can’t perform that action at this time.
0 commit comments