aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/dh/dh.cpp
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-07-26 11:18:56 +0200
committerDaniel Neus <[email protected]>2016-07-26 11:54:08 +0200
commit82e2a44d81012701786800c79e0171a50c3c2d31 (patch)
treed8f0aac24200ecf9d4932920a2d6cded4de26b5b /src/lib/pubkey/dh/dh.cpp
parent5d50db6e964a9305d7271301804a1dcb4ce22606 (diff)
fix: load_check() was called instead of gen_check() during DH private key generation
Diffstat (limited to 'src/lib/pubkey/dh/dh.cpp')
-rw-r--r--src/lib/pubkey/dh/dh.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/pubkey/dh/dh.cpp b/src/lib/pubkey/dh/dh.cpp
index 9eb4e5cd0..8ed79aa3d 100644
--- a/src/lib/pubkey/dh/dh.cpp
+++ b/src/lib/pubkey/dh/dh.cpp
@@ -37,6 +37,7 @@ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng,
const DL_Group& grp,
const BigInt& x_arg)
{
+ const bool generate = (x_arg == 0) ? true : false;
m_group = grp;
m_x = x_arg;
@@ -47,12 +48,18 @@ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng,
}
if(m_y == 0)
+ {
m_y = power_mod(group_g(), m_x, group_p());
+ }
- if(m_x == 0)
+ if(generate)
+ {
gen_check(rng);
+ }
else
+ {
load_check(rng);
+ }
}
/*