aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rsa
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-19 21:43:42 +0000
committerlloyd <[email protected]>2012-07-19 21:43:42 +0000
commit7e3b82efa459b2c08d1d12b06951cdc22b16df6e (patch)
treec797f79f88d14039dce298530ead6ac731e50997 /src/pubkey/rsa
parentf5775ee4aa20abd43b025869c733ed1b473f4034 (diff)
In RSA and RW signers, add the message contents to the RNG state
Diffstat (limited to 'src/pubkey/rsa')
-rw-r--r--src/pubkey/rsa/rsa.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp
index 48243c9f9..6719a9960 100644
--- a/src/pubkey/rsa/rsa.cpp
+++ b/src/pubkey/rsa/rsa.cpp
@@ -90,15 +90,17 @@ BigInt RSA_Private_Operation::private_op(const BigInt& m) const
secure_vector<byte>
RSA_Private_Operation::sign(const byte msg[], size_t msg_len,
- RandomNumberGenerator&)
+ RandomNumberGenerator& rng)
{
+ rng.add_entropy(msg, msg_len);
+
/* We don't check signatures against powermod_e_n here because
PK_Signer checks verification consistency for all signature
algorithms.
*/
- BigInt m(msg, msg_len);
- BigInt x = blinder.unblind(private_op(blinder.blind(m)));
+ const BigInt m(msg, msg_len);
+ const BigInt x = blinder.unblind(private_op(blinder.blind(m)));
return BigInt::encode_1363(x, n.bytes());
}
@@ -108,8 +110,8 @@ RSA_Private_Operation::sign(const byte msg[], size_t msg_len,
secure_vector<byte>
RSA_Private_Operation::decrypt(const byte msg[], size_t msg_len)
{
- BigInt m(msg, msg_len);
- BigInt x = blinder.unblind(private_op(blinder.blind(m)));
+ const BigInt m(msg, msg_len);
+ const BigInt x = blinder.unblind(private_op(blinder.blind(m)));
BOTAN_ASSERT(m == powermod_e_n(x),
"RSA decrypt passed consistency check");