Skip to content

Commit f3ecd64

Browse files
venkatesh6911yselkowitz
authored andcommitted
Fix build with OPENSSL_NO_ENGINE
The ENGINE APIs are deprecated in OpenSSL v3, and Fedora 41 and RHEL 10 no longer ship the openssl/engine.h header by default. This allows the build to succeed as a provider without engine.h present. Signed-off-by: Venkatesh J <venkatesh.j@intel.com> Co-authored-by: Yaakov Selkowitz <yselkowi@redhat.com>
1 parent af75fd1 commit f3ecd64

21 files changed

+85
-31
lines changed

e_qat.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ clock_t clock_id = CLOCK_MONOTONIC_RAW;
350350
clock_t clock_id = CLOCK_MONOTONIC_PRECISE;
351351
#endif
352352

353-
#ifndef QAT_BORINGSSL
353+
#if ! defined(QAT_BORINGSSL) && ! defined(QAT_OPENSSL_PROVIDER)
354354
const ENGINE_CMD_DEFN qat_cmd_defns[] = {
355355
{
356356
QAT_CMD_ENABLE_EXTERNAL_POLLING,
@@ -747,6 +747,7 @@ int qat_engine_finish(ENGINE *e)
747747
* ENGINE_init
748748
******************************************************************************/
749749

750+
#ifndef QAT_OPENSSL_PROVIDER
750751
int qat_engine_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
751752
{
752753
unsigned int retVal = 1;
@@ -1052,6 +1053,7 @@ int qat_engine_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
10521053
}
10531054
return retVal;
10541055
}
1056+
#endif /* QAT_OPENSSL_PROVIDER */
10551057

10561058
#ifdef ENABLE_QAT_HW_KPT
10571059
EVP_PKEY *qat_engine_load_privkey(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data)
@@ -1417,6 +1419,7 @@ int bind_qat(ENGINE *e, const char *id)
14171419
return ret;
14181420
}
14191421

1422+
#ifndef QAT_OPENSSL_PROVIDER
14201423
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
14211424
IMPLEMENT_DYNAMIC_BIND_FN(bind_qat)
14221425
IMPLEMENT_DYNAMIC_CHECK_FN()
@@ -1499,4 +1502,5 @@ void ENGINE_unload_qat(void)
14991502
}
15001503
}
15011504
#endif /* QAT_BORINGSSL */
1505+
#endif /* QAT_OPENSSL_PROVIDER */
15021506
#endif

e_qat.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
#ifndef E_QAT_H
4747
# define E_QAT_H
4848

49-
# include <openssl/engine.h>
49+
# ifndef QAT_OPENSSL_PROVIDER
50+
# include <openssl/engine.h>
51+
# endif
52+
# include <openssl/ec.h>
53+
# include <openssl/err.h>
5054
# include <sys/types.h>
5155
# include <unistd.h>
5256
# include <string.h>

qat_evp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
# define QAT_EVP_H
4848

4949

50-
# include <openssl/engine.h>
5150
# include <openssl/ossl_typ.h>
5251
# include "e_qat.h"
5352

qat_fips.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
# include <openssl/rand.h>
8787
# include <openssl/sha.h>
8888
# include <openssl/err.h>
89-
# include <openssl/engine.h>
9089
# include <openssl/evp.h>
9190
# include <openssl/async.h>
9291
# include <openssl/e_os2.h>

qat_hw_ccm.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
#ifndef QAT_HW_CCM_H
4747
# define QAT_HW_CCM_H
4848

49-
# include <openssl/engine.h>
49+
# ifndef QAT_OPENSSL_PROVIDER
50+
# include <openssl/engine.h>
51+
# endif
52+
# include <openssl/evp.h>
5053

5154
# include "cpa.h"
5255
# include "cpa_types.h"

qat_hw_ciphers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848

4949
# ifdef QAT_HW
5050

51-
# include <openssl/engine.h>
51+
# ifndef QAT_OPENSSL_PROVIDER
52+
# include <openssl/engine.h>
53+
# endif
5254
# include <openssl/ssl.h>
5355
# include <openssl/crypto.h>
5456
# include <openssl/aes.h>

qat_hw_ecx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@
5151
#include <signal.h>
5252
#include <stdarg.h>
5353

54-
#include "openssl/ossl_typ.h"
55-
#include "openssl/kdf.h"
56-
#include "openssl/evp.h"
57-
#include "openssl/ssl.h"
54+
#include <openssl/ossl_typ.h>
55+
#include <openssl/kdf.h>
56+
#include <openssl/evp.h>
57+
#include <openssl/rand.h>
58+
#include <openssl/ssl.h>
5859
#include "e_qat.h"
5960
#include "qat_utils.h"
6061
#include "qat_hw_asym_common.h"

qat_hw_gcm.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
#ifndef QAT_HW_GCM_H
4747
#define QAT_HW_GCM_H
4848

49-
# include <openssl/engine.h>
49+
# ifndef QAT_OPENSSL_PROVIDER
50+
# include <openssl/engine.h>
51+
# endif
52+
# include <openssl/evp.h>
5053

5154
# include "cpa.h"
5255
# include "cpa_types.h"

qat_hw_init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ int qat_use_signals(void)
128128
been initialised then there will be a further check within
129129
qat_engine_init inside a mutex to prevent a race condition. */
130130

131+
#ifndef QAT_OPENSSL_PROVIDER
131132
if (unlikely(!engine_inited)) {
132133
ENGINE* e = ENGINE_by_id(engine_qat_id);
133134

@@ -146,6 +147,7 @@ int qat_use_signals(void)
146147
ENGINE_free(e);
147148
ENGINE_QAT_PTR_RESET();
148149
}
150+
#endif
149151

150152
return qat_use_signals_no_engine_start();
151153
}
@@ -226,6 +228,7 @@ int get_instance(int inst_type, int mem_type)
226228

227229
unsigned int inst_count = 0;
228230
thread_local_variables_t * tlv = NULL;
231+
#ifndef QAT_OPENSSL_PROVIDER
229232
/* See qat_use_signals() above for more info on why it is safe to
230233
check engine_inited outside of a mutex in this case. */
231234
if (unlikely(!engine_inited)) {
@@ -245,6 +248,7 @@ int get_instance(int inst_type, int mem_type)
245248
ENGINE_free(e);
246249
ENGINE_QAT_PTR_RESET();
247250
}
251+
#endif
248252

249253
tlv = qat_check_create_local_variables();
250254
if (unlikely(NULL == tlv)) {

qat_hw_sha3.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
#ifndef QAT_HW_SHA3_H
4747
# define QAT_HW_SHA3_H
4848

49-
# include <openssl/engine.h>
49+
# ifndef QAT_OPENSSL_PROVIDER
50+
# include <openssl/engine.h>
51+
# endif
52+
# include <openssl/evp.h>
5053

5154
# include "cpa.h"
5255
# include "cpa_types.h"

0 commit comments

Comments
 (0)