diff --git a/src/java.base/share/classes/sun/security/ssl/Finished.java b/src/java.base/share/classes/sun/security/ssl/Finished.java index 01fdf4766415e..2e52d30992cf3 100644 --- a/src/java.base/share/classes/sun/security/ssl/Finished.java +++ b/src/java.base/share/classes/sun/security/ssl/Finished.java @@ -265,8 +265,7 @@ public byte[] createVerifyData(HandshakeContext context, "Invalid PRF output, format must be RAW. " + "Format received: " + prfKey.getFormat()); } - byte[] finished = prfKey.getEncoded(); - return finished; + return prfKey.getEncoded(); } catch (GeneralSecurityException e) { throw new RuntimeException("PRF failed", e); } @@ -317,8 +316,7 @@ public byte[] createVerifyData(HandshakeContext context, "Invalid PRF output, format must be RAW. " + "Format received: " + prfKey.getFormat()); } - byte[] finished = prfKey.getEncoded(); - return finished; + return prfKey.getEncoded(); } catch (GeneralSecurityException e) { throw new RuntimeException("PRF failed", e); } diff --git a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java index 41cf0bc24129b..9aa7f95876591 100644 --- a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -474,8 +474,7 @@ private long t13Encrypt( } byte[] sequenceNumber = encCipher.authenticator.sequenceNumber(); - int position = headerSize; - int contentLen = count - position; + int contentLen = count - headerSize; // ensure the capacity int requiredPacketSize = @@ -495,7 +494,7 @@ private long t13Encrypt( pv = ProtocolVersion.TLS12; } - ByteBuffer destination = ByteBuffer.wrap(buf, position, contentLen); + ByteBuffer destination = ByteBuffer.wrap(buf, headerSize, contentLen); count = headerSize + encCipher.encrypt(contentType, destination); // Fill out the header, write it and the message. diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java index 05ee5ff399fbf..fe4a1f77e4469 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -674,8 +674,7 @@ public String toString( String extData; if (stringizer == null) { HexDumpEncoder hexEncoder = new HexDumpEncoder(); - String encoded = hexEncoder.encode(byteBuffer.duplicate()); - extData = encoded; + extData = hexEncoder.encode(byteBuffer.duplicate()); } else { extData = stringizer.toString(handshakeContext, byteBuffer); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java index 97a65ba987d72..db8b7ad84d93c 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,8 +63,7 @@ void encodeAlert(byte level, byte description) throws IOException { } // use the buf of ByteArrayOutputStream - int position = headerSize + writeCipher.getExplicitNonceSize(); - count = position; + count = headerSize + writeCipher.getExplicitNonceSize(); write(level); write(description); @@ -221,8 +220,7 @@ void encodeChangeCipherSpec() throws IOException { } // use the buf of ByteArrayOutputStream - int position = headerSize + writeCipher.getExplicitNonceSize(); - count = position; + count = headerSize + writeCipher.getExplicitNonceSize(); write((byte)1); // byte 1: change_cipher_spec( diff --git a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java index 7acc3a9911e0b..74f38bf5b56c4 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,6 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java index f0bd183aff0ac..9c451baa12b23 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import java.nio.ByteBuffer; import java.text.MessageFormat; import java.util.Arrays; -import java.util.LinkedList; import java.util.List; import java.util.Locale; import javax.net.ssl.SSLProtocolException;