aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/eckcdsa
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2016-08-09 18:06:39 +0200
committerRenĂ© Korthaus <[email protected]>2016-08-17 20:26:14 +0200
commit40a935209876b7c5360dadae85b0b26c2e13e0f5 (patch)
tree0adc0a99ce785ebe090d28e68e72fffd60238e85 /src/lib/pubkey/eckcdsa
parentdeef8ba63860efb14c45c5ee1cba2a3faaf8a719 (diff)
Fix leading zero bytes in DSA, ECDSA, ECGDSA and ECKCDSA signatures
Diffstat (limited to 'src/lib/pubkey/eckcdsa')
-rw-r--r--src/lib/pubkey/eckcdsa/eckcdsa.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/pubkey/eckcdsa/eckcdsa.cpp b/src/lib/pubkey/eckcdsa/eckcdsa.cpp
index 83439332e..5ca89675c 100644
--- a/src/lib/pubkey/eckcdsa/eckcdsa.cpp
+++ b/src/lib/pubkey/eckcdsa/eckcdsa.cpp
@@ -100,10 +100,9 @@ ECKCDSA_Signature_Operation::raw_sign(const byte msg[], size_t,
const BigInt s = m_mod_order.multiply(m_x, k - w);
BOTAN_ASSERT(s != 0, "invalid s");
- secure_vector<byte> signature(r.bytes() + s.bytes());
- r.binary_encode(signature.data());
- s.binary_encode(&signature[r.bytes()]);
- return signature;
+ secure_vector<byte> output = BigInt::encode_1363(r, c.size());
+ output += BigInt::encode_1363(s, m_mod_order.get_modulus().bytes());
+ return output;
}
/**