diff options
author | lloyd <[email protected]> | 2011-02-07 14:00:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-02-07 14:00:45 +0000 |
commit | 6aae5ab9f16af0fc0f027bc0c4dc3ee4ee239510 (patch) | |
tree | db4714f423af2a0146a6312d281feaca8fcc2c2b /src/pubkey | |
parent | e0934ae723f6b97f1adbc408e42719db64b9607d (diff) |
Fix the ordering of the GOST 34.10 signature values. Add a test
derived from a DNSSEC RFC. Bug reported by Bert Hubert to the
mailing list. According to Bert, this ordering is compatible with
the version included in OpenSSL.
Also, benchmark GOST 34.10 using the GOST 34.11 hash since that
is always what it is used with.
Diffstat (limited to 'src/pubkey')
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 61693e01f..fa72d0673 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -130,8 +130,8 @@ GOST_3410_Signature_Operation::sign(const byte msg[], size_t msg_len, throw Invalid_State("GOST 34.10: r == 0 || s == 0"); SecureVector<byte> output(2*order.bytes()); - r.binary_encode(&output[output.size() / 2 - r.bytes()]); - s.binary_encode(&output[output.size() - s.bytes()]); + s.binary_encode(&output[output.size() / 2 - s.bytes()]); + r.binary_encode(&output[output.size() - r.bytes()]); return output; } @@ -150,8 +150,8 @@ bool GOST_3410_Verification_Operation::verify(const byte msg[], size_t msg_len, BigInt e = decode_le(msg, msg_len); - BigInt r(sig, sig_len / 2); - BigInt s(sig + sig_len / 2, sig_len / 2); + BigInt s(sig, sig_len / 2); + BigInt r(sig + sig_len / 2, sig_len / 2); if(r < 0 || r >= order || s < 0 || s >= order) return false; |