aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2023-12-06 12:14:03 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2023-12-06 12:14:03 -0500
commit1a8d8edc0cdb59c400ad73c55d463349c2834268 (patch)
tree776c65ffdb9fc497948dca70581c08d32cc728c0
parent310acdb8a592bde39ee2a20d696410ef02df4108 (diff)
downloadopenssl-pkcs11-export-1a8d8edc0cdb59c400ad73c55d463349c2834268.tar.gz
Add support for openssl-3
Detect being built with openssl-3 and build with the 1.1 API to prevent deprecation warnings breaking the build. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac11
-rw-r--r--tests/Makefile.am3
3 files changed, 13 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 43ed0a2..7927d39 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,7 @@ pkcs11_configs_DATA = openssl-pkcs11-export.module
openssl_pkcs11_export_la_LDFLAGS= -module -no-undefined -avoid-version -shared
openssl_pkcs11_export_la_SOURCES= pkcs11.c ini.c openssl-pkcs11.h cache.c crypto.c crypto.h crypto-rsa.c crypto-ec.c
-openssl_pkcs11_export_la_CFLAGS = $(CFLAGS) $(CRYPTO_CFLAGS) $(P11KIT_CFLAGS) -Werror -Wall
+openssl_pkcs11_export_la_CFLAGS = $(CFLAGS) $(DEPRECATION) $(CRYPTO_CFLAGS) $(P11KIT_CFLAGS) -Werror -Wall
openssl_pkcs11_export_la_LIBADD = $(CRYPTO_LIBS)
SUBDIRS = tests
diff --git a/configure.ac b/configure.ac
index 256479c..d205e66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,10 @@ AC_SYS_LARGEFILE
AC_PROG_LIBTOOL
AC_PROG_LN_S
-PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.0.2])
+PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 3.0.0],
+ [ac_have_openssl3=1],
+ [PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.0.2])])
+
# OAEP definitions are missing from earlier p11-kit
PKG_CHECK_MODULES([P11KIT], [p11-kit-1 >= 0.23.3])
AC_CHECK_PROGS([A2X], [a2x])
@@ -25,6 +28,12 @@ AM_CONDITIONAL([TEST_SIGN], [test x$test_sign = "xyes"])
AM_COND_IF([TEST_SIGN],, [AC_MSG_WARN([p11tool is too old to run test signing])])
+AM_CONDITIONAL(HAVE_OPENSSL3, test "$ac_have_openssl3" = "1")
+if test -n "$ac_have_openssl3"; then
+ DEPRECATION="-DOPENSSL_API_COMPAT=0x10100000L"
+fi
+AC_SUBST(DEPRECATION)
+
AC_ARG_WITH(
[pkcs11-dir],
[AS_HELP_STRING([--with-pkcs11-dir], [default PKCS11 module directory])],
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 446718e..59b0062 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,4 +25,5 @@ testengine_la_SOURCES = testengine.c
# shared libraries
##
testengine_la_LDFLAGS = -shared -no-undefined -avoid-version -module -rpath /
-testengine_la_CFLAGS = -Wall -Werror
+testengine_la_LIBADD = $(CRYPTO_LIBS)
+testengine_la_CFLAGS = $(DEPRECATION) -Wall -Werror