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);
|
||||
if (md instanceof Cloneable) {
|
||||
transcriptHash = new CloneableHash(md);
|
||||
this.baos = null;
|
||||
this.baos = new ByteArrayOutputStream();
|
||||
} else {
|
||||
transcriptHash = new NonCloneableHash(md);
|
||||
this.baos = new ByteArrayOutputStream();
|
||||
this.baos = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,26 +550,20 @@ final class HandshakeHash {
|
|||
|
||||
static final class T13HandshakeHash implements TranscriptHash {
|
||||
private final TranscriptHash transcriptHash;
|
||||
private final ByteArrayOutputStream baos;
|
||||
|
||||
T13HandshakeHash(CipherSuite cipherSuite) {
|
||||
MessageDigest md =
|
||||
JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
|
||||
if (md instanceof Cloneable) {
|
||||
transcriptHash = new CloneableHash(md);
|
||||
this.baos = null;
|
||||
} else {
|
||||
transcriptHash = new NonCloneableHash(md);
|
||||
this.baos = new ByteArrayOutputStream();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(byte[] input, int offset, int length) {
|
||||
transcriptHash.update(input, offset, length);
|
||||
if (baos != null) {
|
||||
baos.write(input, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -579,13 +573,9 @@ final class HandshakeHash {
|
|||
|
||||
@Override
|
||||
public byte[] archived() {
|
||||
if (baos != null) {
|
||||
return baos.toByteArray();
|
||||
} else {
|
||||
return transcriptHash.archived();
|
||||
}
|
||||
|
||||
// throw new UnsupportedOperationException("Not supported yet.");
|
||||
// This method is not necessary in T13
|
||||
throw new UnsupportedOperationException(
|
||||
"TLS 1.3 does not require archived.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue