Repository navigation
Conversation
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. Ref: 3a6ab70 libssh2#1314
There was a problem hiding this comment.
Pull request overview
This PR centralizes the “supported key signing algorithm upgrades” helper (RFC 8332) by removing duplicated ssh2_supported_key_sign_algs() implementations from individual crypto backend files and moving the logic into src/userauth.c, while keeping the OpenSSL/WolfSSL RSA cert exception via LIBSSH2_OPENSSL / LIBSSH2_WOLFSSL guards.
Changes:
- Removed per-backend
ssh2_supported_key_sign_algs()implementations from multiple crypto backend source files. - Added a
userauth_supported_key_sign_algs()helper insrc/userauth.cand updated the call site inuserauth_key_sign_algs()to use it. - Preserved the OpenSSL/WolfSSL-specific handling of
[email protected]via compile-time guards.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/userauth.c | Adds centralized helper for supported key-signing algorithm upgrades and updates call site. |
| src/wincng.c | Removes duplicated backend-local supported-algorithms helper. |
| src/os400qc3.c | Removes duplicated backend-local supported-algorithms helper. |
| src/openssl.c | Removes duplicated backend-local supported-algorithms helper (previously included cert exception). |
| src/mbedtls.c | Removes duplicated backend-local supported-algorithms helper. |
| src/libgcrypt.c | Removes duplicated backend-local supported-algorithms helper. |
Comments suppressed due to low confidence (1)
src/userauth.c:1333
- The Doxygen
@relatedtag still referencesssh2_supported_key_sign_algs(), but this file now callsuserauth_supported_key_sign_algs()and (after this PR) there is no definition ofssh2_supported_key_sign_algsin the codebase. Update the tag to avoid stale cross-references in generated docs.
* @abstract Upgrades the algorithm used for public key signing RFC 8332
* @discussion Based on the incoming key_method value, this function
* Upgrades the key method input based on user preferences,
* server support algos and crypto backend support
* @related ssh2_supported_key_sign_algs()
* @param key_method current key method, usually the default key sig method
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1 task done
vszakats
added a commit
that referenced
this pull request
Aug 2, 2026
…userauth_supported_key_sign_algs()`, fix tests The PR implementing this did not add anything OpenSSL-specific, yet it gated the feature OpenSSL only. Turns out the reason for this is that the test RSA keys are in OpenSSH format, which is only supported by OpenSSL (and wolfSSL) in libssh2. Fix by converting the two test keys to PEM format, making them compatible with all backends. (RSA OpenSSH key format is already tested separately.) Also: this also fixes outdated comment fields present in these keys. Bug: #1314 (comment) Ref: #2252 (initial fix attempt) Follow-up to 1410efa #2249 Follow-up to 3a6ab70 #1314 Closes #2483
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
They were shared between all crypto backends, except openssl, which
supports an extra key method. Retain this exception by using the
LIBSSH2_OPENSSLguards. This is a workaround, but I deem it fine, dueto 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