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-07-25 12:19:17 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-07-25 12:19:17 +0400
commit3ffb9534f1f2346a27e24014a0dbd6674f3754c9 (patch)
treec3f29fb3bf6d90ec42cb9a451eacaaba58899144
parente25e94a046a6934819133886439984e2fecb2b04 (diff)
Refactor
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/ECCurve.java20
1 files changed, 7 insertions, 13 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java b/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java
index cd0593c9..4c658f20 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/ECCurve.java
@@ -353,6 +353,11 @@ public abstract class ECCurve
BigInteger X = BigIntegers.fromUnsignedByteArray(encoded, 1, expectedLength);
p = decompressPoint(yTilde, X);
+ if (!p.satisfiesCofactor())
+ {
+ throw new IllegalArgumentException("Invalid point");
+ }
+
break;
}
case 0x04: // uncompressed
@@ -472,12 +477,7 @@ public abstract class ECCurve
y = y.negate();
}
- ECPoint p = this.createRawPoint(x, y, true);
- if (!p.satisfiesCofactor())
- {
- throw new IllegalArgumentException("Invalid point");
- }
- return p;
+ return this.createRawPoint(x, y, true);
}
}
@@ -1017,13 +1017,7 @@ public abstract class ECCurve
throw new IllegalArgumentException("Invalid point compression");
}
- ECPoint p = this.createRawPoint(x, y, true);
- if (!p.satisfiesCofactor())
- {
- throw new IllegalArgumentException("Invalid point");
- }
-
- return p;
+ return this.createRawPoint(x, y, true);
}
/**