8214321: Misleading code in SSLCipher

Reviewed-by: ascarpino
This commit is contained in:
Xue-Lei Andrew Fan 2018-11-26 20:50:21 -08:00
parent b1c4b461f1
commit 23ecdbbc1d

View File

@ -530,22 +530,22 @@ enum SSLCipher {
ProtocolVersion protocolVersion,
SecretKey key, IvParameterSpec iv,
SecureRandom random) throws GeneralSecurityException {
if (readCipherGenerators.length == 0) {
if (writeCipherGenerators.length == 0) {
return null;
}
WriteCipherGenerator rcg = null;
WriteCipherGenerator wcg = null;
for (Map.Entry<WriteCipherGenerator,
ProtocolVersion[]> me : writeCipherGenerators) {
for (ProtocolVersion pv : me.getValue()) {
if (protocolVersion == pv) {
rcg = me.getKey();
wcg = me.getKey();
}
}
}
if (rcg != null) {
return rcg.createCipher(this, authenticator,
if (wcg != null) {
return wcg.createCipher(this, authenticator,
protocolVersion, transformation, key, iv, random);
}
return null;