Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CVD dsig verification when hash starts with zeros
Occasionally the MD5 hash for RSA-based digital signature verification begins with zeros. A bug in how we convert the RSA decoded plain text from a big number back to a hex string causes it to write the number to the far left of the plain text buffer. If the number is smaller than a hash, then zero-padding ends up on the right when it should've been on the left. Additional fix: BN_bn2bin() will write zero bytes if the bignum is 0. So there is no point "error checking" the BN_bn2bin() call. Thanks to Tom Judge for noticing these shenanigans. Ref: openssl/openssl#2101 Side note: BN_num_bytes() will also return 0 if the bignum is 0, which is fine.
- Loading branch information