aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-10 18:14:54 +0000
committerlloyd <[email protected]>2008-06-10 18:14:54 +0000
commit54fecdc60438d15f970055bb691e18c6469e1785 (patch)
tree1bd44b39489876256adf3d9a0f4ae88e88cfc9d5 /checks/pk.cpp
parentdec416d649715617e0eb66b18d69f6dbe9c308b3 (diff)
PK_Encryptor::encrypt now takes a RandomNumberGenerator reference, instead
of using the global RNG object.
Diffstat (limited to 'checks/pk.cpp')
-rw-r--r--checks/pk.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index cc3d82a5c..8c2231313 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -209,12 +209,10 @@ void validate_encryption(PK_Encryptor* e, PK_Decryptor* d,
bool& failure)
{
SecureVector<byte> message = decode_hex(input);
-
- global_state().set_prng(new Fixed_Output_RNG(decode_hex(random)));
-
SecureVector<byte> expected = decode_hex(exp);
+ Fixed_Output_RNG rng(decode_hex(random));
- SecureVector<byte> out = e->encrypt(message);
+ SecureVector<byte> out = e->encrypt(message, rng);
if(out != expected)
{
std::cout << "FAILED (encrypt): " << algo << std::endl;
@@ -222,13 +220,6 @@ void validate_encryption(PK_Encryptor* e, PK_Decryptor* d,
failure = true;
}
- global_state().set_prng(new ANSI_X931_RNG("AES-128",
- new Randpool("AES-256",
- "HMAC(SHA-256)")));
-
- for(u32bit j = 0; j != 2; j++)
- global_state().seed_prng(true, 384);
-
validate_decryption(d, algo, out, message, failure);
delete e;
}