Skip to content

userauth: try allowing [email protected] for all backends - #2252

Closed
vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:rsacertall
Closed

vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:rsacertall

Conversation

@vszakats

@vszakats vszakats commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

The PR implementing this did not add anything OpenSSL-specific, yet it
gated the feature OpenSSL only. This may be due to OpenSSL supporting a
necessary feature built-in, while others don't. Yet, I wonder if enabling
it everywhere could cause issues?

Ref: #1314 (comment)
Follow-up to 1410efa #2249
Follow-up to 3a6ab70 #1314

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 broadens RSA certificate ([email protected]) handling in userauth.c so RSA-SHA2 signature algorithm upgrades are no longer gated to the OpenSSL/WolfSSL backends, aligning behavior across crypto backends.

Changes:

  • Allow [email protected] to participate in RSA-SHA2 upgrade algorithm selection for all backends (when LIBSSH2_RSA_SHA2 is enabled).
  • Relax a test compile-time guard so the ECDSA signed-cert auth test is enabled whenever LIBSSH2_ECDSA is available.

Reviewed changes

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

File Description
tests/test_auth_pubkey_ok_ecdsa_signed.c Expands when the ECDSA signed certificate auth integration test is compiled/run.
src/userauth.c Removes backend-specific gating so RSA cert keys can use the RSA-SHA2 upgrade list on all backends.

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

Comment thread src/userauth.c
Comment on lines 1313 to +1316
if((key_method_len == 7 &&
!memcmp(key_method, "ssh-rsa", key_method_len))
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|| (key_method_len == 28 &&
!memcmp(key_method, "[email protected]", key_method_len))
#endif
) {
!memcmp(key_method, "ssh-rsa", key_method_len)) ||
(key_method_len == 28 &&
!memcmp(key_method, "[email protected]", key_method_len))) {
Comment thread src/userauth.c Resolved
@vszakats

vszakats commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Nope, this looks wrong, I'm not sure, but this seems to advertise
the client support this method, while it's only true with OpenSSL.

Closing without merge.

@vszakats vszakats closed this Jul 8, 2026
@vszakats
vszakats deleted the rsacertall branch July 8, 2026 11:15
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
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