File tree 3 files changed +20
-3
lines changed
3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef OPENSSL_NO_ENGINE
1
2
#include <openssl/engine.h>
2
3
#include <openssl/crypto.h>
3
4
#include <openssl/opensslv.h>
@@ -39,3 +40,4 @@ int main()
39
40
40
41
return 0 ;
41
42
}
43
+ #endif
Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ OSSLCryptoFactory::OSSLCryptoFactory()
141
141
// Initialise OpenSSL
142
142
OpenSSL_add_all_algorithms ();
143
143
144
+ // Initialise the one-and-only RNG
145
+ rng = new OSSLRNG ();
146
+
147
+ #ifndef OPENSSL_NO_ENGINE
148
+
144
149
#if !( OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) )
145
150
// Make sure RDRAND is loaded first
146
151
ENGINE_load_rdrand ();
@@ -221,13 +226,13 @@ OSSLCryptoFactory::OSSLCryptoFactory()
221
226
eg = NULL ;
222
227
return ;
223
228
#endif
229
+ #endif // OPENSSL_NO_ENGINE
224
230
}
225
231
226
232
// Destructor
227
233
OSSLCryptoFactory::~OSSLCryptoFactory ()
228
234
{
229
235
bool ossl_shutdown = false ;
230
-
231
236
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
232
237
// OpenSSL 1.1.0+ will register an atexit() handler to run
233
238
// OPENSSL_cleanup(). If that has already happened we must
@@ -243,6 +248,7 @@ OSSLCryptoFactory::~OSSLCryptoFactory()
243
248
#endif
244
249
if (!ossl_shutdown)
245
250
{
251
+ #ifndef OPENSSL_NO_ENGINE
246
252
#ifdef WITH_GOST
247
253
// Finish the GOST engine
248
254
if (eg != NULL )
@@ -257,7 +263,7 @@ OSSLCryptoFactory::~OSSLCryptoFactory()
257
263
ENGINE_finish (rdrand_engine);
258
264
ENGINE_free (rdrand_engine);
259
265
rdrand_engine = NULL ;
260
-
266
+ # endif // OPENSSL_NO_ENGINE
261
267
// Recycle locks
262
268
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
263
269
if (setLockingCallback)
Original file line number Diff line number Diff line change 42
42
#include " RNG.h"
43
43
#include < memory>
44
44
#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
46
55
47
56
class OSSLCryptoFactory : public CryptoFactory
48
57
{
You can’t perform that action at this time.
0 commit comments