diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-18 14:22:53 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-18 14:22:53 +0700 |
commit | 088e423b20074f3483b8c255ffcb724e3fdf4d6a (patch) | |
tree | 2cfc4ec51ced9f0807524b904803c2f4f7ffcbfd /crypto/src/math/ec/ECFieldElement.cs | |
parent | http://www.bouncycastle.org/jira/browse/BMA-113 (diff) | |
download | BouncyCastle.NET-ed25519-088e423b20074f3483b8c255ffcb724e3fdf4d6a.tar.xz |
http://www.bouncycastle.org/jira/browse/BMA-82
- use SecureRandom to generate "arbitrary" values
Diffstat (limited to 'crypto/src/math/ec/ECFieldElement.cs')
-rw-r--r-- | crypto/src/math/ec/ECFieldElement.cs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs index 4d4fb3e4d..d0e008aab 100644 --- a/crypto/src/math/ec/ECFieldElement.cs +++ b/crypto/src/math/ec/ECFieldElement.cs @@ -306,13 +306,12 @@ namespace Org.BouncyCastle.Math.EC BigInteger k = legendreExponent.Add(BigInteger.One), qMinusOne = q.Subtract(BigInteger.One); BigInteger U, V; - Random rand = new Random(); do { BigInteger P; do { - P = new BigInteger(q.BitLength, rand); + P = BigInteger.Arbitrary(q.BitLength); } while (P.CompareTo(q) >= 0 || !ModReduce(P.Multiply(P).Subtract(fourX)).ModPow(legendreExponent, q).Equals(qMinusOne)); |