diff options
author | Jack Lloyd <[email protected]> | 2016-07-27 15:58:07 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-27 15:58:07 -0400 |
commit | 17677f9981005b68201653b45de42c5958f32b70 (patch) | |
tree | 89cd791389f3de66ab5cc0d70d91311464b79cde /src/lib | |
parent | 376a7900377cae31623e81273cae4cdc03f63e83 (diff) | |
parent | 923be75ef7ba4c21968291333402a7bc6eafedfd (diff) |
Merge GH #556 Add DH negative tests. Fix DH keygen, did not call gen_check due to setting m_x earlier
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pubkey/dh/dh.cpp | 9 |
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); + } } /* |