aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/elgamal
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-17 15:59:50 +0000
committerlloyd <[email protected]>2012-06-17 15:59:50 +0000
commit0d0c1336a37c5ab5cb6eb5eb2832113d628f4281 (patch)
tree29593734b6407a183c14ff25930a0e6f65ad2af7 /src/pubkey/elgamal
parentc0145404db9bb6007f1468a648e483dd9791cced (diff)
Put an upper bound on the blinding value to 160 bits. This seems to be
plenty sufficient, and reduces the overhead of setting up the blinder (in terms of exponent size and the cost of computing modular inverses).
Diffstat (limited to 'src/pubkey/elgamal')
-rw-r--r--src/pubkey/elgamal/elgamal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp
index 3988f3155..837528af8 100644
--- a/src/pubkey/elgamal/elgamal.cpp
+++ b/src/pubkey/elgamal/elgamal.cpp
@@ -105,7 +105,7 @@ ElGamal_Decryption_Operation::ElGamal_Decryption_Operation(const ElGamal_Private
powermod_x_p = Fixed_Exponent_Power_Mod(key.get_x(), p);
mod_p = Modular_Reducer(p);
- BigInt k(global_state().global_rng(), p.bits() - 1);
+ BigInt k(global_state().global_rng(), std::min<size_t>(160, p.bits() - 1));
blinder = Blinder(k, powermod_x_p(k), p);
}