Repository navigation
tidy-up: C nits - #2308
Closed
vszakats wants to merge 7 commits into
Closed
tidy-up: C nits#2308vszakats wants to merge 7 commits into
vszakats wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR applies a set of small “tidy-up” changes across crypto/OpenSSL, hostkey parsing, known-host handling, and SK userauth to improve type consistency and reduce minor nits/warnings while preserving behavior.
Changes:
- Align passphrase/flags parameter types with adjacent code paths (ED25519 private key loading; ECDSA-SK key extraction).
- Simplify control flow by merging sequential error checks in RSA/DSS hostkey initializers.
- Improve robustness/readability by using
sizeof(*ptr)/sizeof(array)patterns and avoiding pointless signed comparisons on unsigned values.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/userauth.c | Removes a meaningless “negative” check on an unsigned handle_len by switching to a zero-check. |
| src/openssl.c | Syncs parameter types for consistency; keeps ML-KEM alloc/check pattern intact by moving length assignments after OOM checks. |
| src/knownhost.c | Replaces manually repeated sizes/types with sizeof(*entry) and sizeof(hash) for robustness. |
| src/hostkey.c | Merges multiple sequential parse-validation if blocks into single short-circuit checks without changing semantics. |
| src/HACKING-CRYPTO.md | Updates documented prototype to match the code/header signature. |
| src/crypto.h | Updates ssh2_ed25519_new_private() prototype to match the OpenSSL implementation and surrounding conventions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
ssh2_ed25519_new_private().if()sinhostkey_method_ssh_rsa_init().if()sinhostkey_method_ssh_dss_init().sizeof()the target variable, not its manually resolved type.For robustness.
sizeof().ssh2_mlkem_new().To keep the alloc/check pattern intact and avoid unnecessary
assignments on OOM.
libssh2_sign_sk().flagstype with sibling function inossl_ecdsa_sk_openssh_priv_to_pubkey().