summaryrefslogtreecommitdiff
path: root/bcprov
diff options
context:
space:
mode:
authorDaulet Zhanguzin <dauletz@google.com>2020-05-04 11:23:29 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-05-04 11:23:29 +0000
commit105445433dfb81761347d614d691721a4fe1c5d0 (patch)
tree31283887b47b9028d35377ea7968972170221d0c /bcprov
parenta437218c155bcb5c4b9170cf82630adcc376e5a5 (diff)
parenta3e65f8fbc00a7ac115487e5f86101985961f2ee (diff)
downloadbouncycastle-105445433dfb81761347d614d691721a4fe1c5d0.tar.gz
Merge "Revert "Match ciphers by exact mode name""
Diffstat (limited to 'bcprov')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java23
1 files changed, 7 insertions, 16 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java
index 269edf67..d3d04db4 100644
--- a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java
+++ b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/symmetric/util/BaseBlockCipher.java
@@ -300,23 +300,18 @@ public class BaseBlockCipher
{
modeName = Strings.toUpperCase(mode);
- // Android-changed: Ignore case since modes are case insensitive
- // https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html
- if (modeName.equalsIgnoreCase("ECB"))
+ if (modeName.equals("ECB"))
{
ivLength = 0;
cipher = new BufferedGenericBlockCipher(baseEngine);
}
- // Android-changed: Ignore case since modes are case insensitive
- // https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html
- else if (modeName.equalsIgnoreCase("CBC"))
+ else if (modeName.equals("CBC"))
{
ivLength = baseEngine.getBlockSize();
cipher = new BufferedGenericBlockCipher(
new CBCBlockCipher(baseEngine));
}
- // Android-changed: Use equals instead of startsWith to avoid unintentional matches
- else if (modeName.equalsIgnoreCase("OFB"))
+ else if (modeName.startsWith("OFB"))
{
ivLength = baseEngine.getBlockSize();
if (modeName.length() != 3)
@@ -332,8 +327,7 @@ public class BaseBlockCipher
new OFBBlockCipher(baseEngine, 8 * baseEngine.getBlockSize()));
}
}
- // Android-changed: Use equals instead of startsWith to avoid unintentional matches
- else if (modeName.equalsIgnoreCase("CFB"))
+ else if (modeName.startsWith("CFB"))
{
ivLength = baseEngine.getBlockSize();
if (modeName.length() != 3)
@@ -378,8 +372,7 @@ public class BaseBlockCipher
}
*/
// END Android-removed: Unsupported modes
- // Android-changed: Use equals instead of startsWith to avoid unintentional matches
- else if (modeName.equalsIgnoreCase("CTR"))
+ else if (modeName.startsWith("CTR"))
{
ivLength = baseEngine.getBlockSize();
fixedIv = false;
@@ -415,14 +408,12 @@ public class BaseBlockCipher
}
*/
// END Android-removed: Unsupported modes
- // Android-changed: Use equals instead of startsWith to avoid unintentional matches
- else if (modeName.equalsIgnoreCase("CTS"))
+ else if (modeName.startsWith("CTS"))
{
ivLength = baseEngine.getBlockSize();
cipher = new BufferedGenericBlockCipher(new CTSBlockCipher(new CBCBlockCipher(baseEngine)));
}
- // Android-changed: Use equals instead of startsWith to avoid unintentional matches
- else if (modeName.equalsIgnoreCase("CCM"))
+ else if (modeName.startsWith("CCM"))
{
ivLength = 12; // CCM nonce 7..13 bytes
// BEGIN Android-removed: Unsupported algorithms