am b8bddcfe: Merge "Restore PBE Cipher wrap and unwrap support from upstream"
# Via Brian Carlstrom (1) and Gerrit Code Review (1)
* commit 'b8bddcfe1c0fdb5fd26a0285673f7d4d488dbab7':
Restore PBE Cipher wrap and unwrap support from upstream
diff --git a/Android.mk b/Android.mk
index 1a8345c..0b8c767 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,12 +15,15 @@
#
LOCAL_PATH := $(call my-dir)
+# used for bouncycastle-hostdex where we want everything for testing
all_bcprov_src_files := $(call all-java-files-under,bcprov/src/main/java)
+# used for bouncycastle for target where we want to be sure to use OpenSSLDigest
android_bcprov_src_files := $(filter-out \
bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactoryBouncyCastle.java, \
$(all_bcprov_src_files))
+# used for bouncycastle-host where we can't use OpenSSLDigest
ri_bcprov_src_files := $(filter-out \
bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactoryOpenSSL.java \
bcprov/src/main/java/org/bouncycastle/crypto/digests/OpenSSLDigest.java, \
@@ -34,6 +37,7 @@
LOCAL_JAVA_LIBRARIES := core
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_JAVA_LIBRARY)
# This is used to generate a list of what is unused so it can be removed when bouncycastle is updated.
@@ -80,11 +84,12 @@
include $(CLEAR_VARS)
LOCAL_MODULE := bouncycastle-hostdex
LOCAL_MODULE_TAGS := optional
- LOCAL_SRC_FILES := $(android_bcprov_src_files)
+ LOCAL_SRC_FILES := $(all_bcprov_src_files)
LOCAL_JAVACFLAGS := -encoding UTF-8
LOCAL_BUILD_HOST_DEX := true
LOCAL_MODULE_TAGS := optional
LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
+ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_HOST_JAVA_LIBRARY)
endif
@@ -94,6 +99,7 @@
LOCAL_SRC_FILES := $(ri_bcprov_src_files)
LOCAL_JAVACFLAGS := -encoding UTF-8
LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_HOST_JAVA_LIBRARY)
include $(CLEAR_VARS)
@@ -103,4 +109,5 @@
LOCAL_JAVACFLAGS := -encoding UTF-8
LOCAL_MODULE_TAGS := optional
LOCAL_JAVA_LIBRARIES := bouncycastle-host
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactory.java b/bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactory.java
index 1a82a46..3dc7059 100644
--- a/bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactory.java
+++ b/bcprov/src/main/java/org/bouncycastle/crypto/digests/AndroidDigestFactory.java
@@ -33,11 +33,13 @@
Class factoryImplementationClass;
try {
factoryImplementationClass = Class.forName(OpenSSLFactoryClassName);
+ // Double check for NativeCrypto in case we are running on RI for testing
+ Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto");
} catch (ClassNotFoundException e1) {
try {
factoryImplementationClass = Class.forName(BouncyCastleFactoryClassName);
} catch (ClassNotFoundException e2) {
- throw new AssertionError("Failed to find AndroidDigestFactoryInterface "
+ throw new AssertionError("Failed to load AndroidDigestFactoryInterface "
+ "implementation. Looked for "
+ OpenSSLFactoryClassName + " and "
+ BouncyCastleFactoryClassName);
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/provider/CertBlacklist.java b/bcprov/src/main/java/org/bouncycastle/jce/provider/CertBlacklist.java
index fee3ea8..6cc8927 100644
--- a/bcprov/src/main/java/org/bouncycastle/jce/provider/CertBlacklist.java
+++ b/bcprov/src/main/java/org/bouncycastle/jce/provider/CertBlacklist.java
@@ -135,7 +135,9 @@
new BigInteger("d7558fdaf5f1105bb213282b707729a3", 16),
new BigInteger("f5c86af36162f13a64f54f6dc9587c06", 16),
new BigInteger("392a434f0e07df1f8aa305de34e0c229", 16),
- new BigInteger("3e75ced46b693021218830ae86a82a71", 16)
+ new BigInteger("3e75ced46b693021218830ae86a82a71", 16),
+ new BigInteger("864", 16),
+ new BigInteger("827", 16)
));
// attempt to augment it with values taken from gservices
@@ -176,7 +178,13 @@
// From http://src.chromium.org/viewvc/chrome?view=rev&revision=108479
// Subject: O=Digicert Sdn. Bhd.
// Issuer: CN=GTE CyberTrust Global Root
- "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes()
+ "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes(),
+ // Subject: CN=e-islem.kktcmerkezbankasi.org/emailAddress=ileti@kktcmerkezbankasi.org
+ // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri
+ "5f3ab33d55007054bc5e3e5553cd8d8465d77c61".getBytes(),
+ // Subject: CN=*.EGO.GOV.TR 93
+ // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri
+ "783333c9687df63377efceddd82efa9101913e8e".getBytes()
));
// attempt to augment it with values taken from gservices
diff --git a/patches/bcprov.patch b/patches/bcprov.patch
index a5940ac..698151f 100644
--- a/patches/bcprov.patch
+++ b/patches/bcprov.patch
@@ -541,8 +541,8 @@
}
diff -Naur bcprov-jdk15on-147.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java bcprov-jdk15on-147/org/bouncycastle/crypto/digests/AndroidDigestFactory.java
--- bcprov-jdk15on-147.orig/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 1970-01-01 00:00:00.000000000 +0000
-+++ bcprov-jdk15on-147/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 2012-09-17 23:04:47.000000000 +0000
-@@ -0,0 +1,78 @@
++++ bcprov-jdk15on-147/org/bouncycastle/crypto/digests/AndroidDigestFactory.java 2012-09-28 17:07:22.000000000 +0000
+@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
@@ -578,11 +578,13 @@
+ Class factoryImplementationClass;
+ try {
+ factoryImplementationClass = Class.forName(OpenSSLFactoryClassName);
++ // Double check for NativeCrypto in case we are running on RI for testing
++ Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto");
+ } catch (ClassNotFoundException e1) {
+ try {
+ factoryImplementationClass = Class.forName(BouncyCastleFactoryClassName);
+ } catch (ClassNotFoundException e2) {
-+ throw new AssertionError("Failed to find AndroidDigestFactoryInterface "
++ throw new AssertionError("Failed to load AndroidDigestFactoryInterface "
+ + "implementation. Looked for "
+ + OpenSSLFactoryClassName + " and "
+ + BouncyCastleFactoryClassName);
@@ -6821,8 +6823,8 @@
diff -Naur bcprov-jdk15on-147.orig/org/bouncycastle/jce/provider/CertBlacklist.java bcprov-jdk15on-147/org/bouncycastle/jce/provider/CertBlacklist.java
--- bcprov-jdk15on-147.orig/org/bouncycastle/jce/provider/CertBlacklist.java 1970-01-01 00:00:00.000000000 +0000
-+++ bcprov-jdk15on-147/org/bouncycastle/jce/provider/CertBlacklist.java 2012-09-17 23:04:47.000000000 +0000
-@@ -0,0 +1,216 @@
++++ bcprov-jdk15on-147/org/bouncycastle/jce/provider/CertBlacklist.java 2013-01-16 01:38:43.000000000 +0000
+@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
@@ -6960,7 +6962,9 @@
+ new BigInteger("d7558fdaf5f1105bb213282b707729a3", 16),
+ new BigInteger("f5c86af36162f13a64f54f6dc9587c06", 16),
+ new BigInteger("392a434f0e07df1f8aa305de34e0c229", 16),
-+ new BigInteger("3e75ced46b693021218830ae86a82a71", 16)
++ new BigInteger("3e75ced46b693021218830ae86a82a71", 16),
++ new BigInteger("864", 16),
++ new BigInteger("827", 16)
+ ));
+
+ // attempt to augment it with values taken from gservices
@@ -7001,7 +7005,13 @@
+ // From http://src.chromium.org/viewvc/chrome?view=rev&revision=108479
+ // Subject: O=Digicert Sdn. Bhd.
+ // Issuer: CN=GTE CyberTrust Global Root
-+ "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes()
++ "0129bcd5b448ae8d2496d1c3e19723919088e152".getBytes(),
++ // Subject: CN=e-islem.kktcmerkezbankasi.org/emailAddress=ileti@kktcmerkezbankasi.org
++ // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri
++ "5f3ab33d55007054bc5e3e5553cd8d8465d77c61".getBytes(),
++ // Subject: CN=*.EGO.GOV.TR 93
++ // Issuer: CN=T\xC3\x9CRKTRUST Elektronik Sunucu Sertifikas\xC4\xB1 Hizmetleri
++ "783333c9687df63377efceddd82efa9101913e8e".getBytes()
+ ));
+
+ // attempt to augment it with values taken from gservices