diff options
author | lloyd <[email protected]> | 2008-06-10 16:23:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-10 16:23:59 +0000 |
commit | 2aef9fa5bc25984a838a51a93ac0e918d2d1bbac (patch) | |
tree | 9f0b9035c4549380de6c62a7bf941a9396b8f554 /src/nr.cpp | |
parent | 7ab69d77956048fdc27f49a07724d6b21549b916 (diff) |
Pass RandomNumberGenerator references to public key operations that need
them (encrypt and sign), with the intent of slowly bubbling up the access
points to the API level, at which point the application handles managing
the RNG. This will allow removing the compiled-in global PRNG, and
make testing much simpler.
Diffstat (limited to 'src/nr.cpp')
-rw-r--r-- | src/nr.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nr.cpp b/src/nr.cpp index 0acbd0bb0..5b7c28f72 100644 --- a/src/nr.cpp +++ b/src/nr.cpp @@ -96,13 +96,14 @@ void NR_PrivateKey::PKCS8_load_hook(bool generated) /************************************************* * Nyberg-Rueppel Signature Operation * *************************************************/ -SecureVector<byte> NR_PrivateKey::sign(const byte in[], u32bit length) const +SecureVector<byte> NR_PrivateKey::sign(const byte in[], u32bit length, + RandomNumberGenerator& rng) const { const BigInt& q = group_q(); BigInt k; do - k.randomize(global_state().prng_reference(), q.bits()); + k.randomize(rng, q.bits()); while(k >= q); return core.sign(in, length, k); |