diff options
author | lloyd <[email protected]> | 2010-03-09 02:39:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-09 02:39:31 +0000 |
commit | 4a9afbb99bb73e43bcb3a30379d6a2dd59dae76a (patch) | |
tree | 4f7a362be278ed63828afeae56444afcbf0b2dac /src/pubkey/dh | |
parent | a4df64935b788e541206547d5d85665c191e2f5f (diff) |
Deconstify PK_Ops. It's quite reasonable that some op will want to
precompute only as needed, or will want to access some other expensive
resource or etc.
Change how the secret for generating blinding is done in cases where a
PRNG isn't available. Use the operations public op to hide the secret,
for instance the seed for a DH blinding variable is 2^x mod p.
Make use of being able to mutate internal structures in the RW signer,
since that does have access to a PRNG, so use it to initialize the
blinder on first call to sign().
Diffstat (limited to 'src/pubkey/dh')
-rw-r--r-- | src/pubkey/dh/dh.cpp | 4 | ||||
-rw-r--r-- | src/pubkey/dh/dh.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/pubkey/dh/dh.cpp b/src/pubkey/dh/dh.cpp index a99506250..b491be7bc 100644 --- a/src/pubkey/dh/dh.cpp +++ b/src/pubkey/dh/dh.cpp @@ -78,11 +78,11 @@ MemoryVector<byte> DH_PrivateKey::public_value() const DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh) : p(dh.group_p()), powermod_x_p(dh.get_x(), p) { - BigInt k = Blinder::choose_nonce(dh.get_x(), p); + BigInt k = Blinder::choose_nonce(powermod_x_p(2), p); blinder = Blinder(k, powermod_x_p(inverse_mod(k, p)), p); } -SecureVector<byte> DH_KA_Operation::agree(const byte w[], u32bit w_len) const +SecureVector<byte> DH_KA_Operation::agree(const byte w[], u32bit w_len) { BigInt input = BigInt::decode(w, w_len); diff --git a/src/pubkey/dh/dh.h b/src/pubkey/dh/dh.h index 0cc2aaabc..738b3f9c4 100644 --- a/src/pubkey/dh/dh.h +++ b/src/pubkey/dh/dh.h @@ -80,7 +80,7 @@ class BOTAN_DLL DH_KA_Operation : public PK_Ops::Key_Agreement public: DH_KA_Operation(const DH_PrivateKey& key); - SecureVector<byte> agree(const byte w[], u32bit w_len) const; + SecureVector<byte> agree(const byte w[], u32bit w_len); private: const BigInt& p; |