Skip to content

crypto: sync up ssh2_supported_key_sign_algs() implementation nits - #2248

Closed
vszakats wants to merge 4 commits into
libssh2:masterfrom
vszakats:signalgs
Closed

vszakats wants to merge 4 commits into
libssh2:masterfrom
vszakats:signalgs

Conversation

@vszakats

@vszakats vszakats commented Jul 8, 2026 •

Copy link
Copy Markdown
Member
  • fix to support no-RSA builds, where missing.
  • fix to suppress compiler warnings, where missing.

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 aligns ssh2_supported_key_sign_algs() across several crypto backends by removing build-time warnings and ensuring correct behavior when RSA-SHA2 support is compiled out (e.g., no-RSA builds), while preserving the known OpenSSL-specific functional exception introduced in #1314.

Changes:

  • Wrap RSA-SHA2-specific logic in #if LIBSSH2_RSA_SHA2 for the OS/400 QC3 backend to avoid advertising RSA-SHA2 when not built.
  • Add (void)key_method / (void)key_method_len casts in non-RSA-SHA2 builds (OpenSSL, mbedTLS) to suppress unused-parameter warnings.
  • Keep session explicitly unused via (void)session consistently.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/os400qc3.c Gates RSA-SHA2 return values behind LIBSSH2_RSA_SHA2 and silences unused parameters for no-RSA builds.
src/openssl.c Silences unused parameters when LIBSSH2_RSA_SHA2 is disabled (without changing OpenSSL’s existing functional behavior).
src/mbedtls.c Silences unused parameters when LIBSSH2_RSA_SHA2 is disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in 82ffc1b Jul 8, 2026
@vszakats
vszakats deleted the signalgs branch July 8, 2026 09:40
vszakats added a commit that referenced this pull request Jul 8, 2026
They were shared between all crypto backends, except openssl, which
supports an extra key method. Retain this exception by using the
`LIBSSH2_OPENSSL` guards. This is a workaround, but I deem it fine, due
to already existing evidence for per-crypto-backend logic in non-crypto
code, and the codebase already making this exception in tests.

A better option would be introducing a crypto-feature macro flag, maybe
in a future commit. Perhaps also worth a check whether the exception is
necessary.

Ref: 3a6ab70 #1314
Follow-up to 82ffc1b #2248

Closes #2249
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.

2 participants