Repository navigation
Anchor the key type checks in ReadKey_file - #1363
Open
ejohnstown wants to merge 1 commit into
Open
ejohnstown wants to merge 1 commit into
ejohnstown wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active issues leave temporary-file tests incompatible with write-disabled and FatFS configurations, while key-format detection still searches beyond the opening header and can misclassify PEM files.
3 open issues
What changed in this PR
This PR updates wolfSSH_ReadKey_file() to use bounded prefix comparisons for key-type detection and recognize composite ML-DSA public-key names.
Changes:
- Replaces several whole-file searches with prefix checks.
- Broadens SSH-format detection from
ssh-mldsa-tossh-mldsa. - Adds API coverage for five ML-DSA public-key name variants.
| File | Description |
|---|---|
| tests/api.c | Adds and registers file-based ML-DSA classification tests. |
| src/ssh.c | Adds a prefix-check helper and updates key-format detection. |
Review effort: Balanced
wolfSSH_ReadKey_file() now classifies a key file by comparing only its first bytes against each SSH key type name and the OpenSSH and PEM begin markers, rather than searching the whole file, which may be a private key. - match "ssh-mldsa" so composite ML-DSA public keys, such as ssh-mldsa44-es256@wolfssl.com, load as SSH format - add test_wolfSSH_ReadKey_file_mldsaPub to api.c Issue: F-14633, F-14666
ejohnstown
force-pushed
the
readkey-prefixes
branch
from
November 2, 2026 20:51
3ff45e9 to
66d9721
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1363
Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
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.

wolfSSH_ReadKey_file() classifies a key file by its first bytes only,
instead of searching the whole file, which may be a private key.
Issue: F-14633, F-14666