diff options
author | Sergio Giro <sgiro@google.com> | 2016-02-01 10:41:58 +0000 |
---|---|---|
committer | Sergio Giro <sgiro@google.com> | 2016-02-01 10:41:58 +0000 |
commit | 53b61f9fe9d58034fcc7021137e92460f91b70ce (patch) | |
tree | 90632062175928181977c1ab3ab59951bc1146c3 /bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java | |
parent | 3eebc2629986481f9fc77ab101c0c9b8ff2f2660 (diff) | |
download | bouncycastle-53b61f9fe9d58034fcc7021137e92460f91b70ce.tar.gz |
bouncycastle: Android tree with upstream code for version 1.52
Android tree as of
1af9aad12fedf1d93333e19f5ed0ab86f1cc4e2a
Change-Id: I714fa0954a5d000cd88d1fb78b0b7fe28246d404
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java')
-rw-r--r-- | bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java b/bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java index d21d8fd3..74921f09 100644 --- a/bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java +++ b/bcprov/src/main/java/org/bouncycastle/crypto/ec/ECUtil.java @@ -9,14 +9,13 @@ class ECUtil { static BigInteger generateK(BigInteger n, SecureRandom random) { - int nBitLength = n.bitLength(); - BigInteger k = new BigInteger(nBitLength, random); - - while (k.equals(ECConstants.ZERO) || (k.compareTo(n) >= 0)) + int nBitLength = n.bitLength(); + BigInteger k; + do { k = new BigInteger(nBitLength, random); } - + while (k.equals(ECConstants.ZERO) || (k.compareTo(n) >= 0)); return k; } } |