73 lines
2.0 KiB
Diff
73 lines
2.0 KiB
Diff
From e59cce5af547cc4cbda2a1bce1eb2b89e959ae99 Mon Sep 17 00:00:00 2001
|
|
From: Juergen Christ <jchrist@linux.ibm.com>
|
|
Date: Mon, 21 Mar 2022 15:27:40 +0100
|
|
Subject: [PATCH] Fix compilation for OpenSSL 3.0
|
|
|
|
ECX_KEY structure as used by engine is not public API in OpenSSL 3.0 and
|
|
should not be included via a private header. This forced the engine to only
|
|
compile if the OpenSSL 3.0 source tree is present. While this might be the
|
|
cleaner solution, we now copy out the defines to be used. This makes the
|
|
engine compile even without OpenSSL 3.0 source tree.
|
|
|
|
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
|
|
---
|
|
src/engine/openssl-compat.h | 36 ++++++++++++++++++++++++++++--------
|
|
1 file changed, 28 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/openssl-compat.h b/src/openssl-compat.h
|
|
index 0013365b..aae40dab 100644
|
|
--- a/src/openssl-compat.h
|
|
+++ b/src/openssl-compat.h
|
|
@@ -19,9 +19,36 @@
|
|
|
|
#include <openssl/opensslv.h>
|
|
|
|
+typedef enum {
|
|
+ ECX_KEY_TYPE_X25519,
|
|
+ ECX_KEY_TYPE_X448,
|
|
+ ECX_KEY_TYPE_ED25519,
|
|
+ ECX_KEY_TYPE_ED448
|
|
+} ECX_KEY_TYPE;
|
|
+
|
|
#ifdef OPENSSL_VERSION_PREREQ
|
|
/* This is 3.x */
|
|
-#include <crypto/evp.h>
|
|
+
|
|
+# define X25519_KEYLEN 32
|
|
+# define X448_KEYLEN 56
|
|
+# define ED25519_KEYLEN 32
|
|
+# define ED448_KEYLEN 57
|
|
+
|
|
+# define MAX_KEYLEN ED448_KEYLEN
|
|
+
|
|
+typedef int CRYPTO_REF_COUNT;
|
|
+
|
|
+typedef struct ecx_key_st {
|
|
+ OSSL_LIB_CTX *libctx;
|
|
+ char *propq;
|
|
+ unsigned int haspubkey:1;
|
|
+ unsigned char pubkey[MAX_KEYLEN];
|
|
+ unsigned char *privkey;
|
|
+ size_t keylen;
|
|
+ ECX_KEY_TYPE type;
|
|
+ CRYPTO_REF_COUNT references;
|
|
+ CRYPTO_RWLOCK *lock;
|
|
+} ECX_KEY;
|
|
|
|
static inline ECX_KEY *ossl_ecx_key_new_simple(ECX_KEY_TYPE type)
|
|
{
|
|
@@ -94,13 +121,6 @@ typedef struct {
|
|
unsigned char *priv;
|
|
} ECX_KEY;
|
|
|
|
-typedef enum {
|
|
- ECX_KEY_TYPE_X25519,
|
|
- ECX_KEY_TYPE_X448,
|
|
- ECX_KEY_TYPE_ED25519,
|
|
- ECX_KEY_TYPE_ED448
|
|
-} ECX_KEY_TYPE;
|
|
-
|
|
static inline ECX_KEY *ossl_ecx_key_new_simple(ECX_KEY_TYPE type)
|
|
{
|
|
return calloc(1, sizeof(ECX_KEY));
|