aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-06 21:55:54 -0500
committerJack Lloyd <[email protected]>2018-12-06 21:55:54 -0500
commitdbadf2e21b9925b593beab95bead38b94622c4f4 (patch)
treefc8e58a52fe3412f3212a4a63def1bb1c017dbd4 /src/lib
parent7b9908708f22995da33fb26b26e8ed5ba939e943 (diff)
parentbf82b2ebc63f10289832e6a2f834c5b172c4dc62 (diff)
Merge GH #1772 ECDSA now caches RFC 6979 nonce generator object
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pubkey/ecdsa/ecdsa.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/pubkey/ecdsa/ecdsa.cpp b/src/lib/pubkey/ecdsa/ecdsa.cpp
index cbb9eba67..5d89cc198 100644
--- a/src/lib/pubkey/ecdsa/ecdsa.cpp
+++ b/src/lib/pubkey/ecdsa/ecdsa.cpp
@@ -58,7 +58,7 @@ class ECDSA_Signature_Operation final : public PK_Ops::Signature_with_EMSA
m_x(ecdsa.private_value())
{
#if defined(BOTAN_HAS_RFC6979_GENERATOR)
- m_rfc6979_hash = hash_for_emsa(emsa);
+ m_rfc6979.reset(new RFC6979_Nonce_Generator(hash_for_emsa(emsa), m_group.get_order(), m_x));
#endif
m_b = m_group.random_scalar(rng);
@@ -77,7 +77,7 @@ class ECDSA_Signature_Operation final : public PK_Ops::Signature_with_EMSA
const BigInt& m_x;
#if defined(BOTAN_HAS_RFC6979_GENERATOR)
- std::string m_rfc6979_hash;
+ std::unique_ptr<RFC6979_Nonce_Generator> m_rfc6979;
#endif
std::vector<BigInt> m_ws;
@@ -92,7 +92,7 @@ ECDSA_Signature_Operation::raw_sign(const uint8_t msg[], size_t msg_len,
BigInt m(msg, msg_len, m_group.get_order_bits());
#if defined(BOTAN_HAS_RFC6979_GENERATOR)
- const BigInt k = generate_rfc6979_nonce(m_x, m_group.get_order(), m, m_rfc6979_hash);
+ const BigInt k = m_rfc6979->nonce_for(m);
#else
const BigInt k = m_group.random_scalar(rng);
#endif