Skip to content

small ecc signatures have bad padding#86

Merged
lealem47 merged 1 commit intowolfSSL:masterfrom
sebastian-carpenter:ecc-bad-sig-padding
Mar 9, 2026
Merged

small ecc signatures have bad padding#86
lealem47 merged 1 commit intowolfSSL:masterfrom
sebastian-carpenter:ecc-bad-sig-padding

Conversation

@sebastian-carpenter
Copy link
Contributor

ecc signatures were pretty much guaranteed to fail every few hundred iterations.

When the signature is generated mp_to_unsigned_bin was used to write it out but this function does not pad the buffer. As a result, smaller signatures would leave 0x00 bytes at the end. The buffer is a big-endian number so it would later be interpreted incorrectly.

Replaced mp_to_unsigned_bin with mp_to_unsigned_bin_len as is normally done in the wolfcrypt ecc code. This will left-pad the buffer.

Copy link
Contributor

@lealem47 lealem47 left a comment

Choose a reason for hiding this comment

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

@lealem47 lealem47 merged commit f0e91d0 into wolfSSL:master Mar 9, 2026
1 check passed
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.

ECC signing + verification sometimes fails

2 participants