Source: cl-plus-ssl
Version: 20251220.gite9de2ca-1build1
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: origin-ubuntu tenacious ubuntu-patch
Hi,
cl-plus-ssl doesn't work with OpenSSL 4 (4.0.3-1 in experimental, the
default in Ubuntu tenacious). It fails to load:
Unable to load any of the alternatives:
("libcrypto.so.3" "libcrypto.so.1.1" "libcrypto.so.1.0.0" "libcrypto.so")
The attached debdiff fixes it with three patches:
- openssl4-library-names.patch: try libssl.so.4/libcrypto.so.4 first.
- Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch: hostname
verification calls ASN1_STRING_data(), removed in OpenSSL 4
(upstream PR #202).
- no-shutdown-after-fatal-error.patch: CLOSE called SSL_shutdown()
after SSL_ERROR_SSL, which OpenSSL 4 makes fail, breaking the
READ-DEADLINE-NIL test.
The first and last are forwarded upstream as
https://github.com/cl-plus-ssl/cl-plus-ssl/pull/204
With the patches the sbcl autopkgtest passes in Ubuntu with OpenSSL
4.0.3, and the suite still passes against OpenSSL 3.
Unstable still has OpenSSL 3.6, so severity normal for now.
Thanks,
Sebastien Bacher
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500,
'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-43-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru cl-plus-ssl-20251220.gite9de2ca/debian/changelog
cl-plus-ssl-20251220.gite9de2ca/debian/changelog
--- cl-plus-ssl-20251220.gite9de2ca/debian/changelog 2026-04-25
11:07:48.000000000 +0200
+++ cl-plus-ssl-20251220.gite9de2ca/debian/changelog 2026-11-09
23:06:29.000000000 +0100
@@ -1,3 +1,17 @@
+cl-plus-ssl (20251220.gite9de2ca-2) UNRELEASED; urgency=medium
+
+ * Fix loading and hostname verification with OpenSSL 4:
+ - d/p/Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch: cherry-pick
+ from upstream PR, ASN1_STRING_data() was removed in OpenSSL 4
+ - d/p/openssl4-library-names.patch: try libssl.so.4 and
+ libcrypto.so.4 first, only the OpenSSL 3 and older sonames were
+ tried so the library failed to load with OpenSSL 4
+ - d/p/no-shutdown-after-fatal-error.patch: don't call SSL_shutdown()
+ when closing a stream after a fatal SSL error, OpenSSL 4 makes it
+ fail and CLOSE signalled a second error (READ-DEADLINE-NIL test)
+
+ -- Sebastien Bacher <[email protected]> Mon, 09 Nov 2026
23:06:29 +0100
+
cl-plus-ssl (20251220.gite9de2ca-1) unstable; urgency=medium
[ Sean Whitton ]
diff -Nru
cl-plus-ssl-20251220.gite9de2ca/debian/patches/Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch
cl-plus-ssl-20251220.gite9de2ca/debian/patches/Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch
---
cl-plus-ssl-20251220.gite9de2ca/debian/patches/Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch
1970-01-01 01:00:00.000000000 +0100
+++
cl-plus-ssl-20251220.gite9de2ca/debian/patches/Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch
2026-11-09 23:06:26.000000000 +0100
@@ -0,0 +1,34 @@
+From: Eitaro Fukamachi <[email protected]>
+Date: Fri, 9 Oct 2026 06:01:31 +0900
+Subject: Use ASN1_STRING_get0_data on OpenSSL 1.1.0+
+
+OpenSSL 4.0 removed the deprecated ASN1_STRING_data(), so hostname
+verification fails with "The alien function ASN1_STRING_data is
+undefined". ASN1_STRING_get0_data() has been available since 1.1.0.
+Origin: upstream, https://github.com/cl-plus-ssl/cl-plus-ssl/pull/202
+Last-Update: 2026-11-08
+---
+--- a/src/ffi.lisp
++++ b/src/ffi.lisp
+@@ -888,10 +888,20 @@ Note: the _really_ old formats (<= 0.9.4
+ :void
+ (general-names :pointer))
+
+-(define-crypto-function ("ASN1_STRING_data" asn1-string-data)
++(define-crypto-function-ex (:vanished "4.0.0") ("ASN1_STRING_data"
asn1-string-data-legacy)
+ :pointer
+ (asn1-string :pointer))
+
++(define-crypto-function-ex (:since "1.1.0") ("ASN1_STRING_get0_data"
asn1-string-get0-data)
++ :pointer
++ (asn1-string :pointer))
++
++(defun asn1-string-data (asn1-string)
++ (if (and (not (libresslp))
++ (openssl-is-at-least 1 1))
++ (asn1-string-get0-data asn1-string)
++ (asn1-string-data-legacy asn1-string)))
++
+ (define-crypto-function ("ASN1_STRING_length" asn1-string-length)
+ :int
+ (asn1-string :pointer))
diff -Nru
cl-plus-ssl-20251220.gite9de2ca/debian/patches/no-shutdown-after-fatal-error.patch
cl-plus-ssl-20251220.gite9de2ca/debian/patches/no-shutdown-after-fatal-error.patch
---
cl-plus-ssl-20251220.gite9de2ca/debian/patches/no-shutdown-after-fatal-error.patch
1970-01-01 01:00:00.000000000 +0100
+++
cl-plus-ssl-20251220.gite9de2ca/debian/patches/no-shutdown-after-fatal-error.patch
2026-11-09 23:06:26.000000000 +0100
@@ -0,0 +1,60 @@
+Description: Don't call SSL_shutdown() after a fatal error
+ SSL_shutdown(3) says it must not be called after SSL_get_error() returned
+ SSL_ERROR_SSL or SSL_ERROR_SYSCALL. cl+ssl still did that when closing a
+ stream after such an error, for example after a deadline expired in the
+ Lisp BIO while reading. OpenSSL 3 tolerated it, OpenSSL 4 makes that
+ SSL_shutdown() call fail with SSL_ERROR_SSL and an empty error queue, so
+ CLOSE signals a second, confusing error. That breaks the READ-DEADLINE-NIL
+ test.
+ .
+ Remember on the stream when an OpenSSL call failed that way and skip
+ FORCE-OUTPUT and SSL_shutdown() in CLOSE in that case.
+Author: Sebastien Bacher <[email protected]>
+Forwarded: https://github.com/cl-plus-ssl/cl-plus-ssl/pull/204
+Last-Update: 2026-11-09
+---
+--- a/src/ssl-funcall.lisp
++++ b/src/ssl-funcall.lisp
+@@ -155,6 +155,8 @@
+ (ssl-get-fd handle)
+ (ssl-stream-deadline stream)))
+ (t
++ (when (member error '(#.+ssl-error-ssl+ #.+ssl-error-syscall+))
++ (setf (slot-value stream 'fatal-error-p) t))
+ (ssl-signal-error handle func error ret)))))))
+
+ (declaim (inline nonblocking-ssl-funcall))
+@@ -170,5 +172,7 @@
+ ((#.+ssl-error-want-read+ #.+ssl-error-want-write+)
+ (return ret))
+ (t
++ (when (member error '(#.+ssl-error-ssl+ #.+ssl-error-syscall+))
++ (setf (slot-value stream 'fatal-error-p) t))
+ (ssl-signal-error handle func error ret)))))))
+
+--- a/src/streams.lisp
++++ b/src/streams.lisp
+@@ -46,7 +46,13 @@
+ :accessor ssl-stream-input-buffer)
+ (peeked-byte
+ :initform nil
+- :accessor ssl-stream-peeked-byte)))
++ :accessor ssl-stream-peeked-byte)
++ (fatal-error-p
++ :initform nil
++ :accessor ssl-stream-fatal-error-p
++ :documentation "Set when an OpenSSL call on this stream failed with
++SSL_ERROR_SSL or SSL_ERROR_SYSCALL. SSL_shutdown must not be called
++after such an error, see the SSL_shutdown(3) man page.")))
+
+ (defmethod initialize-instance :after ((stream ssl-stream)
+ &key
+@@ -77,7 +83,7 @@
+ (defmethod close ((stream ssl-stream) &key abort)
+ (cond
+ ((ssl-stream-handle stream)
+- (unless abort
++ (unless (or abort (ssl-stream-fatal-error-p stream))
+ (force-output stream)
+ (ensure-ssl-funcall stream
+ (complement #'minusp)
diff -Nru
cl-plus-ssl-20251220.gite9de2ca/debian/patches/openssl4-library-names.patch
cl-plus-ssl-20251220.gite9de2ca/debian/patches/openssl4-library-names.patch
--- cl-plus-ssl-20251220.gite9de2ca/debian/patches/openssl4-library-names.patch
1970-01-01 01:00:00.000000000 +0100
+++ cl-plus-ssl-20251220.gite9de2ca/debian/patches/openssl4-library-names.patch
2026-11-09 23:06:26.000000000 +0100
@@ -0,0 +1,32 @@
+Description: Try the OpenSSL 4 library names first
+ OpenSSL 4 ships libssl.so.4 and libcrypto.so.4, but on Linux and other
+ Unix systems cl+ssl only tries libssl.so.3 and older sonames, then the
+ unversioned libssl.so that is only there when libssl-dev is installed.
+ On a system with only OpenSSL 4 loading fails with
+ "Unable to load any of the alternatives: ("libcrypto.so.3" ...)".
+Author: Sebastien Bacher <[email protected]>
+Forwarded: https://github.com/cl-plus-ssl/cl-plus-ssl/pull/204
+Last-Update: 2026-11-08
+---
+--- a/src/reload.lisp
++++ b/src/reload.lisp
+@@ -140,7 +140,8 @@ sudo rm /usr/local/lib/libcrypto.dylib /
+ ;; https://github.com/cl-plus-ssl/cl-plus-ssl/pull/115
+ "libcrypto.dylib"
+ "/usr/lib/libcrypto.dylib"))
+- ((and :unix (not :cygwin)) (:or "libcrypto.so.3"
++ ((and :unix (not :cygwin)) (:or "libcrypto.so.4"
++ "libcrypto.so.3"
+ "libcrypto.so.1.1"
+ "libcrypto.so.1.0.0"
+ "libcrypto.so"))
+@@ -180,7 +181,8 @@ sudo rm /usr/local/lib/libcrypto.dylib /
+ ;; so we can just use just "libssl.so".
+ ;; More info at https://github.com/cl-plus-ssl/cl-plus-ssl/pull/2.
+ (:openbsd "libssl.so")
+- ((and :unix (not :cygwin)) (:or "libssl.so.3"
++ ((and :unix (not :cygwin)) (:or "libssl.so.4"
++ "libssl.so.3"
+ "libssl.so.1.1"
+ "libssl.so.1.0.2m"
+ "libssl.so.1.0.2k"
diff -Nru cl-plus-ssl-20251220.gite9de2ca/debian/patches/series
cl-plus-ssl-20251220.gite9de2ca/debian/patches/series
--- cl-plus-ssl-20251220.gite9de2ca/debian/patches/series 2026-04-25
11:07:48.000000000 +0200
+++ cl-plus-ssl-20251220.gite9de2ca/debian/patches/series 2026-11-09
23:06:26.000000000 +0100
@@ -1,2 +1,5 @@
no-coveralls.patch
ecl-failing-tests.patch
+Use-ASN1_STRING_get0_data-on-OpenSSL-1.1.0.patch
+openssl4-library-names.patch
+no-shutdown-after-fatal-error.patch