mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8214098: sun.security.ssl.HandshakeHash.T12HandshakeHash constructor check backwards
Reviewed-by: xuelei
This commit is contained in:
parent
88c3b67eea
commit
2094d32f0f
1 changed files with 5 additions and 15 deletions
|
@ -518,10 +518,10 @@ final class HandshakeHash {
|
||||||
JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
|
JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
|
||||||
if (md instanceof Cloneable) {
|
if (md instanceof Cloneable) {
|
||||||
transcriptHash = new CloneableHash(md);
|
transcriptHash = new CloneableHash(md);
|
||||||
this.baos = null;
|
this.baos = new ByteArrayOutputStream();
|
||||||
} else {
|
} else {
|
||||||
transcriptHash = new NonCloneableHash(md);
|
transcriptHash = new NonCloneableHash(md);
|
||||||
this.baos = new ByteArrayOutputStream();
|
this.baos = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,26 +550,20 @@ final class HandshakeHash {
|
||||||
|
|
||||||
static final class T13HandshakeHash implements TranscriptHash {
|
static final class T13HandshakeHash implements TranscriptHash {
|
||||||
private final TranscriptHash transcriptHash;
|
private final TranscriptHash transcriptHash;
|
||||||
private final ByteArrayOutputStream baos;
|
|
||||||
|
|
||||||
T13HandshakeHash(CipherSuite cipherSuite) {
|
T13HandshakeHash(CipherSuite cipherSuite) {
|
||||||
MessageDigest md =
|
MessageDigest md =
|
||||||
JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
|
JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
|
||||||
if (md instanceof Cloneable) {
|
if (md instanceof Cloneable) {
|
||||||
transcriptHash = new CloneableHash(md);
|
transcriptHash = new CloneableHash(md);
|
||||||
this.baos = null;
|
|
||||||
} else {
|
} else {
|
||||||
transcriptHash = new NonCloneableHash(md);
|
transcriptHash = new NonCloneableHash(md);
|
||||||
this.baos = new ByteArrayOutputStream();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(byte[] input, int offset, int length) {
|
public void update(byte[] input, int offset, int length) {
|
||||||
transcriptHash.update(input, offset, length);
|
transcriptHash.update(input, offset, length);
|
||||||
if (baos != null) {
|
|
||||||
baos.write(input, offset, length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -579,13 +573,9 @@ final class HandshakeHash {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] archived() {
|
public byte[] archived() {
|
||||||
if (baos != null) {
|
// This method is not necessary in T13
|
||||||
return baos.toByteArray();
|
throw new UnsupportedOperationException(
|
||||||
} else {
|
"TLS 1.3 does not require archived.");
|
||||||
return transcriptHash.archived();
|
|
||||||
}
|
|
||||||
|
|
||||||
// throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue