summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2014-02-13 01:02:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-13 01:02:34 +0000
commit2e413ba8dfbd9d6c7720afc36699b26eda7aebac (patch)
treeccaf9f831f637643ad1ca2d69680448481d7a361 /luni
parentda4b7effaad7a9cdc2bcb9b25b63b338308ae2d6 (diff)
parent16ec6489f8339c55fb65db423c4a997a9f91d089 (diff)
downloadlibcore-2e413ba8dfbd9d6c7720afc36699b26eda7aebac.zip
libcore-2e413ba8dfbd9d6c7720afc36699b26eda7aebac.tar.gz
libcore-2e413ba8dfbd9d6c7720afc36699b26eda7aebac.tar.bz2
Merge "Late binding: support NullCipher"
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/javax/crypto/Cipher.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/luni/src/main/java/javax/crypto/Cipher.java b/luni/src/main/java/javax/crypto/Cipher.java
index 9bca45e..2e3b341 100644
--- a/luni/src/main/java/javax/crypto/Cipher.java
+++ b/luni/src/main/java/javax/crypto/Cipher.java
@@ -139,6 +139,11 @@ public class Cipher {
private CipherSpi spiImpl;
/**
+ * The SPI implementation.
+ */
+ private final CipherSpi specifiedSpi;
+
+ /**
* The transformation.
*/
private final String transformation;
@@ -176,7 +181,7 @@ public class Cipher {
throw new NullPointerException("provider == null");
}
this.specifiedProvider = provider;
- this.spiImpl = cipherSpi;
+ this.specifiedSpi = cipherSpi;
this.transformation = transformation;
this.transformParts = null;
}
@@ -185,6 +190,7 @@ public class Cipher {
this.transformation = transformation;
this.transformParts = transformParts;
this.specifiedProvider = provider;
+ this.specifiedSpi = null;
}
@@ -336,6 +342,10 @@ public class Cipher {
* Makes sure a CipherSpi that matches this type is selected.
*/
private CipherSpi getSpi(Key key) {
+ if (specifiedSpi != null) {
+ return specifiedSpi;
+ }
+
synchronized (initLock) {
if (spiImpl != null && key == null) {
return spiImpl;