Repository navigation
Conversation
vszakats
marked this pull request as draft
July 3, 2026 12:02
```
/home/runner/work/libssh2/libssh2/src/hostkey.c:618:5: error: Value stored to 'sig_len' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
618 | sig_len -= 15;
| ^ ~~
/home/runner/work/libssh2/libssh2/src/hostkey.c:618:5: note: Value stored to 'sig_len' is never read
618 | sig_len -= 15;
| ^ ~~
```
https://github.com/libssh2/libssh2/actions/runs/28659316347/job/84995915568?pr=2195
```
/home/runner/work/libssh2/libssh2/src/openssl.c:1534:5: error: the result from calling 'memcpy' is not null-terminated [bugprone-not-null-terminated-result,-warnings-as-errors]
1534 | memcpy(p, "ssh-dss", 7);
| ^~~~~~ ~~~
| strcpy (char *)
/home/runner/work/libssh2/libssh2/src/openssl.c:1588:5: error: the result from calling 'memcpy' is not null-terminated [bugprone-not-null-terminated-result,-warnings-as-errors]
1588 | memcpy(method_buf, "ssh-dss", 7);
| ^~~~~~ ~~~
| strcpy (char *)
```
https://github.com/libssh2/libssh2/actions/runs/28660077020/job/84998323452?pr=2195
This reverts commit f6ef5b1.
vszakats
marked this pull request as ready for review
July 3, 2026 13:44
There was a problem hiding this comment.
Pull request overview
This PR standardizes crypto API argument naming across backends (notably renaming filedata → blob and harmonizing rsa/dsa/ed_ctx parameter names), reorders/cleans up prototypes in crypto.h, and applies a few targeted warning-silencing fixes in legacy algorithms/backends.
Changes:
- Unify parameter names across crypto backends (OpenSSL, mbedTLS, WinCNG, libgcrypt, OS/400 QC3) and reflow long argument lists.
- Rename in-memory key input parameters from
filedata/filedata_lentoblob/blob_lenacross relevant APIs. - Address CI warnings (unused assignment in DSS verify path, clang-tidy suppression for fixed-length
memcpycases).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/crypto.h | Reorders and normalizes crypto API prototypes/argument names. |
| src/hostkey.c | Removes unused sig_len adjustment in DSS signature verify path. |
| src/libgcrypt.c | Renames parameters for consistency and reflows a few signatures. |
| src/libgcrypt.h | Normalizes macro parameter names for RSA/DSA free helpers. |
| src/mbedtls.c | Renames in-memory key inputs to blob and adjusts local variable naming. |
| src/openssl.c | Renames parameters for consistency; adds targeted clang-tidy suppression comments. |
| src/openssl.h | Normalizes macro parameter names for RSA/DSA/ECDSA free helpers and types. |
| src/os400qc3.c | Renames in-memory key inputs and RSA verify parameter names for consistency. |
| src/wincng.c | Renames parameters for consistency and reflows argument lists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1 of 2 tasks
vszakats
added a commit
that referenced
this pull request
Jul 5, 2026
…-terminator - fix memleak on internal buffer OOM in `ssh2_rsa_new_private_frommemory()`. - fix to use mbedtls allocator to null-terminate the local buffer and match the free call in `ssh2_ecdsa_new_private_frommemory()`. - drop redundant casts for `mbedtls_calloc()` pointers. - fix to free rsa object with `ssh2_rsa_free()` on key parse error in `ssh2_rsa_new_private_frommemory()`. - fix to use mbedtls alloc/free for rsa object (to match `ssh2_rsa_free()`) in `ssh2_rsa_new_private()`. - include terminating byte in `mbed_safe_free()` calls in. `ssh2_rsa_new_private_frommemory()`, `ssh2_pub_priv_keyfilememory()`, `ssh2_ecdsa_new_private_frommemory()`. For consistency/clarity only, the terminating byte is normally zero. - reset `*out_public_key_octal` to NULL on fail in `ssh2_ecdsa_create_key()`. - fix to use mbedtls allocator in `ssh2_ecdsa_create_key()`. This buffer is freed with `ssh2_ecdsa_free()`. - fix to use libssh2 safe-free for `*out_public_key_octal` on fail in `ssh2_ecdsa_create_key()`. This buffer is freed with libssh2 free in the codebase. - explicitly null-terminate buffers required to be so by mbedtls. Do not rely on `mbedtls_calloc()` doing the zeroing. To ensure the bug in `ssh2_ecdsa_new_private_frommemory()` doesn't repeat. - fix to use mbedtls allocator in `mbed_parse_eckey()`,. `mbed_parse_openssh_key()`. (also stop passing `sesssion *` where no longer used after this.) - fixup a type to avoid cast. - drop newlines. TL;DR most of these could cause crashes/leaks when using a custom allocator, some were causing leaking crypto-backend objects, some leaks on error path, `ssh2_ecdsa_new_private_frommemory()` failing randomly. Ref: #2195 (few of these reported by Copilot) Closes #2196
vszakats
added a commit
that referenced
this pull request
Jul 6, 2026
- hostkey: move static functions to avoid forward declarations. - drop redundant parentheses. - add `const` to `strncmp()`, `strlen()` argument casts. - cipher-chachapoly: make `chachapoly_timingsafe_bcmp()` static. - HACKING-CRYPTO: update argument names. Follow-up to db0d107 #2195 - fix minor nits around. Closes #2235
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.
and similarity.
across all backends.
prototype definition and other functions in the same group.
filedatatoblob.sibling was silenced earlier.
hostkey_method_ssh_dss_sig_verify()ssh2_rsa_new_private_frommemory().