From 40a935209876b7c5360dadae85b0b26c2e13e0f5 Mon Sep 17 00:00:00 2001 From: René Korthaus Date: Tue, 9 Aug 2016 18:06:39 +0200 Subject: Fix leading zero bytes in DSA, ECDSA, ECGDSA and ECKCDSA signatures --- src/lib/pubkey/ecdsa/ecdsa.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/lib/pubkey/ecdsa/ecdsa.cpp') diff --git a/src/lib/pubkey/ecdsa/ecdsa.cpp b/src/lib/pubkey/ecdsa/ecdsa.cpp index 6fe7ce319..264a36963 100644 --- a/src/lib/pubkey/ecdsa/ecdsa.cpp +++ b/src/lib/pubkey/ecdsa/ecdsa.cpp @@ -86,10 +86,7 @@ ECDSA_Signature_Operation::raw_sign(const byte msg[], size_t msg_len, BOTAN_ASSERT(s != 0, "invalid s"); BOTAN_ASSERT(r != 0, "invalid r"); - secure_vector output(2*m_order.bytes()); - r.binary_encode(&output[output.size() / 2 - r.bytes()]); - s.binary_encode(&output[output.size() - s.bytes()]); - return output; + return BigInt::encode_fixed_length_int_pair(r, s, m_order.bytes()); } /** -- cgit v1.2.3