diff options
author | lloyd <[email protected]> | 2008-06-20 10:41:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-20 10:41:31 +0000 |
commit | a2700f470482680d4f99b3b519af0a1ccfd53bfd (patch) | |
tree | dc70ada7e3d05b6f0b9587d7a266267848895486 /src/dl_algo.cpp | |
parent | 4331395edf8e68b46e61fc00ddb5518fef8b36b5 (diff) |
Pass a reference to the global PRNG as an argument to the DL_Scheme_Decoder
constructor, instead of referencing it directly.
Diffstat (limited to 'src/dl_algo.cpp')
-rw-r--r-- | src/dl_algo.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/dl_algo.cpp b/src/dl_algo.cpp index ade50e28d..726ee2f0d 100644 --- a/src/dl_algo.cpp +++ b/src/dl_algo.cpp @@ -57,15 +57,18 @@ X509_Decoder* DL_Scheme_PublicKey::x509_decoder() void key_bits(const MemoryRegion<byte>& bits) { BER_Decoder(bits).decode(key->y); - key->X509_load_hook(global_state().prng_reference()); + key->X509_load_hook(rng); } - DL_Scheme_Decoder(DL_Scheme_PublicKey* k) : key(k) {} + DL_Scheme_Decoder(DL_Scheme_PublicKey* k, + RandomNumberGenerator& r) : + key(k), rng(r) {} private: DL_Scheme_PublicKey* key; + RandomNumberGenerator& rng; }; - return new DL_Scheme_Decoder(this); + return new DL_Scheme_Decoder(this, global_state().prng_reference()); } /************************************************* @@ -114,15 +117,18 @@ PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder() void key_bits(const MemoryRegion<byte>& bits) { BER_Decoder(bits).decode(key->x); - key->PKCS8_load_hook(global_state().prng_reference()); + key->PKCS8_load_hook(rng); } - DL_Scheme_Decoder(DL_Scheme_PrivateKey* k) : key(k) {} + DL_Scheme_Decoder(DL_Scheme_PrivateKey* k, + RandomNumberGenerator& r) : + key(k), rng(r) {} private: DL_Scheme_PrivateKey* key; + RandomNumberGenerator& rng; }; - return new DL_Scheme_Decoder(this); + return new DL_Scheme_Decoder(this, global_state().prng_reference()); } /************************************************* |