forked from I2P_Developers/i2p.i2p
EdDSA: Backport versions 0.2/0.3 from github:
- Change key encoding to match curdle draft - Support key decoding based on curdle draft - Implement true constant-time cmov() - Add handling of X509Key-wrapped EdDSA keys (GitHub PR #47) - Clarify that KeyPairGenerator takes a key size, not strength - Javadocs GitHub PR #58: - Make GroupElement immutable by moving the pre-computed logic to the constructors, allowing the synchronized checking of whether the pre-computed logic had executed or not to be removed since it always has when it is used because those code paths are modified to request it at construction time. - This allows getNegativeA() to be lazy, and doesn't need volatile due to the immutability (and final fields - this is important part of the contract with the JVM memory model). - Remove synchronized contention from the named curve table get method. - Generally remove use of the named curve table get method with a constant curve name in hot code paths in favour of using a new static constant for the curve spec. Overall performance changes: - Keygen 46% faster - Signing 39% slower (due to cmov) - Verify 2% faster
This commit is contained in:
@ -760,7 +760,7 @@ public class GroupElementTest {
|
||||
GroupElement A = new GroupElement(curve, Utils.hexToBytes("d4cf8595571830644bd14af416954d09ab7159751ad9e0f7a6cbd92379e71a66"));
|
||||
GroupElement B = ed25519.getB();
|
||||
GroupElement geZero = curve.getZero(GroupElement.Representation.P3);
|
||||
geZero.precompute(false);
|
||||
//geZero.precompute(false);
|
||||
|
||||
// 0 * GE(0) + 0 * GE(0) = GE(0)
|
||||
assertThat(geZero.doubleScalarMultiplyVariableTime(geZero, zero, zero),
|
||||
@ -802,7 +802,7 @@ public class GroupElementTest {
|
||||
// Arrange:
|
||||
final GroupElement basePoint = ed25519.getB();
|
||||
final GroupElement g = MathUtils.getRandomGroupElement();
|
||||
g.precompute(false);
|
||||
//g.precompute(false);
|
||||
final FieldElement f1 = MathUtils.getRandomFieldElement();
|
||||
final FieldElement f2 = MathUtils.getRandomFieldElement();
|
||||
|
||||
|
Reference in New Issue
Block a user