Skip to content

Commit 69a27d8

Browse files
committed
engine: disable OpenSSL::Engine on OpenSSL 3.0
The entire ENGINE API is deprecated in OpenSSL 3.0 in favor of the new "Provider" concept. OpenSSL::Engine will not be defined when compiled with OpenSSL 3.0. We would need a way to interact with providers from Ruby programs, but since the concept is completely different from the ENGINE API, it will not be through the current OpenSSL::Engine interface.
1 parent 4699581 commit 69a27d8

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

ext/openssl/openssl_missing.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include RUBY_EXTCONF_H
1111

1212
#include <string.h> /* memcpy() */
13-
#if !defined(OPENSSL_NO_ENGINE)
14-
# include <openssl/engine.h>
15-
#endif
1613
#include <openssl/x509_vfy.h>
1714

1815
#include "openssl_missing.h"

ext/openssl/ossl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <ruby/io.h>
1919
#include <ruby/thread.h>
2020
#include <openssl/opensslv.h>
21+
2122
#include <openssl/err.h>
2223
#include <openssl/asn1.h>
2324
#include <openssl/x509v3.h>
@@ -30,9 +31,6 @@
3031
#include <openssl/ts.h>
3132
#endif
3233
#include <openssl/crypto.h>
33-
#if !defined(OPENSSL_NO_ENGINE)
34-
# include <openssl/engine.h>
35-
#endif
3634
#if !defined(OPENSSL_NO_OCSP)
3735
# include <openssl/ocsp.h>
3836
#endif
@@ -54,6 +52,10 @@
5452
(LIBRESSL_VERSION_NUMBER >= (maj << 28) | (min << 20) | (pat << 12))
5553
#endif
5654

55+
#if !defined(OPENSSL_NO_ENGINE) && !OSSL_OPENSSL_PREREQ(3, 0, 0)
56+
# define OSSL_USE_ENGINE
57+
#endif
58+
5759
/*
5860
* Common Module
5961
*/

ext/openssl/ossl_engine.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
*/
1010
#include "ossl.h"
1111

12-
#if !defined(OPENSSL_NO_ENGINE)
12+
#ifdef OSSL_USE_ENGINE
13+
# include <openssl/engine.h>
1314

1415
#define NewEngine(klass) \
1516
TypedData_Wrap_Struct((klass), &ossl_engine_type, 0)

ext/openssl/ossl_pkey.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
*/
1010
#include "ossl.h"
1111

12+
#ifdef OSSL_USE_ENGINE
13+
# include <openssl/engine.h>
14+
#endif
15+
1216
/*
1317
* Classes
1418
*/

0 commit comments

Comments
 (0)