Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-27 09:08:59 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-27 09:08:59 +0400
commit242a7b75a2de6d8dbb36cf826d03bca7d0d818ac (patch)
tree5fa9a769dea9fe66d035ae7c176c780e19a2b0ed /core/src/main/java/org
parent8d7e53b43dbd1316bf4e3035fee35d8bc69bef3b (diff)
Optimize final adjustments in reduce()
Diffstat (limited to 'core/src/main/java/org')
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Field.java17
1 files changed, 4 insertions, 13 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Field.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Field.java
index 5bdece44..72a1dc52 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Field.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP224R1Field.java
@@ -116,24 +116,15 @@ public class SecP224R1Field
cc >>= 32;
int c = (int)cc;
- if (c < 0)
+ if (c > 0)
{
- do
- {
- c += Nat224.add(z, P, z);
- }
- while (c < 0);
+ reduce32(c, z);
}
else
{
- while (c > 0)
+ while (c < 0)
{
- c += Nat224.sub(z, P, z);
- }
-
- if (z[6] == P6 && Nat224.gte(z, P))
- {
- Nat224.sub(z, P, z);
+ c += Nat224.add(z, P, z);
}
}
}