Skip to content

Add openssh 10.5p1 patch for wolfSSL - #359

Open
julek-wolfssl wants to merge 3 commits into
wolfSSL:masterfrom
julek-wolfssl:openssh-10.5p1-patch
Open

Add openssh 10.5p1 patch for wolfSSL#359
julek-wolfssl wants to merge 3 commits into
wolfSSL:masterfrom
julek-wolfssl:openssh-10.5p1-patch

Conversation

@julek-wolfssl

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new OpenSSH 10.5p1 patch file to enable building/testing OpenSSH against wolfSSL.

Changes:

  • Introduces openssh-10.5p1.patch with build-system updates (Autoconf/Makefile) to detect and enable wolfSSL.
  • Adds wolfSSL-specific OpenSSH source changes (logging/init, RNG seeding, and minor crypto compatibility adjustments).
  • Updates test harness invocation to pass wolfSSL enablement into regression tests.
Suppressed comments (2)

openssh-patches/openssh-10.5p1.patch:208

  • The shell test builtin in Autoconf-generated scripts is not guaranteed to support == (POSIX specifies =). Using == here can break ./configure on systems where /bin/sh is a strict POSIX shell (e.g., dash).
+	if test "x$wolf_has_aesni" == "xyes" ; then

openssh-patches/openssh-10.5p1.patch:383

  • log_init() unconditionally requires WC_RNG_SEED_CB and registers wolf_seed, but after making wolf_seed conditional on getrandom availability (or on platforms without getrandom), this will either fail compilation or force an unnecessary build-time constraint. Consider registering the seed callback only when getrandom is available, and otherwise rely on wolfSSL’s internal sandbox-safe seeding (e.g., RDSEED) guarded by the includes.h check.
+#ifndef WC_RNG_SEED_CB
+#error wolfSSL needs to be built with WC_RNG_SEED_CB
+#endif
+    wc_SetSeed_Cb(wolf_seed);
+#endif

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread openssh-patches/openssh-10.5p1.patch Outdated
Comment thread openssh-patches/openssh-10.5p1.patch Outdated
Comment thread openssh-patches/openssh-10.5p1.patch
Comment thread openssh-patches/openssh-10.5p1.patch Outdated
Comment thread openssh-patches/openssh-10.5p1.patch
- configure.ac: use `test =` rather than the bash-only `==`.
- configure.ac: describe WITH_OPENSSL by what it does. The macro is named
  for OpenSSL but is satisfied by wolfSSL's compatibility layer here.
- log.c: build wolf_seed() only with HAVE_GETRANDOM. includes.h already
  requires some sandbox-safe seed source, but rdseed satisfies that without
  providing getrandom(2), and wolf_seed() calls it unconditionally. Skipping
  wc_SetSeed_Cb() leaves wolfSSL on wc_GenerateSeed(), which uses rdseed on
  such a build.
- log.c: mark Logging_cb()'s unused logLevel.
- log.c, test_helper.c: enable wolfSSL debug logging only when the caller
  asked for it - the requested LogLevel, and -v for the unit tests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The patch breaks non-wolfSSL builds and mishandles explicit --without-wolfssl configuration.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread openssh-patches/openssh-10.5p1.patch Outdated
Comment on lines +60 to +61
-#define AES_BLOCK_SIZE 16
-
Comment on lines +110 to +112
+ if test "x${withval}" != "xyes" ; then
+ wolfssl_install_dir=${withval}
+ fi
The patched tree only built with wolfSSL.

- cipher-aesctr.h: restore AES_BLOCK_SIZE behind #ifndef. It was dropped
  because wolfSSL and OpenSSL both define it unguarded, but with neither in
  the build nothing defines it and aesctr_ctx.ctr fails to compile.
- configure.ac: --without-wolfssl also runs the AC_ARG_WITH action, with
  withval=no, so "no" was taken as an install prefix and configure aborted
  with "lib directory not found at no".
- configure.ac: restore LIBS after the entropy probes rather than before.
  Moving it earlier dropped -lcrypto before the OpenSSL PRNG check, which
  then reported no seed source and failed configure. wolfSSL builds keep
  their LIBS, since -lwolfssl has to stay on the link line.

Checked --with-wolfssl, --without-wolfssl and --without-openssl all
configure and build from a clean V_10_5_P1 tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants