summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/LIBS.md62
-rw-r--r--src/cz/crcs/ectester/reader/test/CardMiscSuite.java22
-rw-r--r--src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java3
3 files changed, 45 insertions, 42 deletions
diff --git a/docs/LIBS.md b/docs/LIBS.md
index 903aef4..bfe20cd 100644
--- a/docs/LIBS.md
+++ b/docs/LIBS.md
@@ -9,50 +9,50 @@ Popular libraries with at least some ECC support:
- [OpenSSL (FIPS mode)](https://www.openssl.org/docs/fipsnotes.html)
- [Microsoft CNG](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376210(v=vs.85).aspx)
- [Microsoft .NET crypto](https://docs.microsoft.com/en-us/dotnet/standard/security/cryptography-model)
-
+
# Supported libraries
- [BouncyCastle](https://bouncycastle.org/java.html)
- Java
- Works with the short Weierstrass curve model.
- Works with coordinates:
- - Affine
- - Projective(Homogenous)
- - Jacobian
- - Jacobian-Chudnovsky
- - Jacobian-Modified
- - Lambda-Affine?
- - Lambda-Projective?
- - Skewed?
+ - Affine
+ - Projective(Homogenous)
+ - Jacobian
+ - Jacobian-Chudnovsky
+ - Jacobian-Modified
+ - Lambda-Affine?
+ - Lambda-Projective?
+ - Skewed?
- Multiple scalar multiplication algorithms implemented and used:
- - Double-and-add always (DoubleAddMultiplier)
- - Fixed point comb (FixedPointCombMultiplier)
- - GLV (Gallant-Lambert-Vanstone) using endomorphisms (GLVMultiplier): Faster point multiplication on elliptic curves with efficient endomorphisms. <-- default, if available
- - Binary NAF right-to-left multiplication(mixed coordinates) (MixedNafR2LMultiplier)
- - Montgomery ladder (MontgomeryLadderMultiplier)
- - Binary NAF right-to-left multiplication (NafR2LMultiplier)
- - Binary NAF left-to-right multiplication (NafL2RMultiplier)
- - Double-and-add reference implementation (ReferenceMultiplier)
- - Window NAF left-to-right multiplication (WNafL2RMultiplier) <-- default
- - Window Tau-NAF multiplication (WTauNafMultiplier): Improved Algorithms for Arithmetic on Anomalous Binary Curves
- - Zeroless signed digit binary right-to-left multiplication (ZSignedDigitR2LMultiplier)
- - Zeroless signed digit binary left-to-right multiplication (ZSignedDigitL2RMultiplier)
+ - Double-and-add always (DoubleAddMultiplier)
+ - Fixed point comb (FixedPointCombMultiplier)
+ - GLV (Gallant-Lambert-Vanstone) using endomorphisms (GLVMultiplier): Faster point multiplication on elliptic curves with efficient endomorphisms. <-- default, if available
+ - Binary NAF right-to-left multiplication(mixed coordinates) (MixedNafR2LMultiplier)
+ - Montgomery ladder (MontgomeryLadderMultiplier)
+ - Binary NAF right-to-left multiplication (NafR2LMultiplier)
+ - Binary NAF left-to-right multiplication (NafL2RMultiplier)
+ - Double-and-add reference implementation (ReferenceMultiplier)
+ - Window NAF left-to-right multiplication (WNafL2RMultiplier) <-- default
+ - Window Tau-NAF multiplication (WTauNafMultiplier): Improved Algorithms for Arithmetic on Anomalous Binary Curves
+ - Zeroless signed digit binary right-to-left multiplication (ZSignedDigitR2LMultiplier)
+ - Zeroless signed digit binary left-to-right multiplication (ZSignedDigitL2RMultiplier)
- Has custom field and point arithmetic for:
- - Curve25519 (transformed into short Weierstrass model)
- - SMP2 curves
- - SECG curves
+ - Curve25519 (transformed into short Weierstrass model)
+ - SMP2 curves
+ - SECG curves
- [Sun EC](https://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html#SunEC)
- Java + C
- Uses the short Weierstrass curve model.
- For prime field curves:
- - Uses 5-bit window NAF, Uses mixed Modified-Jacobian coordinates
+ - Uses 5-bit window NAF, Uses mixed Modified-Jacobian coordinates
for doubling and Chudnovsky Jacobian coordinates for additions (ecp_jm.c). From:
Brown, Hankerson, Lopez, Menezes: Software Implementation of the NIST Elliptic Curves Over Prime Fields.
- - Contains an implementation of scalar multiplication with 4-bit sliding window, using Jacobian coordinates (ecp_jac.c)
- - Contains an implementation of IEEE P1363 algorithm A.10.3 using affine coordinates (ecp_aff.c)
+ - Contains an implementation of scalar multiplication with 4-bit sliding window, using Jacobian coordinates (ecp_jac.c)
+ - Contains an implementation of IEEE P1363 algorithm A.10.3 using affine coordinates (ecp_aff.c)
- For binary field curves:
- - Uses Lopez-Dahab (Montgomery) ladder, XZ coordinates (ec2_mont.c): Fast multiplication on elliptic curves over GF(2^m) without precomputation (Algorithm 2P)
- - Contains an implementation of IEEE P1363 algorithm A.10.3 using affine coordinates (ec2_aff.c)
+ - Uses Lopez-Dahab (Montgomery) ladder, XZ coordinates (ec2_mont.c): Fast multiplication on elliptic curves over GF(2^m) without precomputation (Algorithm 2P)
+ - Contains an implementation of IEEE P1363 algorithm A.10.3 using affine coordinates (ec2_aff.c)
- Has some custom arithmetic for some of the NIST primes.
- [Botan](https://botan.randombit.net/)
- C++
@@ -68,6 +68,6 @@ Popular libraries with at least some ECC support:
- [Crypto++](https://cryptopp.com/)
- C++
- For prime field curves:
- - Uses projective coordinates and sliding window scalar multiplication algorithm.
+ - Uses projective coordinates and sliding window scalar multiplication algorithm.
- For binary field curves:
- - Uses affine coordinates and sliding window scalar multiplication algorithm. \ No newline at end of file
+ - Uses affine coordinates and sliding window scalar multiplication algorithm. \ No newline at end of file
diff --git a/src/cz/crcs/ectester/reader/test/CardMiscSuite.java b/src/cz/crcs/ectester/reader/test/CardMiscSuite.java
index 5dcf727..487fc6a 100644
--- a/src/cz/crcs/ectester/reader/test/CardMiscSuite.java
+++ b/src/cz/crcs/ectester/reader/test/CardMiscSuite.java
@@ -21,34 +21,36 @@ import java.util.Map;
public class CardMiscSuite extends CardTestSuite {
public CardMiscSuite(TestWriter writer, ECTesterReader.Config cfg, CardMngr cardManager) {
- super(writer, cfg, cardManager, "miscellaneous", "Some miscellaneous tests, tries ECDH and ECDSA over supersingular curves and some Barreto-Naehrig curves with small embedding degree and CM discriminant.");
+ super(writer, cfg, cardManager, "miscellaneous", "Some miscellaneous tests, tries ECDH and ECDSA over supersingular curves, anomalous curves and some Barreto-Naehrig curves with small embedding degree and CM discriminant.");
}
@Override
protected void runTests() throws Exception {
+ Map<String, EC_Curve> anCurves = EC_Store.getInstance().getObjects(EC_Curve.class, "anomalous");
Map<String, EC_Curve> ssCurves = EC_Store.getInstance().getObjects(EC_Curve.class, "supersingular");
Map<String, EC_Curve> bnCurves = EC_Store.getInstance().getObjects(EC_Curve.class, "Barreto-Naehrig");
- testCurves(ssCurves, "supersingular");
-
- testCurves(bnCurves, "Barreto-Naehrig");
+ testCurves(anCurves, "anomalous", Result.ExpectedValue.FAILURE);
+ testCurves(ssCurves, "supersingular", Result.ExpectedValue.FAILURE);
+ testCurves(bnCurves, "Barreto-Naehrig", Result.ExpectedValue.ANY);
}
- private void testCurves(Map<String, EC_Curve> curves, String catName) throws Exception {
+ private void testCurves(Map<String, EC_Curve> curves, String catName, Result.ExpectedValue expected) throws Exception {
for (EC_Curve curve : curves.values()) {
Test allocateFirst = runTest(CommandTest.expect(new Command.Allocate(this.card, ECTesterApplet.KEYPAIR_BOTH, curve.getBits(), curve.getField()), Result.ExpectedValue.SUCCESS));
if (!allocateFirst.ok()) {
- doTest(CompoundTest.all(Result.ExpectedValue.SUCCESS, "No support for " + curve.getBits() + "b " + CardUtil.getKeyTypeString(curve.getField()) + ".", allocateFirst));
+ doTest(CompoundTest.all(Result.ExpectedValue.FAILURE, "No support for " + curve.getBits() + "b " + CardUtil.getKeyTypeString(curve.getField()) + ".", allocateFirst));
continue;
}
Test set = CommandTest.expect(new Command.Set(this.card, ECTesterApplet.KEYPAIR_BOTH, EC_Consts.CURVE_external, curve.getParams(), curve.flatten()), Result.ExpectedValue.SUCCESS);
- Test generate = CommandTest.expect(new Command.Generate(this.card, ECTesterApplet.KEYPAIR_BOTH), Result.ExpectedValue.SUCCESS);
- Test ka = CommandTest.expect(new Command.ECDH(this.card, ECTesterApplet.KEYPAIR_LOCAL, ECTesterApplet.KEYPAIR_REMOTE, ECTesterApplet.EXPORT_FALSE, EC_Consts.TRANSFORMATION_NONE, EC_Consts.KeyAgreement_ALG_EC_SVDP_DH), Result.ExpectedValue.SUCCESS);
- Test sig = CommandTest.expect(new Command.ECDSA(this.card, ECTesterApplet.KEYPAIR_LOCAL, EC_Consts.Signature_ALG_ECDSA_SHA, ECTesterApplet.EXPORT_FALSE, null), Result.ExpectedValue.SUCCESS);
+ Test generate = CommandTest.expect(new Command.Generate(this.card, ECTesterApplet.KEYPAIR_BOTH), Result.ExpectedValue.ANY);
+ Test ka = CommandTest.expect(new Command.ECDH(this.card, ECTesterApplet.KEYPAIR_LOCAL, ECTesterApplet.KEYPAIR_REMOTE, ECTesterApplet.EXPORT_FALSE, EC_Consts.TRANSFORMATION_NONE, EC_Consts.KeyAgreement_ALG_EC_SVDP_DH), expected);
+ Test sig = CommandTest.expect(new Command.ECDSA(this.card, ECTesterApplet.KEYPAIR_LOCAL, EC_Consts.Signature_ALG_ECDSA_SHA, ECTesterApplet.EXPORT_FALSE, null), expected);
+ Test perform = CompoundTest.all(Result.ExpectedValue.SUCCESS, "Perform ECDH and ECDSA", ka, sig);
Test cleanup = CommandTest.expect(new Command.Cleanup(this.card), Result.ExpectedValue.SUCCESS);
- doTest(CompoundTest.greedyAll(Result.ExpectedValue.SUCCESS, "Tests over " + curve.getBits() + " " + catName + " curve: " + curve.getId() + ".", allocateFirst, set, generate, ka, sig, cleanup));
+ doTest(CompoundTest.greedyAll(Result.ExpectedValue.SUCCESS, "Tests over " + curve.getBits() + " " + catName + " curve: " + curve.getId() + ".", allocateFirst, set, generate, perform, cleanup));
}
}
}
diff --git a/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java b/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java
index 0a420a1..03a088b 100644
--- a/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java
+++ b/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java
@@ -110,7 +110,8 @@ public abstract class NativeECLibrary extends ProviderECLibrary {
provider = createProvider();
return super.initialize();
- } catch (IOException | UnsatisfiedLinkError ignored) {
+ } catch (IOException | UnsatisfiedLinkError ex) {
+ System.err.println(ex.getMessage());
}
return false;
}