[Bug 4068] New: configure doesn't set OPENSSL_API_COMPAT when cross compiling

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Thu Nov 26 22:45:01 AEDT 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=4068

            Bug ID: 4068
           Summary: configure doesn't set OPENSSL_API_COMPAT when cross
                    compiling
           Product: Portable OpenSSH
           Version: -current
          Hardware: PPC
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Build system
          Assignee: unassigned-bugs at mindrot.org
          Reporter: keragez at gmail.com

Created attachment 4039
  --> https://bugzilla.mindrot.org/attachment.cgi?id=4039&action=edit
fix openssl api compat cross patch

For OpenSSL 3 and 4, configure adds -DOPENSSL_API_COMPAT=0x10100000L
so that the OpenSSL headers don't mark the 1.1 API functions OpenSSH
uses as deprecated. This happens inside the "OpenSSL library version"
check, which is an AC_RUN_IFELSE test. When cross compiling, that test
is skipped:

  checking OpenSSL library version... configure: WARNING: cross
  compiling: not checking

so the flag is never set. The build then reports a
-Wdeprecated-declarations warning for every use of RSA_*, EC_KEY_*,
DH_* and AES_*, for example:

  ssh-rsa.c: warning: 'RSA_free' is deprecated: Since OpenSSL 3.0
  [-Wdeprecated-declarations]

On a 32-bit PowerPC cross build against OpenSSL 3.6 that's 368 of the
build's 396 warnings.

Steps to reproduce:

  Cross compile against OpenSSL 3, e.g.
    ./configure --build=x86_64-pc-linux-gnu --host=powerpc-linux-gnu
...
  Configure prints "cross compiling: not checking" for the OpenSSL
  library version, OPENSSL_API_COMPAT isn't in CPPFLAGS, and the build
  shows the deprecation warnings.

Proposed fix (patch attached, also at
https://github.com/keragez/openssh-portable/tree/fix-openssl-api-compat-cross):

In the cross compiling branch of the check, read the major version
from <openssl/opensslv.h> with AC_COMPUTE_INT (compile tests only) and
set OPENSSL_API_COMPAT for OpenSSL 3 and 4, as the native branch does:

  checking OpenSSL library version... cross compiling: checking headers
  checking OpenSSL major version in headers... 3

Native builds aren't affected. LibreSSL (major version 2) and OpenSSL
1.1.1 (major version 1) don't get the flag, as before. The
minimum-version check and the x86_64 OpenSSL 3.0.4 check still need
the exact library version and stay skipped when cross compiling.

Tested: forced cross configure against OpenSSL 3.6.5 headers (major
version 3, flag set) and against stub headers for LibreSSL and OpenSSL
1.1.1 (no flag), and a full cross build for powerpc-e500v2-linux-gnu
with glibc 2.42, GCC 14.3 and OpenSSL 3.6.5 (flag on every compile
line, warnings 396 -> 28, none of them deprecation warnings).

GitHub CI on my fork:   
https://github.com/keragez/openssh-portable/actions/runs/45680638784
GitHub CI VM on my fork:
https://github.com/keragez/openssh-portable/actions/runs/45680638787

Werror jobs fail on ssh-keygen.c:1375 (-Wmaybe-uninitialized),
introduced upstream by 4c3e65f18 and unrelated to this change.

Found while cleaning up compiler warnings in a cross build for 32-bit
PowerPC (e500v2). Analysis and the patch were done with the help of
Claude (Opus 5.5); I reviewed the change and verified it on the cross
build as described above.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list