From 883ba903b889e2fd0eb6e238e365e3f98231c866 Mon Sep 17 00:00:00 2001 From: David Hook Date: Wed, 16 Aug 2017 12:47:03 +1000 Subject: [PATCH] Compatibility updates --- ant/jdk13.xml | 2 ++ build1-1 | 27 ++++++++++++++++--- build1-2 | 8 +++++- .../crypto/test/RegressionTest.java | 14 +++++----- .../provider/symmetric/util/ClassUtil.java | 27 +++++++++++++++++++ .../jce/provider/BouncyCastleProvider.java | 6 ++--- scripts/jdk1.1ed.sh | 12 +++++++++ 7 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 prov/src/main/jdk1.1/org/bouncycastle/jcajce/provider/symmetric/util/ClassUtil.java diff --git a/ant/jdk13.xml b/ant/jdk13.xml index bd0ccb4de9..6ec73508cf 100644 --- a/ant/jdk13.xml +++ b/ant/jdk13.xml @@ -75,9 +75,11 @@ + + diff --git a/build1-1 b/build1-1 index 24d10c7035..386e8bdd32 100644 --- a/build1-1 +++ b/build1-1 @@ -73,6 +73,8 @@ find $jdk11src -name "*.java" -exec scripts/useseccert.sh \{\} \; rm -rf org/bouncycastle/i18n/test rm -rf org/bouncycastle/i18n/filter/test rm -rf org/bouncycastle/math/ec/test + rm -rf org/bouncycastle/math/ec/custom/test + rm -rf org/bouncycastle/math/ec/custom/sec/test rm -rf org/bouncycastle/crypto/tls/test rm -rf org/bouncycastle/crypto/test/GCMReorderTest.java rm -rf org/bouncycastle/jce/cert @@ -83,8 +85,9 @@ find $jdk11src -name "*.java" -exec scripts/useseccert.sh \{\} \; rm -rf org/bouncycastle/jce/provider/EC5*.java rm -rf org/bouncycastle/jce/provider/JCEEC*.java rm -rf org/bouncycastle/jcajce/provider/asymmetric/ec/EC5Util.java - rm -rf org/bouncycastle/jce/provider/asymmetric/ec/EC5*.java + rm -rf org/bouncycastle/jcajce/provider/asymmetric/ecgost12 rm -rf org/bouncycastle/jcajce/provider/config/ProviderConfigurationPermission.java + rm -rf org/bouncycastle/jcajce/provider/test rm -rf org/bouncycastle/jce/provider/test/ECDSA5Test.java rm -rf org/bouncycastle/jce/provider/test/CRL5Test.java rm -rf org/bouncycastle/jce/provider/test/X509LDAP*.java @@ -122,6 +125,7 @@ find $jdk11src -name "*.java" -exec scripts/useseccert.sh \{\} \; rm org/bouncycastle/asn1/test/ASN1SequenceParserTest.java rm org/bouncycastle/asn1/test/OctetStringTest.java rm org/bouncycastle/asn1/test/ParseTest.java + rm org/bouncycastle/asn1/test/ASN1IntegerTest.java rm -r org/bouncycastle/crypto/test/BigSkippingCipherTest.java rm -rf org/bouncycastle/jcajce/provider/asymmetric/dstu rm -rf org/bouncycastle/jcajce/provider/asymmetric/DSTU*.java @@ -141,6 +145,7 @@ find $jdk11src -name "*.java" -exec scripts/useseccert.sh \{\} \; rm -rf org/bouncycastle/cert/test/ConverterTest* rm -rf org/bouncycastle/cert/test/CertPathLoopTest.java rm -rf org/bouncycastle/cert/test/Bc* + rm -rf org/bouncycastle/cert/test/GOST3410_2012CMSTest.java rm -rf org/bouncycastle/tsp/GenTimeAccuracyUnit* rm -rf org/bouncycastle/tsp/TimeStampTokenInfoUnit* rm -rf org/bouncycastle/jce/provider/test/DHTest.java @@ -208,6 +213,7 @@ then -classpath classes:$JDK11PATH/lib/classes.zip \ -d javadoc -sourcepath src \ org.bouncycastle.asn1 \ + org.bouncycastle.asn1.bc \ org.bouncycastle.asn1.cmp \ org.bouncycastle.asn1.cms \ org.bouncycastle.asn1.cryptopro \ @@ -257,6 +263,7 @@ then echo "compiling" + (cd src/java/; javac -d ../../classes -classpath ../../classes:../../src:$JDK11PATH/lib/classes.zip */*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip *.java ; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */*.java; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */p*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */a*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */d*/*.java @@ -266,6 +273,12 @@ javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/li javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */m*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */s*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/t*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/c*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/x*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/x*/s*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/c*/e*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/[kno]*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip a*/b*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip c*/t*/A*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip c*/t*/[BC]*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip c*/t*/D*.java @@ -275,6 +288,14 @@ javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/li javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip c*/t*/T*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip c*/t*/U*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip u*/t*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip math/ec/tools/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip math/raw/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip crypto/agreement/kdf/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip crypto/modes/gcm/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip crypto/test/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip util/io/*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip pqc/math/*/*.java +javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip pqc/crypto/*/*.java pqc/crypto/*/*/*.java javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip */u*/*.java ) cp ../../../../core/src/test/resources/org/bouncycastle/crypto/test/*.txt classes/org/bouncycastle/crypto/test/ @@ -409,14 +430,14 @@ then (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip jce/*/*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip util/*/*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip [abc]*/*/*/*.java) - (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip j*/*/*/*.java) + (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip jcajce/*/*/*.java) + (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip jce/*/*/*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip m*/*/*/*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip [ptuvx]*/*/*/*.java) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:$JDK11PATH/lib/classes.zip x509/*.java x509/*/*.java) rm -rf classes/org/bouncycastle/crypto/test - echo "provider regression test" java -classpath classes:$JDK11PATH/lib/classes.zip org.bouncycastle.jce.provider.test.RegressionTest ) diff --git a/build1-2 b/build1-2 index beaa493454..e6b5d8f939 100644 --- a/build1-2 +++ b/build1-2 @@ -58,6 +58,8 @@ find $jdk12src -name "*.java" -exec scripts/usejcecert.sh \{\} \; rm -rf org/bouncycastle/pqc/crypto/ntru rm -rf org/bouncycastle/pqc/crypto/*/NTRU* rm -rf org/bouncycastle/pqc/crypto/xmss + rm -rf org/bouncycastle/pqc/jcajce/provider/xmss + rm -rf org/bouncycastle/pqc/jcajce/provider/XMSS* rm -rf org/bouncycastle/pqc/crypto/*/XMSS* rm -rf org/bouncycastle/pqc/crypto/*/EncryptionKey* rm -rf org/bouncycastle/pqc/crypto/*/BitStringT* @@ -84,6 +86,8 @@ find $jdk12src -name "*.java" -exec scripts/usejcecert.sh \{\} \; rm -rf org/bouncycastle/jce/provider/EC5*.java rm -rf org/bouncycastle/jce/provider/JCEEC*.java rm -rf org/bouncycastle/jcajce/provider/asymmetric/ec/EC5Util.java + rm -rf org/bouncycastle/jcajce/provider/asymmetric/ecgost12 + rm -rf org/bouncycastle/jcajce/provider/test rm -rf org/bouncycastle/jce/provider/asymmetric/ec/EC5*.java rm -rf org/bouncycastle/jce/provider/test/ECDSA5Test.java rm -rf org/bouncycastle/jce/provider/test/CRL5Test.java @@ -347,7 +351,9 @@ then (cd src/java/security/spec; javac -d ../../../../classes -classpath ../../../../classes *.java ) (cd src/org/bouncycastle/jce/cert; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src *.java ) - (cd src/org/bouncycastle/jcajce/provider; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src [abcis]*/*.java ) + (cd src/org/bouncycastle/jcajce/provider; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src a*/*.java ) + (cd src/org/bouncycastle/jcajce/provider; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src b*/*.java ) + (cd src/org/bouncycastle/jcajce/provider; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src [cis]*/*.java ) (cd src/org/bouncycastle/jcajce/provider; javac -d ../../../../../classes -classpath ../../../../../classes:../../../../../src [abcis]*/*/*.java ) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src *.java a*/*.java a*/*/*.java a*/*/*/*.java ) (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src *.java [bci]*/*.java [bci]*/*/*.java [bci]*/*/*/*.java ) diff --git a/core/src/test/jdk1.1/org/bouncycastle/crypto/test/RegressionTest.java b/core/src/test/jdk1.1/org/bouncycastle/crypto/test/RegressionTest.java index 230145df52..5d09c15a1c 100644 --- a/core/src/test/jdk1.1/org/bouncycastle/crypto/test/RegressionTest.java +++ b/core/src/test/jdk1.1/org/bouncycastle/crypto/test/RegressionTest.java @@ -17,12 +17,12 @@ public class RegressionTest new PaddingTest(), new DHTest(), new ElGamalTest(), - new DSATest(), - new ECTest(), - new GOST3410Test(), - new ECGOST3410Test(), - new ECIESTest(), - new ECNRTest(), + //new DSATest(), + //new ECTest(), + //new GOST3410Test(), + //new ECGOST3410Test(), + //new ECIESTest(), + //new ECNRTest(), new MacTest(), new GOST28147MacTest(), new RC2Test(), @@ -118,7 +118,7 @@ public class RegressionTest new SCryptTest(), new ResetTest(), new NullTest(), - new DSTU4145Test(), + //new DSTU4145Test(), new Poly1305Test(), new OCBTest(), new NonMemoableDigestTest(), diff --git a/prov/src/main/jdk1.1/org/bouncycastle/jcajce/provider/symmetric/util/ClassUtil.java b/prov/src/main/jdk1.1/org/bouncycastle/jcajce/provider/symmetric/util/ClassUtil.java new file mode 100644 index 0000000000..d7cf9ef501 --- /dev/null +++ b/prov/src/main/jdk1.1/org/bouncycastle/jcajce/provider/symmetric/util/ClassUtil.java @@ -0,0 +1,27 @@ +package org.bouncycastle.jcajce.provider.symmetric.util; + +public class ClassUtil +{ + public static Class loadClass(Class sourceClass, final String className) + { + try + { + ClassLoader loader = sourceClass.getClassLoader(); + + if (loader != null) + { + return loader.loadClass(className); + } + else + { + return (Class)Class.forName(className); + } + } + catch (ClassNotFoundException e) + { + // ignore - maybe log? + } + + return null; + } +} diff --git a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/BouncyCastleProvider.java b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/BouncyCastleProvider.java index 62ab96ef56..9bdb213cd7 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/BouncyCastleProvider.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/BouncyCastleProvider.java @@ -71,7 +71,7 @@ public final class BouncyCastleProvider extends Provider "AES", "ARC4", "Blowfish", "Camellia", "CAST5", "CAST6", "ChaCha", "DES", "DESede", "GOST28147", "Grainv1", "Grain128", "HC128", "HC256", "IDEA", "Noekeon", "RC2", "RC5", "RC6", "Rijndael", "Salsa20", "SEED", "Serpent", "Shacal2", "Skipjack", "SM4", "TEA", "Twofish", "Threefish", - "VMPC", "VMPCKSA3", "XTEA", "XSalsa20", "OpenSSLPBKDF" + "VMPC", "VMPCKSA3", "XTEA", "XSalsa20", "OpenSSLPBKDF", "DSTU7624" }; /* @@ -88,7 +88,7 @@ public final class BouncyCastleProvider extends Provider private static final String[] ASYMMETRIC_CIPHERS = { - "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145" + "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145", "GM" }; /* @@ -98,7 +98,7 @@ public final class BouncyCastleProvider extends Provider private static final String[] DIGESTS = { "GOST3411", "Keccak", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA224", - "SHA256", "SHA384", "SHA512", "SHA3", "Skein", "SM3", "Tiger", "Whirlpool", "Blake2b" + "SHA256", "SHA384", "SHA512", "SHA3", "Skein", "SM3", "Tiger", "Whirlpool", "Blake2b", "DSTU7564" }; /* diff --git a/scripts/jdk1.1ed.sh b/scripts/jdk1.1ed.sh index fdfaf9b71c..c830b14e66 100644 --- a/scripts/jdk1.1ed.sh +++ b/scripts/jdk1.1ed.sh @@ -232,3 +232,15 @@ g/private final .*;/s/final// w q % + +ed org/bouncycastle/asn1/cryptopro/Gost2814789KeyWrapParameters.java <<% +g/private final .*;/s/final// +w +q +% + +ed org/bouncycastle/asn1/cryptopro/Gost2814789EncryptedKey.java <<% +g/private final .*;/s/final// +w +q +%