mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Always create 70 byte signatures with low R values
When extra entropy is not specified by the caller, CKey::Sign will now always create a signature that has a low R value and is at most 70 bytes. The resulting signature on the stack will be 71 bytes when the sighash byte is included. Using low R signatures means that the resulting DER encoded signature will never need to have additional padding to account for high R values.
This commit is contained in:
parent
9d86aad287
commit
18dfea0dd0
8 changed files with 70 additions and 22 deletions
|
|
@ -369,7 +369,7 @@ public:
|
|||
std::vector<unsigned char> vchSig, r, s;
|
||||
uint32_t iter = 0;
|
||||
do {
|
||||
key.Sign(hash, vchSig, iter++);
|
||||
key.Sign(hash, vchSig, false, iter++);
|
||||
if ((lenS == 33) != (vchSig[5 + vchSig[3]] == 33)) {
|
||||
NegateSignatureS(vchSig);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue