Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-key: fix DsaKeypair::try_sign format error #191

Merged
merged 2 commits into from
Jan 10, 2024
Merged

ssh-key: fix DsaKeypair::try_sign format error #191

merged 2 commits into from
Jan 10, 2024

Conversation

jjteo74
Copy link
Contributor

@jjteo74 jjteo74 commented Jan 8, 2024

The integer components r and s of the generated signature may be less than 160 bits, which is the exact length required by SSH wire format.

This commit fixes #190 by padding the integer components with leading zeros to make them 160 bits long.

The integer components `r` and `s` of the generated signature may be less
than 160 bits, which is the exact length required by SSH wire format.

This commit fixes #190 by padding the integer components with leading zeros
to make them 160 bits long.
Copy link
Member

@tarcieri tarcieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Mind adding a regression test? Otherwise this is fine.

Tests `DSAKeyPair::try_sign` correctly deals with the case where the integer
components of the raw DSA signature are not of the expected length.
@jjteo74
Copy link
Contributor Author

jjteo74 commented Jan 10, 2024

I've added regression test as requested. Please review. Thanks!

@tarcieri
Copy link
Member

Awesome, thanks!

@tarcieri tarcieri merged commit b0c059b into RustCrypto:master Jan 10, 2024
13 checks passed
@jjteo74 jjteo74 deleted the fix-dsa-key-pair-try-sign-format-error branch January 10, 2024 03:35
@tarcieri tarcieri mentioned this pull request Jan 12, 2024
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.

DsaKeypair::try_sign fails when signature component r is shorter than 20 bytes
2 participants