Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
rockchip_libcore
Commits
8ae047f5
Commit
8ae047f5
authored
14 years ago
by
Brian Carlstrom
Committed by
Android (Google) Code Review
14 years ago
Browse files
Options
Download
Plain Diff
Merge "Change Engine.getInstance interfaces to make usage less error prone"
parents
490a5fc2
6cdb6b7e
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
129 additions
and
237 deletions
+129
-237
luni/src/main/java/java/security/AlgorithmParameterGenerator.java
.../main/java/java/security/AlgorithmParameterGenerator.java
+6
-11
luni/src/main/java/java/security/AlgorithmParameters.java
luni/src/main/java/java/security/AlgorithmParameters.java
+4
-10
luni/src/main/java/java/security/KeyFactory.java
luni/src/main/java/java/security/KeyFactory.java
+4
-8
luni/src/main/java/java/security/KeyPairGenerator.java
luni/src/main/java/java/security/KeyPairGenerator.java
+4
-12
luni/src/main/java/java/security/KeyStore.java
luni/src/main/java/java/security/KeyStore.java
+9
-13
luni/src/main/java/java/security/MessageDigest.java
luni/src/main/java/java/security/MessageDigest.java
+5
-13
luni/src/main/java/java/security/Policy.java
luni/src/main/java/java/security/Policy.java
+4
-11
luni/src/main/java/java/security/SecureRandom.java
luni/src/main/java/java/security/SecureRandom.java
+5
-9
luni/src/main/java/java/security/Signature.java
luni/src/main/java/java/security/Signature.java
+4
-12
luni/src/main/java/java/security/cert/CertPathBuilder.java
luni/src/main/java/java/security/cert/CertPathBuilder.java
+4
-9
luni/src/main/java/java/security/cert/CertPathValidator.java
luni/src/main/java/java/security/cert/CertPathValidator.java
+4
-10
luni/src/main/java/java/security/cert/CertStore.java
luni/src/main/java/java/security/cert/CertStore.java
+4
-10
luni/src/main/java/java/security/cert/CertificateFactory.java
.../src/main/java/java/security/cert/CertificateFactory.java
+4
-10
luni/src/main/java/javax/crypto/Cipher.java
luni/src/main/java/javax/crypto/Cipher.java
+44
-41
luni/src/main/java/javax/crypto/ExemptionMechanism.java
luni/src/main/java/javax/crypto/ExemptionMechanism.java
+4
-10
luni/src/main/java/javax/crypto/KeyAgreement.java
luni/src/main/java/javax/crypto/KeyAgreement.java
+4
-10
luni/src/main/java/javax/crypto/KeyGenerator.java
luni/src/main/java/javax/crypto/KeyGenerator.java
+4
-10
luni/src/main/java/javax/crypto/Mac.java
luni/src/main/java/javax/crypto/Mac.java
+4
-8
luni/src/main/java/javax/crypto/SecretKeyFactory.java
luni/src/main/java/javax/crypto/SecretKeyFactory.java
+4
-10
luni/src/main/java/javax/net/ssl/KeyManagerFactory.java
luni/src/main/java/javax/net/ssl/KeyManagerFactory.java
+4
-10
No files found.
luni/src/main/java/java/security/AlgorithmParameterGenerator.java
View file @
8ae047f5
...
...
@@ -90,12 +90,9 @@ public class AlgorithmParameterGenerator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
AlgorithmParameterGenerator
(
(
AlgorithmParameterGeneratorSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
AlgorithmParameterGenerator
((
AlgorithmParameterGeneratorSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -154,11 +151,9 @@ public class AlgorithmParameterGenerator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
AlgorithmParameterGenerator
(
(
AlgorithmParameterGeneratorSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
AlgorithmParameterGenerator
((
AlgorithmParameterGeneratorSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/AlgorithmParameters.java
View file @
8ae047f5
...
...
@@ -94,11 +94,8 @@ public class AlgorithmParameters {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
AlgorithmParameters
((
AlgorithmParametersSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
AlgorithmParameters
((
AlgorithmParametersSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -156,11 +153,8 @@ public class AlgorithmParameters {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
AlgorithmParameters
((
AlgorithmParametersSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
AlgorithmParameters
((
AlgorithmParametersSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/KeyFactory.java
View file @
8ae047f5
...
...
@@ -78,10 +78,8 @@ public class KeyFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyFactory
((
KeyFactorySpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyFactory
((
KeyFactorySpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -135,10 +133,8 @@ public class KeyFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyFactory
((
KeyFactorySpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyFactory
((
KeyFactorySpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/KeyPairGenerator.java
View file @
8ae047f5
...
...
@@ -82,13 +82,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
Object
spi
;
Provider
provider
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
spi
=
ENGINE
.
getSpi
();
provider
=
ENGINE
.
getProvider
();
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
Object
spi
=
sap
.
spi
;
Provider
provider
=
sap
.
provider
;
if
(
spi
instanceof
KeyPairGenerator
)
{
KeyPairGenerator
result
=
(
KeyPairGenerator
)
spi
;
result
.
algorithm
=
algorithm
;
...
...
@@ -149,11 +145,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
Object
spi
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
spi
=
ENGINE
.
getSpi
();
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
if
(
spi
instanceof
KeyPairGenerator
)
{
KeyPairGenerator
result
=
(
KeyPairGenerator
)
spi
;
result
.
algorithm
=
algorithm
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/KeyStore.java
View file @
8ae047f5
...
...
@@ -111,13 +111,11 @@ public class KeyStore {
if
(
type
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
try
{
ENGINE
.
getInstance
(
type
,
null
);
return
new
KeyStore
((
KeyStoreSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
type
);
}
catch
(
NoSuchAlgorithmException
e
)
{
try
{
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
type
,
null
);
return
new
KeyStore
((
KeyStoreSpi
)
sap
.
spi
,
sap
.
provider
,
type
);
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
KeyStoreException
(
e
.
getMessage
());
}
}
}
...
...
@@ -187,14 +185,12 @@ public class KeyStore {
throw
new
NullPointerException
();
}
// return KeyStore instance
synchronized
(
ENGINE
)
{
try
{
ENGINE
.
getInstance
(
type
,
provider
,
null
);
return
new
KeyStore
((
KeyStoreSpi
)
ENGINE
.
getSpi
(),
provider
,
type
);
}
catch
(
Exception
e
)
{
try
{
Object
spi
=
ENGINE
.
getInstance
(
type
,
provider
,
null
);
return
new
KeyStore
((
KeyStoreSpi
)
spi
,
provider
,
type
);
}
catch
(
Exception
e
)
{
// override exception
throw
new
KeyStoreException
(
e
.
getMessage
());
}
throw
new
KeyStoreException
(
e
.
getMessage
());
}
}
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/MessageDigest.java
View file @
8ae047f5
...
...
@@ -88,20 +88,16 @@ public abstract class MessageDigest extends MessageDigestSpi {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
Object
spi
;
Provider
provider
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
spi
=
ENGINE
.
getSpi
();
provider
=
ENGINE
.
getProvider
();
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
Object
spi
=
sap
.
spi
;
Provider
provider
=
sap
.
provider
;
if
(
spi
instanceof
MessageDigest
)
{
MessageDigest
result
=
(
MessageDigest
)
spi
;
result
.
algorithm
=
algorithm
;
result
.
provider
=
provider
;
return
result
;
}
return
new
MessageDigestImpl
((
MessageDigestSpi
)
s
pi
,
provider
,
algorithm
);
return
new
MessageDigestImpl
((
MessageDigestSpi
)
s
ap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -158,11 +154,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
Object
spi
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
spi
=
ENGINE
.
getSpi
();
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
if
(
spi
instanceof
MessageDigest
)
{
MessageDigest
result
=
(
MessageDigest
)
spi
;
result
.
algorithm
=
algorithm
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/Policy.java
View file @
8ae047f5
...
...
@@ -126,12 +126,8 @@ public abstract class Policy {
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
params
);
return
new
PolicyDelegate
((
PolicySpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
type
,
params
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
type
,
params
);
return
new
PolicyDelegate
((
PolicySpi
)
sap
.
spi
,
sap
.
provider
,
type
,
params
);
}
catch
(
NoSuchAlgorithmException
e
)
{
if
(
e
.
getCause
()
==
null
)
{
throw
e
;
...
...
@@ -242,11 +238,8 @@ public abstract class Policy {
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
provider
,
params
);
return
new
PolicyDelegate
((
PolicySpi
)
ENGINE
.
getSpi
(),
provider
,
type
,
params
);
}
Object
spi
=
ENGINE
.
getInstance
(
type
,
provider
,
params
);
return
new
PolicyDelegate
((
PolicySpi
)
spi
,
provider
,
type
,
params
);
}
catch
(
NoSuchAlgorithmException
e
)
{
if
(
e
.
getCause
()
==
null
)
{
throw
e
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/SecureRandom.java
View file @
8ae047f5
...
...
@@ -124,11 +124,9 @@ public class SecureRandom extends Random {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
SecureRandom
((
SecureRandomSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
SecureRandom
((
SecureRandomSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -185,10 +183,8 @@ public class SecureRandom extends Random {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
SecureRandom
((
SecureRandomSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
SecureRandom
((
SecureRandomSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/Signature.java
View file @
8ae047f5
...
...
@@ -101,13 +101,9 @@ public abstract class Signature extends SignatureSpi {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
Object
spi
;
Provider
provider
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
spi
=
ENGINE
.
getSpi
();
provider
=
ENGINE
.
getProvider
();
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
Object
spi
=
sap
.
spi
;
Provider
provider
=
sap
.
provider
;
if
(
spi
instanceof
Signature
)
{
Signature
result
=
(
Signature
)
spi
;
result
.
algorithm
=
algorithm
;
...
...
@@ -179,11 +175,7 @@ public abstract class Signature extends SignatureSpi {
private
static
Signature
getSignatureInstance
(
String
algorithm
,
Provider
provider
)
throws
NoSuchAlgorithmException
{
Object
spi
;
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
spi
=
ENGINE
.
getSpi
();
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
if
(
spi
instanceof
Signature
)
{
Signature
result
=
(
Signature
)
spi
;
result
.
algorithm
=
algorithm
;
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/cert/CertPathBuilder.java
View file @
8ae047f5
...
...
@@ -105,11 +105,8 @@ public class CertPathBuilder {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
CertPathBuilder
((
CertPathBuilderSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
CertPathBuilder
((
CertPathBuilderSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -165,10 +162,8 @@ public class CertPathBuilder {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
CertPathBuilder
((
CertPathBuilderSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
CertPathBuilder
((
CertPathBuilderSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/cert/CertPathValidator.java
View file @
8ae047f5
...
...
@@ -104,11 +104,8 @@ public class CertPathValidator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
CertPathValidator
((
CertPathValidatorSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
CertPathValidator
((
CertPathValidatorSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -166,11 +163,8 @@ public class CertPathValidator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
CertPathValidator
((
CertPathValidatorSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
CertPathValidator
((
CertPathValidatorSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/cert/CertStore.java
View file @
8ae047f5
...
...
@@ -101,11 +101,8 @@ public class CertStore {
throw
new
NullPointerException
();
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
params
);
return
new
CertStore
((
CertStoreSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
type
,
params
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
type
,
params
);
return
new
CertStore
((
CertStoreSpi
)
sap
.
spi
,
sap
.
provider
,
type
,
params
);
}
catch
(
NoSuchAlgorithmException
e
)
{
Throwable
th
=
e
.
getCause
();
if
(
th
==
null
)
{
...
...
@@ -182,11 +179,8 @@ public class CertStore {
throw
new
NullPointerException
();
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
provider
,
params
);
return
new
CertStore
((
CertStoreSpi
)
ENGINE
.
getSpi
(),
provider
,
type
,
params
);
}
Object
spi
=
ENGINE
.
getInstance
(
type
,
provider
,
params
);
return
new
CertStore
((
CertStoreSpi
)
spi
,
provider
,
type
,
params
);
}
catch
(
NoSuchAlgorithmException
e
)
{
Throwable
th
=
e
.
getCause
();
if
(
th
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/security/cert/CertificateFactory.java
View file @
8ae047f5
...
...
@@ -87,11 +87,8 @@ public class CertificateFactory {
throw
new
NullPointerException
();
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
null
);
return
new
CertificateFactory
((
CertificateFactorySpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
type
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
type
,
null
);
return
new
CertificateFactory
((
CertificateFactorySpi
)
sap
.
spi
,
sap
.
provider
,
type
);
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
CertificateException
(
e
);
}
...
...
@@ -156,11 +153,8 @@ public class CertificateFactory {
throw
new
NullPointerException
();
}
try
{
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
type
,
provider
,
null
);
return
new
CertificateFactory
((
CertificateFactorySpi
)
ENGINE
.
getSpi
(),
provider
,
type
);
}
Object
spi
=
ENGINE
.
getInstance
(
type
,
provider
,
null
);
return
new
CertificateFactory
((
CertificateFactorySpi
)
spi
,
provider
,
type
);
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
CertificateException
(
e
.
getMessage
());
}
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/Cipher.java
View file @
8ae047f5
...
...
@@ -264,51 +264,54 @@ public class Cipher {
boolean
needSetPadding
=
false
;
boolean
needSetMode
=
false
;
Object
engineSpi
;
Provider
engineProvider
;
synchronized
(
ENGINE
)
{
if
(
transf
[
1
]
==
null
&&
transf
[
2
]
==
null
)
{
// "algorithm"
if
(
provider
==
null
)
{
ENGINE
.
getInstance
(
transf
[
0
],
null
);
}
else
{
ENGINE
.
getInstance
(
transf
[
0
],
provider
,
null
);
}
Object
engineSpi
=
null
;
Provider
engineProvider
=
provider
;
if
(
transf
[
1
]
==
null
&&
transf
[
2
]
==
null
)
{
// "algorithm"
if
(
provider
==
null
)
{
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
transf
[
0
],
null
);
engineSpi
=
sap
.
spi
;
engineProvider
=
sap
.
provider
;
}
else
{
String
[]
searhOrder
=
{
transf
[
0
]
+
"/"
+
transf
[
1
]
+
"/"
+
transf
[
2
],
// "algorithm/mode/padding"
transf
[
0
]
+
"/"
+
transf
[
1
],
// "algorithm/mode"
transf
[
0
]
+
"//"
+
transf
[
2
],
// "algorithm//padding"
transf
[
0
]
// "algorithm"
};
int
i
;
for
(
i
=
0
;
i
<
searhOrder
.
length
;
i
++)
{
try
{
if
(
provider
==
null
)
{
ENGINE
.
getInstance
(
searhOrder
[
i
],
null
);
}
else
{
ENGINE
.
getInstance
(
searhOrder
[
i
],
provider
,
null
);
}
break
;
}
catch
(
NoSuchAlgorithmException
e
)
{
if
(
i
==
searhOrder
.
length
-
1
)
{
throw
new
NoSuchAlgorithmException
(
transformation
);
}
engineSpi
=
ENGINE
.
getInstance
(
transf
[
0
],
provider
,
null
);
}
}
else
{
String
[]
searchOrder
=
{
transf
[
0
]
+
"/"
+
transf
[
1
]
+
"/"
+
transf
[
2
],
// "algorithm/mode/padding"
transf
[
0
]
+
"/"
+
transf
[
1
],
// "algorithm/mode"
transf
[
0
]
+
"//"
+
transf
[
2
],
// "algorithm//padding"
transf
[
0
]
// "algorithm"
};
int
i
;
for
(
i
=
0
;
i
<
searchOrder
.
length
;
i
++)
{
try
{
if
(
provider
==
null
)
{
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
searchOrder
[
i
],
null
);
engineSpi
=
sap
.
spi
;
engineProvider
=
sap
.
provider
;
}
else
{
engineSpi
=
ENGINE
.
getInstance
(
searchOrder
[
i
],
provider
,
null
);
}
break
;
}
catch
(
NoSuchAlgorithmException
e
)
{
if
(
i
==
searchOrder
.
length
-
1
)
{
throw
new
NoSuchAlgorithmException
(
transformation
);
}
}
switch
(
i
)
{
case
1
:
// "algorithm/mode"
needSetPadding
=
true
;
break
;
case
2
:
// "algorithm//padding"
needSetMode
=
true
;
break
;
case
3
:
// "algorithm"
needSetPadding
=
true
;
needSetMode
=
true
;
}
}
engineSpi
=
ENGINE
.
getSpi
();
engineProvider
=
ENGINE
.
getProvider
();
switch
(
i
)
{
case
1
:
// "algorithm/mode"
needSetPadding
=
true
;
break
;
case
2
:
// "algorithm//padding"
needSetMode
=
true
;
break
;
case
3
:
// "algorithm"
needSetPadding
=
true
;
needSetMode
=
true
;
}
}
if
(
engineSpi
==
null
||
engineProvider
==
null
)
{
throw
new
NoSuchAlgorithmException
(
transformation
);
}
if
(!(
engineSpi
instanceof
CipherSpi
))
{
throw
new
NoSuchAlgorithmException
(
engineSpi
.
getClass
().
getName
());
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/ExemptionMechanism.java
View file @
8ae047f5
...
...
@@ -100,11 +100,8 @@ public class ExemptionMechanism {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
ExemptionMechanism
((
ExemptionMechanismSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
ExemptionMechanism
((
ExemptionMechanismSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -167,11 +164,8 @@ public class ExemptionMechanism {
if
(
provider
==
null
)
{
throw
new
IllegalArgumentException
(
"provider == null"
);
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
ExemptionMechanism
((
ExemptionMechanismSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
ExemptionMechanism
((
ExemptionMechanismSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/KeyAgreement.java
View file @
8ae047f5
...
...
@@ -101,11 +101,8 @@ public class KeyAgreement {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyAgreement
((
KeyAgreementSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyAgreement
((
KeyAgreementSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -166,11 +163,8 @@ public class KeyAgreement {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyAgreement
((
KeyAgreementSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyAgreement
((
KeyAgreementSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/KeyGenerator.java
View file @
8ae047f5
...
...
@@ -100,11 +100,8 @@ public class KeyGenerator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyGenerator
((
KeyGeneratorSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyGenerator
((
KeyGeneratorSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -163,11 +160,8 @@ public class KeyGenerator {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyGenerator
((
KeyGeneratorSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyGenerator
((
KeyGeneratorSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/Mac.java
View file @
8ae047f5
...
...
@@ -103,10 +103,8 @@ public class Mac implements Cloneable {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
Mac
((
MacSpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
Mac
((
MacSpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -167,10 +165,8 @@ public class Mac implements Cloneable {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
Mac
((
MacSpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
Mac
((
MacSpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/crypto/SecretKeyFactory.java
View file @
8ae047f5
...
...
@@ -105,11 +105,8 @@ public class SecretKeyFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
SecretKeyFactory
((
SecretKeyFactorySpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
SecretKeyFactory
((
SecretKeyFactorySpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -170,11 +167,8 @@ public class SecretKeyFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
();
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
SecretKeyFactory
((
SecretKeyFactorySpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
SecretKeyFactory
((
SecretKeyFactorySpi
)
spi
,
provider
,
algorithm
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/javax/net/ssl/KeyManagerFactory.java
View file @
8ae047f5
...
...
@@ -76,11 +76,8 @@ public class KeyManagerFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
(
"algorithm is null"
);
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyManagerFactory
((
KeyManagerFactorySpi
)
ENGINE
.
getSpi
(),
ENGINE
.
getProvider
(),
algorithm
);
}
Engine
.
SpiAndProvider
sap
=
ENGINE
.
getInstance
(
algorithm
,
null
);
return
new
KeyManagerFactory
((
KeyManagerFactorySpi
)
sap
.
spi
,
sap
.
provider
,
algorithm
);
}
/**
...
...
@@ -138,11 +135,8 @@ public class KeyManagerFactory {
if
(
algorithm
==
null
)
{
throw
new
NullPointerException
(
"algorithm is null"
);
}
synchronized
(
ENGINE
)
{
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyManagerFactory
((
KeyManagerFactorySpi
)
ENGINE
.
getSpi
(),
provider
,
algorithm
);
}
Object
spi
=
ENGINE
.
getInstance
(
algorithm
,
provider
,
null
);
return
new
KeyManagerFactory
((
KeyManagerFactorySpi
)
spi
,
provider
,
algorithm
);
}
// Store used provider
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment