aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk.cpp
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2008-06-20 19:03:45 +0000
committerlloyd <lloyd@randombit.net>2008-06-20 19:03:45 +0000
commit7dde81851bfb6cef78c3480acc2f1c1dedb1f126 (patch)
tree06f35288c9c08b9f77468c664dbf8a65aaaf2647 /checks/pk.cpp
parent770a9850f1a7c6c65b0316503b99798a6ff910dd (diff)
Similiar combining transform for the ElGamal, DSA, and NR private key
constructors.
Diffstat (limited to 'checks/pk.cpp')
-rw-r--r--checks/pk.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 93007c8d8..2dad1b966 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -198,8 +198,10 @@ u32bit validate_elg_enc(const std::string& algo,
if(str.size() != 6 && str.size() != 7)
throw Exception("Invalid input from pk_valid.dat");
+ RandomNumberGenerator& rng = global_state().prng_reference();
+
DL_Group domain(to_bigint(str[0]), to_bigint(str[1]));
- ElGamal_PrivateKey privkey(domain, to_bigint(str[2]), to_bigint(str[3]));
+ ElGamal_PrivateKey privkey(rng, domain, to_bigint(str[2]));
ElGamal_PublicKey pubkey = privkey;
std::string eme = algo.substr(8, std::string::npos);
@@ -407,8 +409,10 @@ u32bit validate_nr_sig(const std::string& algo,
if(str.size() != 8)
throw Exception("Invalid input from pk_valid.dat");
+ RandomNumberGenerator& rng = global_state().prng_reference();
+
DL_Group domain(to_bigint(str[0]), to_bigint(str[1]), to_bigint(str[2]));
- NR_PrivateKey privkey(domain, to_bigint(str[4]), to_bigint(str[3]));
+ NR_PrivateKey privkey(rng, domain, to_bigint(str[4]));
NR_PublicKey pubkey = privkey;
std::string emsa = algo.substr(3, std::string::npos);
@@ -496,14 +500,14 @@ void do_pk_keygen_tests()
#define DL_SIG_KEY(TYPE, GROUP) \
{ \
- TYPE key(DL_Group(GROUP), rng); \
+ TYPE key(rng, DL_Group(GROUP)); \
key.check_key(rng, true); \
std::cout << '.' << std::flush; \
}
#define DL_ENC_KEY(TYPE, GROUP) \
{ \
- TYPE key(DL_Group(GROUP), rng); \
+ TYPE key(rng, DL_Group(GROUP)); \
key.check_key(rng, true); \
std::cout << '.' << std::flush; \
}