Remove openssl engine method for loading the key
PATCH 1/1 Remove openssl engine method for loading the key
This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed to the proposed license chagne. He is also okay with removing with the feature from the current code base as it is obsolete with OpenSSL 3.0.
--- .gitignore | 4 - configure.ac | 1 - src/openvpn/crypto_openssl.c | 60 --------- src/openvpn/crypto_openssl.h | 12 -- src/openvpn/ssl_openssl.c | 4 - tests/unit_tests/Makefile.am | 3 - tests/unit_tests/engine-key/Makefile.am | 31 ----- .../engine-key/check_engine_keys.sh | 36 ------ tests/unit_tests/engine-key/libtestengine.c | 116 ------------------ tests/unit_tests/engine-key/openssl.cnf.in | 12 -- 10 files changed, 279 deletions(-) delete mode 100644 tests/unit_tests/engine-key/Makefile.am delete mode 100755 tests/unit_tests/engine-key/check_engine_keys.sh delete mode 100644 tests/unit_tests/engine-key/libtestengine.c delete mode 100644 tests/unit_tests/engine-key/openssl.cnf.in
.gitignore +0 -4
@@ -57,10 +57,6 @@ tests/t_client-*-20??????-??????/ t_client.rc t_client_ips.rc tests/unit_tests/**/*_testdriver -tests/unit_tests/engine-key/client.key -tests/unit_tests/engine-key/log.txt -tests/unit_tests/engine-key/openssl.cnf -tests/unit_tests/engine-key/passwd src/openvpn/openvpn include/openvpn-plugin.h
configure.ac +0 -1
@@ -1532,7 +1532,6 @@ AC_CONFIG_FILES([ tests/unit_tests/openvpn/Makefile tests/unit_tests/plugins/Makefile tests/unit_tests/plugins/auth-pam/Makefile - tests/unit_tests/engine-key/Makefile sample/Makefile ]) AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
src/openvpn/crypto_openssl.c +0 -60
66 lines not on this page · raw message
src/openvpn/crypto_openssl.h +0 -12
@@ -118,16 +118,4 @@ void crypto_print_openssl_errors(const unsigned int flags);msg ((flags), __VA_ARGS__); \ } while (false) -/** -* Load a key file from an engine -* -* @param file The engine file to load -* @param ui The UI method for the password prompt -* @param data The data to pass to the UI method -* -* @return The private key if successful or NULL if not -*/ -EVP_PKEY * -engine_load_key(const char *file, SSL_CTX *ctx); -#endif /* CRYPTO_OPENSSL_H_ */
src/openvpn/ssl_openssl.c +0 -4
@@ -1057,10 +1057,6 @@ tls_ctx_load_priv_file(struct tls_root_ctx *ctx, const char *priv_key_file, pkey =PEM_read_bio_PrivateKey (in,NULL ,SSL_CTX_get_default_passwd_cb (ctx->ctx),SSL_CTX_get_default_passwd_cb_userdata (ctx->ctx)); -if (!pkey) - { - pkey =engine_load_key (priv_key_file, ctx->ctx); - }if (!pkey || !SSL_CTX_use_PrivateKey (ssl_ctx, pkey)) {
tests/unit_tests/Makefile.am +0 -3
@@ -2,7 +2,4 @@ AUTOMAKE_OPTIONS = foreign if ENABLE_UNITTESTS SUBDIRS = example_test openvpn plugins -if OPENSSL_ENGINE -SUBDIRS += engine-key -endif endif
tests/unit_tests/engine-key/Makefile.am deleted +0 -31
@@ -1,31 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -check_LTLIBRARIES = libtestengine.la -conffiles = openssl.cnf -EXTRA_DIST = \ - openssl.cnf.in \ - check_engine_keys.sh - -TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \ - builddir="$(abs_builddir)"; \ - top_builddir="$(top_builddir)"; \ - top_srcdir="$(top_srcdir)"; \ - export srcdir builddir top_builddir top_srcdir; - -if !CROSS_COMPILING -TESTS = check_engine_keys.sh -endif -check_engine_keys.sh: $(conffiles) - -CLEANFILES = \ - client.key \ - passwd \ - log.txt \ - $(conffiles) - -openssl.cnf: $(srcdir)/openssl.cnf.in - sed "s|ABSBUILDDIR|$(abs_builddir)|" < $(srcdir)/openssl.cnf.in > $@ - -libtestengine_la_SOURCES = libtestengine.c -libtestengine_la_LDFLAGS = @TEST_LDFLAGS@ -rpath /lib -shrext .so -libtestengine_la_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
tests/unit_tests/engine-key/check_engine_keys.sh deleted +0 -36
@@ -1,36 +0,0 @@ -#!/bin/sh - -OPENSSL_CONF="${builddir}/openssl.cnf" -export OPENSSL_CONF - -password='AT3S4PASSWD' - -key="${builddir}/client.key" -pwdfile="${builddir}/passwd" - -# create an engine key for us -sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key} -echo "$password" > $pwdfile - -# our version of grep to output log.txt on failure in case it's an openssl -# error mismatch and the grep expression needs updating -loggrep() { - egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; } -} - -# note here we've induced a mismatch in the client key and the server -# cert which openvpn should report and die. Check that it does. Note -# also that this mismatch depends on openssl not openvpn, so it is -# somewhat fragile -${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-config-files/loopback-server --engine testengine --key ${key} --askpass $pwdfile > log.txt 2>&1 - -# first off check we died because of a key mismatch. If this doesn't -# pass, suspect openssl of returning different messages and update the -# test accordingly -loggrep '(x509 certificate routines:(X509_check_private_key)?:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; } - -# now look for the engine prints (these are under our control) -loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; } -loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; } -loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; } -exit 0
tests/unit_tests/engine-key/libtestengine.c deleted +0 -116
116 lines not on this page · raw message
tests/unit_tests/engine-key/openssl.cnf.in deleted +0 -12
@@ -1,12 +0,0 @@ -HOME = . -openssl_conf = openssl_init - -[req] -[openssl_init] -engines = engines_section - -[engines_section] -testengine = testengine_section - -[testengine_section] -dynamic_path = ABSBUILDDIR/.libs/libtestengine.so
Signature · 1 line
2.39.3 (Apple Git-145)
Quoted 2 lines · Arne Schwabe
This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed
"Bottomley"
Quoted 2 lines
to the proposed license chagne. He is also okay with removing with the feature from the current code base as it is obsolete with
superflouos "with"
Quoted 1 line
OpenSSL 3.0.
Should mention the original commit id.
Regards,
Signature · 1 line
Frank Lichtenheld
Frank Lichtenheld
Acked-byQuoted 6 lines · Frank Lichtenheld
Quoted 2 lines · Arne Schwabe
This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed
"Bottomley"
Quoted 8 lines
Quoted 2 lines
to the proposed license chagne. He is also okay with removing with the feature from the current code base as it is obsolete with
superflouos "with"
Quoted 1 line
OpenSSL 3.0.
Should mention the original commit id.
On the actual patch:
Regards,
Signature · 1 line
Frank Lichtenheld
Hi,
Quoted 5 lines · Arne Schwabe
This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed to the proposed license chagne. He is also okay with removing with the feature from the current code base as it is obsolete with OpenSSL 3.0.
JFTR, this patch breaks CentOS 7 and OpenBSD 6.8 builds, so I assume "it breaks OpenSSL 1.0.2 builds".
So, alas, NAK... :-(
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Turns out it compiles just fine across all platforms, and I must have gotten confused by a parallel build (by gerrit...) triggering errors that looked related to "SSL things", assuming it must have been this patch...
Manually tested it on OpenBSD 6.8 with LibreSSL, and via GH/buildbot on all the rest of the zoo.
Your patch has been applied to the master and release/2.6 branch.
commit e7427bcbb9b16b52d81c65b01d440a8ecd1e6ea7 (master) commit 8bbc2926e620bcf995e6697e614a2716b572c07d (release/2.6)
Author: Arne Schwabe Date: Fri Oct 6 13:19:10 2023 +0200
Remove openssl engine method for loading the key
Signed-off-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27133.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering