summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:25:53 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:25:53 +0000
commit3b592c21fb450bc38c70c2fc3197f3df54413311 (patch)
tree16b30287d1aae0c26e4e761a023136f1ee8fb2ff
parent9feddff6f32c7987b7dcd4e04c8a9faf6f3de580 (diff)
parent14ceec126e49f2f4748f0d540be820515cc725a6 (diff)
downloadbouncycastle-3b592c21fb450bc38c70c2fc3197f3df54413311.tar.gz
Change-Id: I8a606a712f71964beca29768c343d7a072a02533
-rw-r--r--Android.bp101
-rw-r--r--PREUPLOAD.cfg2
-rw-r--r--bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java291
-rw-r--r--bcprov/src/main/java/org/bouncycastle/util/BigIntegers.java16
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/GeneralDigest.java4
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/MD4Digest.java296
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/SHA1Digest.java3
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/TEST_MAPPING12
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/jce/provider/TEST_MAPPING12
-rw-r--r--repackaged/bcprov/src/main/java/com/android/org/bouncycastle/util/BigIntegers.java16
-rw-r--r--srcgen/core-platform-api.txt10
11 files changed, 36 insertions, 727 deletions
diff --git a/Android.bp b/Android.bp
index d7a3b5dc..7d37383d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,15 +14,11 @@
// limitations under the License.
//
-package {
- default_visibility: ["//visibility:private"],
-}
-
java_defaults {
name: "bouncycastle-errorprone-defaults",
errorprone: {
javacflags: [
- "-Xep:MissingOverride:OFF", // Ignore missing @Override.
+ "-Xep:MissingOverride:OFF", // Ignore missing @Override.
],
},
}
@@ -46,13 +42,26 @@ java_defaults {
},
}
+// A bouncycastle library in the original org.bouncycastle package for use
+// outside of the platform. e.g. for host or in unbundled apps.
+java_library_static {
+ name: "bouncycastle-unbundled",
+ defaults: ["bouncycastle-defaults"],
+ host_supported: true,
+
+ srcs: ["bcprov/src/main/java/**/*.java"],
+ exclude_srcs: [
+ "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
+ ],
+
+ sdk_version: "core_current",
+ java_version: "1.7",
+}
+
// The src files for bouncycastle, used to generate core platform / intra-core
// API stubs.
filegroup {
name: "bouncycastle_java_files",
- visibility: [
- "//libcore",
- ],
srcs: ["repackaged/bcprov/src/main/java/**/*.java"],
}
@@ -61,19 +70,16 @@ filegroup {
// original org.bouncycastle package.
java_library {
name: "bouncycastle",
- // Restrict visibility to only those targets that need to access it.
- visibility: [
- "//art/build/apex",
- "//external/wycheproof",
- "//libcore",
- ],
defaults: ["bouncycastle-defaults"],
installable: true,
srcs: [":bouncycastle_java_files"],
- sdk_version: "none",
- system_modules: "art-module-intra-core-api-stubs-system-modules",
+ no_standard_libs: true,
+ libs: [
+ "core-all",
+ ],
+ system_modules: "core-all-system-modules",
}
// A guaranteed unstripped version of bouncycastle.
@@ -81,62 +87,26 @@ java_library {
// not be stripped. See b/24535627.
java_library {
name: "bouncycastle-testdex",
- visibility: [
- "//art:__subpackages__",
- ],
defaults: ["bouncycastle-defaults"],
installable: true,
srcs: [":bouncycastle_java_files"],
- sdk_version: "none",
- system_modules: "art-module-intra-core-api-stubs-system-modules",
+ no_standard_libs: true,
+ libs: [
+ "core-all",
+ ],
dex_preopt: {
enabled: false,
},
- java_version: "1.7",
-}
-
-unbundled_visibility = [
- "//build/make/tools/signapk",
- "//build/make/tools/signtos",
- "//cts/hostsidetests/devicepolicy/app/DeviceOwner",
- "//cts/tests/libcore/okhttp",
- "//cts/tests/security",
- "//cts/tests/tests/keystore",
- "//external/conscrypt",
- "//external/okhttp",
- "//external/robolectric-shadows",
- "//external/robolectric-shadows/robolectric",
- "//external/robolectric-shadows/shadows/supportv4",
- "//external/robolectric-shadows/shadows/httpclient",
- "//frameworks/opt/net/wifi/service",
- "//libcore",
- "//system/extras/verity",
-]
-
-// A bouncycastle library in the original org.bouncycastle package for use
-// outside of the platform. e.g. for host or in unbundled apps.
-java_library {
- name: "bouncycastle-unbundled",
- visibility: unbundled_visibility,
- defaults: ["bouncycastle-defaults"],
- host_supported: true,
-
- srcs: ["bcprov/src/main/java/**/*.java"],
- exclude_srcs: [
- "bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
- ],
-
- sdk_version: "core_current",
+ system_modules: "core-all-system-modules",
java_version: "1.7",
}
// Bouncycastle PKIX classes in the original org.bouncycastle package for use
// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
-java_library {
+java_library_static {
name: "bouncycastle-bcpkix-unbundled",
- visibility: unbundled_visibility,
defaults: ["bouncycastle-defaults"],
host_supported: true,
@@ -151,7 +121,6 @@ java_library {
// outside of the platform. e.g. for host or in unbundled apps / CTS tests.
java_library_static {
name: "bouncycastle-ocsp-unbundled",
- visibility: unbundled_visibility,
defaults: ["bouncycastle-defaults"],
host_supported: true,
@@ -159,19 +128,21 @@ java_library_static {
"bcpkix/src/main/java/org/bouncycastle/cert/ocsp/**/*.java",
"bcprov/src/main/java/org/bouncycastle/asn1/ocsp/**/*.java",
],
- libs: [
- "bouncycastle-unbundled",
- "bouncycastle-bcpkix-unbundled",
+ libs: [ "bouncycastle-unbundled",
+ "bouncycastle-bcpkix-unbundled"
],
sdk_version: "core_current",
}
// For compatibility with old bouncycastle-host name.
-//
-// When converting .mk files to .bp files do not change the visibility of this
-// module, instead replace usages of this with bouncycastle-unbundled.
java_library_host {
name: "bouncycastle-host",
static_libs: ["bouncycastle-unbundled"],
}
+
+// For compatibility with old bouncycastle-bcpkix-host name.
+java_library_host {
+ name: "bouncycastle-bcpkix-host",
+ static_libs: ["bouncycastle-bcpkix-unbundled"],
+}
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
deleted file mode 100644
index 321bab6f..00000000
--- a/PREUPLOAD.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[Builtin Hooks]
-bpfmt = true
diff --git a/bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java b/bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java
deleted file mode 100644
index 093e35db..00000000
--- a/bcprov/src/main/java/org/bouncycastle/crypto/digests/MD4Digest.java
+++ /dev/null
@@ -1,291 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-import org.bouncycastle.util.Memoable;
-
-/**
- * implementation of MD4 as RFC 1320 by R. Rivest, MIT Laboratory for
- * Computer Science and RSA Data Security, Inc.
- * <p>
- * <b>NOTE</b>: This algorithm is only included for backwards compatability
- * with legacy applications, it's not secure, don't use it for anything new!
- */
-public class MD4Digest
- extends GeneralDigest
-{
- private static final int DIGEST_LENGTH = 16;
-
- private int H1, H2, H3, H4; // IV's
-
- private int[] X = new int[16];
- private int xOff;
-
- /**
- * Standard constructor
- */
- public MD4Digest()
- {
- reset();
- }
-
- /**
- * Copy constructor. This will copy the state of the provided
- * message digest.
- */
- public MD4Digest(MD4Digest t)
- {
- super(t);
-
- copyIn(t);
- }
-
- private void copyIn(MD4Digest t)
- {
- super.copyIn(t);
-
- H1 = t.H1;
- H2 = t.H2;
- H3 = t.H3;
- H4 = t.H4;
-
- System.arraycopy(t.X, 0, X, 0, t.X.length);
- xOff = t.xOff;
- }
-
- public String getAlgorithmName()
- {
- return "MD4";
- }
-
- public int getDigestSize()
- {
- return DIGEST_LENGTH;
- }
-
- protected void processWord(
- byte[] in,
- int inOff)
- {
- X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
- | ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24);
-
- if (xOff == 16)
- {
- processBlock();
- }
- }
-
- protected void processLength(
- long bitLength)
- {
- if (xOff > 14)
- {
- processBlock();
- }
-
- X[14] = (int)(bitLength & 0xffffffff);
- X[15] = (int)(bitLength >>> 32);
- }
-
- private void unpackWord(
- int word,
- byte[] out,
- int outOff)
- {
- out[outOff] = (byte)word;
- out[outOff + 1] = (byte)(word >>> 8);
- out[outOff + 2] = (byte)(word >>> 16);
- out[outOff + 3] = (byte)(word >>> 24);
- }
-
- public int doFinal(
- byte[] out,
- int outOff)
- {
- finish();
-
- unpackWord(H1, out, outOff);
- unpackWord(H2, out, outOff + 4);
- unpackWord(H3, out, outOff + 8);
- unpackWord(H4, out, outOff + 12);
-
- reset();
-
- return DIGEST_LENGTH;
- }
-
- /**
- * reset the chaining variables to the IV values.
- */
- public void reset()
- {
- super.reset();
-
- H1 = 0x67452301;
- H2 = 0xefcdab89;
- H3 = 0x98badcfe;
- H4 = 0x10325476;
-
- xOff = 0;
-
- for (int i = 0; i != X.length; i++)
- {
- X[i] = 0;
- }
- }
-
- //
- // round 1 left rotates
- //
- private static final int S11 = 3;
- private static final int S12 = 7;
- private static final int S13 = 11;
- private static final int S14 = 19;
-
- //
- // round 2 left rotates
- //
- private static final int S21 = 3;
- private static final int S22 = 5;
- private static final int S23 = 9;
- private static final int S24 = 13;
-
- //
- // round 3 left rotates
- //
- private static final int S31 = 3;
- private static final int S32 = 9;
- private static final int S33 = 11;
- private static final int S34 = 15;
-
- /*
- * rotate int x left n bits.
- */
- private int rotateLeft(
- int x,
- int n)
- {
- return (x << n) | (x >>> (32 - n));
- }
-
- /*
- * F, G, H and I are the basic MD4 functions.
- */
- private int F(
- int u,
- int v,
- int w)
- {
- return (u & v) | (~u & w);
- }
-
- private int G(
- int u,
- int v,
- int w)
- {
- return (u & v) | (u & w) | (v & w);
- }
-
- private int H(
- int u,
- int v,
- int w)
- {
- return u ^ v ^ w;
- }
-
- protected void processBlock()
- {
- int a = H1;
- int b = H2;
- int c = H3;
- int d = H4;
-
- //
- // Round 1 - F cycle, 16 times.
- //
- a = rotateLeft(a + F(b, c, d) + X[ 0], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 1], S12);
- c = rotateLeft(c + F(d, a, b) + X[ 2], S13);
- b = rotateLeft(b + F(c, d, a) + X[ 3], S14);
- a = rotateLeft(a + F(b, c, d) + X[ 4], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 5], S12);
- c = rotateLeft(c + F(d, a, b) + X[ 6], S13);
- b = rotateLeft(b + F(c, d, a) + X[ 7], S14);
- a = rotateLeft(a + F(b, c, d) + X[ 8], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 9], S12);
- c = rotateLeft(c + F(d, a, b) + X[10], S13);
- b = rotateLeft(b + F(c, d, a) + X[11], S14);
- a = rotateLeft(a + F(b, c, d) + X[12], S11);
- d = rotateLeft(d + F(a, b, c) + X[13], S12);
- c = rotateLeft(c + F(d, a, b) + X[14], S13);
- b = rotateLeft(b + F(c, d, a) + X[15], S14);
-
- //
- // Round 2 - G cycle, 16 times.
- //
- a = rotateLeft(a + G(b, c, d) + X[ 0] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 4] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[ 8] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[12] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 1] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 5] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[ 9] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[13] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 2] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 6] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[10] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[14] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 3] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 7] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[11] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[15] + 0x5a827999, S24);
-
- //
- // Round 3 - H cycle, 16 times.
- //
- a = rotateLeft(a + H(b, c, d) + X[ 0] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[ 8] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 4] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[12] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 2] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[10] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 6] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[14] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 1] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[ 9] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 5] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[13] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 3] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[11] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 7] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[15] + 0x6ed9eba1, S34);
-
- H1 += a;
- H2 += b;
- H3 += c;
- H4 += d;
-
- //
- // reset the offset and clean out the word buffer.
- //
- xOff = 0;
- for (int i = 0; i != X.length; i++)
- {
- X[i] = 0;
- }
- }
-
- public Memoable copy()
- {
- return new MD4Digest(this);
- }
-
- public void reset(Memoable other)
- {
- MD4Digest d = (MD4Digest)other;
-
- copyIn(d);
- }
-}
diff --git a/bcprov/src/main/java/org/bouncycastle/util/BigIntegers.java b/bcprov/src/main/java/org/bouncycastle/util/BigIntegers.java
index 62be36ec..a118ba5a 100644
--- a/bcprov/src/main/java/org/bouncycastle/util/BigIntegers.java
+++ b/bcprov/src/main/java/org/bouncycastle/util/BigIntegers.java
@@ -141,15 +141,6 @@ public final class BigIntegers
return new BigInteger(1, createRandom(bitLength, random));
}
- // Hexadecimal value of the product of the 131 smallest odd primes from 3 to 743
- private static final BigInteger SMALL_PRIMES_PRODUCT = new BigInteger(
- "8138e8a0fcf3a4e84a771d40fd305d7f4aa59306d7251de54d98af8fe95729a1f"
- + "73d893fa424cd2edc8636a6c3285e022b0e3866a565ae8108eed8591cd4fe8d2"
- + "ce86165a978d719ebf647f362d33fca29cd179fb42401cbaf3df0c614056f9c8"
- + "f3cfd51e474afb6bc6974f78db8aba8e9e517fded658591ab7502bd41849462f",
- 16);
- private static final int SQR_MAX_SMALL = 20; // bitlength of 743 * 743
-
/**
* Return a prime number candidate of the specified bit length.
*
@@ -183,13 +174,6 @@ public final class BigIntegers
base[base.length - 1] |= 0x01;
rv = new BigInteger(1, base);
- if (bitLength > SQR_MAX_SMALL)
- {
- while (!rv.gcd(SMALL_PRIMES_PRODUCT).equals(ONE))
- {
- rv = rv.add(TWO);
- }
- }
}
while (!rv.isProbablePrime(certainty));
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/GeneralDigest.java b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/GeneralDigest.java
index 690c63dd..c075dce5 100644
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/GeneralDigest.java
+++ b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/GeneralDigest.java
@@ -10,7 +10,6 @@ import com.android.org.bouncycastle.util.Pack;
* "Handbook of Applied Cryptography", pages 344 - 347.
* @hide This class is not part of the Android public SDK API
*/
-@libcore.api.CorePlatformApi
public abstract class GeneralDigest
implements ExtendedDigest, Memoable
{
@@ -68,7 +67,6 @@ public abstract class GeneralDigest
byteCount++;
}
- @libcore.api.CorePlatformApi
public void update(
byte[] in,
int inOff,
@@ -114,7 +112,6 @@ public abstract class GeneralDigest
byteCount += len;
}
- @libcore.api.CorePlatformApi
public void finish()
{
long bitLength = (byteCount << 3);
@@ -161,6 +158,5 @@ public abstract class GeneralDigest
protected abstract void processLength(long bitLength);
- @libcore.api.CorePlatformApi
protected abstract void processBlock();
}
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/MD4Digest.java b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/MD4Digest.java
deleted file mode 100644
index 3a30b95d..00000000
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/MD4Digest.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/* GENERATED SOURCE. DO NOT MODIFY. */
-package com.android.org.bouncycastle.crypto.digests;
-
-
-import com.android.org.bouncycastle.util.Memoable;
-
-/**
- * implementation of MD4 as RFC 1320 by R. Rivest, MIT Laboratory for
- * Computer Science and RSA Data Security, Inc.
- * <p>
- * <b>NOTE</b>: This algorithm is only included for backwards compatability
- * with legacy applications, it's not secure, don't use it for anything new!
- * @hide This class is not part of the Android public SDK API
- */
-@libcore.api.CorePlatformApi
-public class MD4Digest
- extends GeneralDigest
-{
- private static final int DIGEST_LENGTH = 16;
-
- private int H1, H2, H3, H4; // IV's
-
- private int[] X = new int[16];
- private int xOff;
-
- /**
- * Standard constructor
- */
- @libcore.api.CorePlatformApi
- public MD4Digest()
- {
- reset();
- }
-
- /**
- * Copy constructor. This will copy the state of the provided
- * message digest.
- */
- public MD4Digest(MD4Digest t)
- {
- super(t);
-
- copyIn(t);
- }
-
- private void copyIn(MD4Digest t)
- {
- super.copyIn(t);
-
- H1 = t.H1;
- H2 = t.H2;
- H3 = t.H3;
- H4 = t.H4;
-
- System.arraycopy(t.X, 0, X, 0, t.X.length);
- xOff = t.xOff;
- }
-
- public String getAlgorithmName()
- {
- return "MD4";
- }
-
- public int getDigestSize()
- {
- return DIGEST_LENGTH;
- }
-
- protected void processWord(
- byte[] in,
- int inOff)
- {
- X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
- | ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24);
-
- if (xOff == 16)
- {
- processBlock();
- }
- }
-
- protected void processLength(
- long bitLength)
- {
- if (xOff > 14)
- {
- processBlock();
- }
-
- X[14] = (int)(bitLength & 0xffffffff);
- X[15] = (int)(bitLength >>> 32);
- }
-
- private void unpackWord(
- int word,
- byte[] out,
- int outOff)
- {
- out[outOff] = (byte)word;
- out[outOff + 1] = (byte)(word >>> 8);
- out[outOff + 2] = (byte)(word >>> 16);
- out[outOff + 3] = (byte)(word >>> 24);
- }
-
- @libcore.api.CorePlatformApi
- public int doFinal(
- byte[] out,
- int outOff)
- {
- finish();
-
- unpackWord(H1, out, outOff);
- unpackWord(H2, out, outOff + 4);
- unpackWord(H3, out, outOff + 8);
- unpackWord(H4, out, outOff + 12);
-
- reset();
-
- return DIGEST_LENGTH;
- }
-
- /**
- * reset the chaining variables to the IV values.
- */
- public void reset()
- {
- super.reset();
-
- H1 = 0x67452301;
- H2 = 0xefcdab89;
- H3 = 0x98badcfe;
- H4 = 0x10325476;
-
- xOff = 0;
-
- for (int i = 0; i != X.length; i++)
- {
- X[i] = 0;
- }
- }
-
- //
- // round 1 left rotates
- //
- private static final int S11 = 3;
- private static final int S12 = 7;
- private static final int S13 = 11;
- private static final int S14 = 19;
-
- //
- // round 2 left rotates
- //
- private static final int S21 = 3;
- private static final int S22 = 5;
- private static final int S23 = 9;
- private static final int S24 = 13;
-
- //
- // round 3 left rotates
- //
- private static final int S31 = 3;
- private static final int S32 = 9;
- private static final int S33 = 11;
- private static final int S34 = 15;
-
- /*
- * rotate int x left n bits.
- */
- private int rotateLeft(
- int x,
- int n)
- {
- return (x << n) | (x >>> (32 - n));
- }
-
- /*
- * F, G, H and I are the basic MD4 functions.
- */
- private int F(
- int u,
- int v,
- int w)
- {
- return (u & v) | (~u & w);
- }
-
- private int G(
- int u,
- int v,
- int w)
- {
- return (u & v) | (u & w) | (v & w);
- }
-
- private int H(
- int u,
- int v,
- int w)
- {
- return u ^ v ^ w;
- }
-
- protected void processBlock()
- {
- int a = H1;
- int b = H2;
- int c = H3;
- int d = H4;
-
- //
- // Round 1 - F cycle, 16 times.
- //
- a = rotateLeft(a + F(b, c, d) + X[ 0], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 1], S12);
- c = rotateLeft(c + F(d, a, b) + X[ 2], S13);
- b = rotateLeft(b + F(c, d, a) + X[ 3], S14);
- a = rotateLeft(a + F(b, c, d) + X[ 4], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 5], S12);
- c = rotateLeft(c + F(d, a, b) + X[ 6], S13);
- b = rotateLeft(b + F(c, d, a) + X[ 7], S14);
- a = rotateLeft(a + F(b, c, d) + X[ 8], S11);
- d = rotateLeft(d + F(a, b, c) + X[ 9], S12);
- c = rotateLeft(c + F(d, a, b) + X[10], S13);
- b = rotateLeft(b + F(c, d, a) + X[11], S14);
- a = rotateLeft(a + F(b, c, d) + X[12], S11);
- d = rotateLeft(d + F(a, b, c) + X[13], S12);
- c = rotateLeft(c + F(d, a, b) + X[14], S13);
- b = rotateLeft(b + F(c, d, a) + X[15], S14);
-
- //
- // Round 2 - G cycle, 16 times.
- //
- a = rotateLeft(a + G(b, c, d) + X[ 0] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 4] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[ 8] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[12] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 1] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 5] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[ 9] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[13] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 2] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 6] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[10] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[14] + 0x5a827999, S24);
- a = rotateLeft(a + G(b, c, d) + X[ 3] + 0x5a827999, S21);
- d = rotateLeft(d + G(a, b, c) + X[ 7] + 0x5a827999, S22);
- c = rotateLeft(c + G(d, a, b) + X[11] + 0x5a827999, S23);
- b = rotateLeft(b + G(c, d, a) + X[15] + 0x5a827999, S24);
-
- //
- // Round 3 - H cycle, 16 times.
- //
- a = rotateLeft(a + H(b, c, d) + X[ 0] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[ 8] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 4] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[12] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 2] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[10] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 6] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[14] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 1] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[ 9] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 5] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[13] + 0x6ed9eba1, S34);
- a = rotateLeft(a + H(b, c, d) + X[ 3] + 0x6ed9eba1, S31);
- d = rotateLeft(d + H(a, b, c) + X[11] + 0x6ed9eba1, S32);
- c = rotateLeft(c + H(d, a, b) + X[ 7] + 0x6ed9eba1, S33);
- b = rotateLeft(b + H(c, d, a) + X[15] + 0x6ed9eba1, S34);
-
- H1 += a;
- H2 += b;
- H3 += c;
- H4 += d;
-
- //
- // reset the offset and clean out the word buffer.
- //
- xOff = 0;
- for (int i = 0; i != X.length; i++)
- {
- X[i] = 0;
- }
- }
-
- public Memoable copy()
- {
- return new MD4Digest(this);
- }
-
- public void reset(Memoable other)
- {
- MD4Digest d = (MD4Digest)other;
-
- copyIn(d);
- }
-}
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/SHA1Digest.java b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/SHA1Digest.java
index 78750ea2..ebc5bfe4 100644
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/SHA1Digest.java
+++ b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/SHA1Digest.java
@@ -11,7 +11,6 @@ import com.android.org.bouncycastle.util.Pack;
* is the "endianness" of the word processing!
* @hide This class is not part of the Android public SDK API
*/
-@libcore.api.CorePlatformApi
public class SHA1Digest
extends GeneralDigest
implements EncodableDigest
@@ -26,7 +25,6 @@ public class SHA1Digest
/**
* Standard constructor
*/
- @libcore.api.CorePlatformApi
public SHA1Digest()
{
reset();
@@ -117,7 +115,6 @@ public class SHA1Digest
X[15] = (int)bitLength;
}
- @libcore.api.CorePlatformApi
public int doFinal(
byte[] out,
int outOff)
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/TEST_MAPPING b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/TEST_MAPPING
deleted file mode 100644
index bb85335f..00000000
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/digests/TEST_MAPPING
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsLibcoreTestCases",
- "options": [
- {
- "include-filter": "tests.com.android.org.bouncycastle.crypto.digests"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/jce/provider/TEST_MAPPING b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/jce/provider/TEST_MAPPING
deleted file mode 100644
index 4f6eb018..00000000
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/jce/provider/TEST_MAPPING
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsLibcoreTestCases",
- "options": [
- {
- "include-filter": "tests.com.android.org.bouncycastle.jce.provider"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/util/BigIntegers.java b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/util/BigIntegers.java
index 93e1a779..fe7dbb8c 100644
--- a/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/util/BigIntegers.java
+++ b/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/util/BigIntegers.java
@@ -143,15 +143,6 @@ public final class BigIntegers
return new BigInteger(1, createRandom(bitLength, random));
}
- // Hexadecimal value of the product of the 131 smallest odd primes from 3 to 743
- private static final BigInteger SMALL_PRIMES_PRODUCT = new BigInteger(
- "8138e8a0fcf3a4e84a771d40fd305d7f4aa59306d7251de54d98af8fe95729a1f"
- + "73d893fa424cd2edc8636a6c3285e022b0e3866a565ae8108eed8591cd4fe8d2"
- + "ce86165a978d719ebf647f362d33fca29cd179fb42401cbaf3df0c614056f9c8"
- + "f3cfd51e474afb6bc6974f78db8aba8e9e517fded658591ab7502bd41849462f",
- 16);
- private static final int SQR_MAX_SMALL = 20; // bitlength of 743 * 743
-
/**
* Return a prime number candidate of the specified bit length.
*
@@ -185,13 +176,6 @@ public final class BigIntegers
base[base.length - 1] |= 0x01;
rv = new BigInteger(1, base);
- if (bitLength > SQR_MAX_SMALL)
- {
- while (!rv.gcd(SMALL_PRIMES_PRODUCT).equals(ONE))
- {
- rv = rv.add(TWO);
- }
- }
}
while (!rv.isProbablePrime(certainty));
diff --git a/srcgen/core-platform-api.txt b/srcgen/core-platform-api.txt
index 9c723a95..394f7d96 100644
--- a/srcgen/core-platform-api.txt
+++ b/srcgen/core-platform-api.txt
@@ -75,13 +75,6 @@ method:com.android.org.bouncycastle.asn1.x509.X509Name#getOIDs()
method:com.android.org.bouncycastle.asn1.x509.X509Name#getValues()
method:com.android.org.bouncycastle.asn1.x509.X509Name#toString(boolean,Hashtable)
method:com.android.org.bouncycastle.asn1.x509.X509Name#X509Name(String)
-method:com.android.org.bouncycastle.crypto.digests.GeneralDigest#finish()
-method:com.android.org.bouncycastle.crypto.digests.GeneralDigest#processBlock()
-method:com.android.org.bouncycastle.crypto.digests.GeneralDigest#update(byte[],int,int)
-method:com.android.org.bouncycastle.crypto.digests.MD4Digest#MD4Digest()
-method:com.android.org.bouncycastle.crypto.digests.MD4Digest#doFinal(byte[],int)
-method:com.android.org.bouncycastle.crypto.digests.SHA1Digest#SHA1Digest()
-method:com.android.org.bouncycastle.crypto.digests.SHA1Digest#doFinal(byte[],int)
method:com.android.org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator#generateDerivedParameters(int)
method:com.android.org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator#init(byte[],byte[])
method:com.android.org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator#OpenSSLPBEParametersGenerator()
@@ -153,9 +146,6 @@ type:com.android.org.bouncycastle.asn1.x509.V3TBSCertificateGenerator
type:com.android.org.bouncycastle.asn1.x509.X509Name
type:com.android.org.bouncycastle.asn1.x9.X9ObjectIdentifiers
type:com.android.org.bouncycastle.crypto.CipherParameters
-type:com.android.org.bouncycastle.crypto.digests.GeneralDigest
-type:com.android.org.bouncycastle.crypto.digests.MD4Digest
-type:com.android.org.bouncycastle.crypto.digests.SHA1Digest
type:com.android.org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator
type:com.android.org.bouncycastle.crypto.params.KeyParameter
type:com.android.org.bouncycastle.crypto.PBEParametersGenerator