< prev index next >

src/java.base/share/classes/sun/security/ssl/InputRecord.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2019, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2018, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 29,39 **** import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; - import java.util.concurrent.locks.ReentrantLock; import javax.crypto.BadPaddingException; import sun.security.ssl.SSLCipher.SSLReadCipher; /** * {@code InputRecord} takes care of the management of SSL/TLS/DTLS input --- 29,38 ----
*** 42,66 **** * @author David Brownell */ abstract class InputRecord implements Record, Closeable { SSLReadCipher readCipher; // Needed for KeyUpdate, used after Handshake.Finished ! TransportContext tc; final HandshakeHash handshakeHash; ! volatile boolean isClosed; // The ClientHello version to accept. If set to ProtocolVersion.SSL20Hello // and the first message we read is a ClientHello in V2 format, we convert // it to V3. Otherwise we throw an exception when encountering a V2 hello. ProtocolVersion helloVersion; // fragment size int fragmentSize; - final ReentrantLock recordLock = new ReentrantLock(); - InputRecord(HandshakeHash handshakeHash, SSLReadCipher readCipher) { this.readCipher = readCipher; this.helloVersion = ProtocolVersion.TLS10; this.handshakeHash = handshakeHash; this.isClosed = false; --- 41,63 ---- * @author David Brownell */ abstract class InputRecord implements Record, Closeable { SSLReadCipher readCipher; // Needed for KeyUpdate, used after Handshake.Finished ! TransportContext tc; final HandshakeHash handshakeHash; ! boolean isClosed; // The ClientHello version to accept. If set to ProtocolVersion.SSL20Hello // and the first message we read is a ClientHello in V2 format, we convert // it to V3. Otherwise we throw an exception when encountering a V2 hello. ProtocolVersion helloVersion; // fragment size int fragmentSize; InputRecord(HandshakeHash handshakeHash, SSLReadCipher readCipher) { this.readCipher = readCipher; this.helloVersion = ProtocolVersion.TLS10; this.handshakeHash = handshakeHash; this.isClosed = false;
*** 93,115 **** /** * Prevent any more data from being read into this record, * and flag the record as holding no data. */ @Override ! public void close() throws IOException { ! recordLock.lock(); ! try { ! if (!isClosed) { ! isClosed = true; ! readCipher.dispose(); ! } ! } finally { ! recordLock.unlock(); } } ! boolean isClosed() { return isClosed; } // apply to SSLSocket and SSLEngine void changeReadCiphers(SSLReadCipher readCipher) { --- 90,107 ---- /** * Prevent any more data from being read into this record, * and flag the record as holding no data. */ @Override ! public synchronized void close() throws IOException { ! if (!isClosed) { ! isClosed = true; ! readCipher.dispose(); } } ! synchronized boolean isClosed() { return isClosed; } // apply to SSLSocket and SSLEngine void changeReadCiphers(SSLReadCipher readCipher) {
< prev index next >