]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Factor out OpenSSL install and test more versions.
authorDarren Tucker <dtucker@dtucker.net>
Mon, 22 Sep 2025 05:26:17 +0000 (15:26 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Mon, 22 Sep 2025 08:21:05 +0000 (18:21 +1000)
Move OpenSSL installation into its own script with a "-a" option to
install the "next" version to test for ABI compatibility.

.github/install_libcrypto.sh [new file with mode: 0755]
.github/run_test.sh
.github/setup_ci.sh
.github/workflows/c-cpp.yml

diff --git a/.github/install_libcrypto.sh b/.github/install_libcrypto.sh
new file mode 100755 (executable)
index 0000000..c2e4380
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Install specified libcrypto.
+#  -a : install version for ABI compatibility test.
+#  -n : dry run, don't actually build and install.
+#
+# Usage: $0 [-a] [-n] openssl-$branch/tag destdir [config options]
+
+set -e
+
+bincompat_test=""
+dryrun=""
+while [ "$1" = "-a" ] || [ "$1" = "-n" ]; do
+       if [ "$1" = "-a" ]; then
+               abi_compat_test=y
+       elif [ "$1" = "-n" ]; then
+               dryrun="echo dryrun:"
+       fi
+       shift
+done
+
+ver="$1"
+destdir="$2"
+opts="$3"
+
+if [ -z "${ver}" ] || [ -z "${destdir}" ]; then
+       echo tag/branch and destdir required
+       exit 1
+fi
+
+set -x
+
+cd ${HOME}
+[ -d ${HOME}/openssl ] || git clone https://github.com/openssl/openssl.git
+cd ${HOME}/openssl
+git fetch --all
+
+if [ "${abi_compat_test}" = "y" ]; then
+       echo selecting ABI test release/branch for ${ver}
+       case "${ver}" in
+       openssl-3.6)
+               ver=openssl-3.0.0
+               echo "selecting older release ${ver}"
+               ;;
+       openssl-3.[012345])
+               major=$(echo ${ver} | cut -f1 -d.)
+               minor=$(echo ${ver} | cut -f2 -d.)
+               ver="${major}.$((${minor} + 1))"
+               echo selecting next release branch ${ver}
+               ;;
+       openssl-3.*.*)
+               major=$(echo ${ver} | cut -f1 -d.)
+               minor=$(echo ${ver} | cut -f2 -d.)
+               patch=$(echo ${ver} | cut -f3 -d.)
+               ver="${major}.${minor}.$((${patch} + 1))"
+               echo checking for release tag ${ver}
+               if git tag | grep -q "^${ver}\$"; then
+                       echo selected next patch release ${ver}
+               else
+                       ver="${major}.${minor}"
+                       echo not found, selecting release branch ${ver}
+               fi
+               ;;
+       esac
+fi
+
+git checkout ${ver}
+make clean >/dev/null 2>&1 || true
+${dryrun} ./config no-threads shared ${opts} --prefix=${destdir}
+${dryrun} make -j4
+${dryrun} sudo make install_sw
index bf3f3c9514a944d0b818d7895e222c51f86ea7d9..bd6fb7b7b3e1087b6cc19ad517117d092b028215 100755 (executable)
@@ -41,17 +41,6 @@ else
     ${env} make ${TEST_TARGET} SKIP_LTESTS="${SKIP_LTESTS}" LTESTS="${LTESTS}"
 fi
 
-# Replace our self-built with the distro-provided one before running the tests
-# again.
-case "$1" in
-    openssl-3.*)
-       ${SUDO} cp /lib/x86_64-linux-gnu/libcrypto.so.3 /opt/openssl/lib64/libcrypto.so.3
-       if [ -z "${TEST_SSH_SSHD_CONFOPTS}" ]; then
-               SSHD_CONFOPTS=AcceptEnv=OpenSSL3_ABI_Test
-       fi
-       ;;
-esac
-
 if [ ! -z "${SSHD_CONFOPTS}" ]; then
     echo "rerunning t-exec with TEST_SSH_SSHD_CONFOPTS='${SSHD_CONFOPTS}'"
     if [ -z "${LTESTS}" ]; then
index ff1de0bcae868412e5721dbd2c474f18e798422b..10ff77badbef9c1e8ca3c7f424f25e5adf82a42b 100755 (executable)
@@ -225,13 +225,8 @@ if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
 fi
 
 if [ ! -z "${INSTALL_OPENSSL}" ]; then
-    (cd ${HOME} &&
-     git clone https://github.com/openssl/openssl.git &&
-     cd ${HOME}/openssl &&
-     git checkout ${INSTALL_OPENSSL} &&
-     ./config no-threads shared ${SSLCONFOPTS} \
-         --prefix=/opt/openssl &&
-     make -j4 && sudo make install_sw)
+       .github/install_libcrypto.sh \
+           "${INSTALL_OPENSSL}" /opt/openssl "${SSLCONFOPTS}"
 fi
 
 if [ ! -z "${INSTALL_LIBRESSL}" ]; then
index c3684f9a5f4dc0e2e2db774239753f55e0dbbcb8..7bda9d5b3edffa7f30aa0139a2469722af4d7e8f 100644 (file)
@@ -164,6 +164,11 @@ jobs:
         TEST_SSH_UNSAFE_PERMISSIONS: 1
         TEST_SSH_HOSTBASED_AUTH: yes
         LTESTS: ${{ vars.LTESTS }}
+    - name: test OpenSSL3 ABI compatibility
+      if: ${{ startsWith(matrix.config, 'openssl-3') }}
+      run: |
+       sh .github/install_libcrypto.sh -a ${{ matrix.config }} /opt/openssl
+       sh .github/run_test.sh ${{ matrix.config }}
     - name: show logs
       if: failure()
       run: for i in regress/failed*.log; do echo ====; echo logfile $i; echo =====; cat $i; done