Revert a regression in DSS key generation #310
Merged
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.
A change in f0017b8 caused a random regression in DSS key signing
due to moving the padding on the integers generated by DSA from the left
to the right.
So, for example, if signing the test case string "jerri blank", the
random number might be generated as:
k=703745698612177278239572677252380378525350342103
If so, the signature parts will be:
r=184615963997659989901526712385095827509599268253
s=2682547683721156713440053885014828604195555319
Note the s being shorter.
Prior to f0017b8, s would be right-padded with zeros:
s=268254768372115671344005388501482860419555531900
After, it would be left-padded:
s=002682547683721156713440053885014828604195555319
When converting back to a long, that loses the padding. This change
restores the behaviour.
Fixes #308