Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer [v2]

2022-05-17 Thread Anthony Scarpino
On Sat, 14 May 2022 03:29:14 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src'

Integrated: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-17 Thread Anthony Scarpino
68ce4a0b4f5c3131f4e4626a5a55b7f2f61f Stats: 393 lines in 3 files changed: 291 ins; 20 del; 82 mod 8283577: SSLEngine.unwrap on read-only input ByteBuffer Reviewed-by: wetmore - PR: https://git.openjdk.java.net/jdk/pull/8462

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer [v2]

2022-05-16 Thread Xue-Lei Andrew Fan
On Mon, 16 May 2022 21:08:48 GMT, Anthony Scarpino wrote: > There is too much grey area. It says the src buffer maybe modified, which one > could interpret it cannot be a read-only, but that would still need > clarification to explicitly say "no read only buffers". And other than these >

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer [v2]

2022-05-16 Thread Anthony Scarpino
On Sat, 14 May 2022 03:29:14 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src'

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer [v2]

2022-05-14 Thread Xue-Lei Andrew Fan
On Sat, 14 May 2022 03:29:14 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src'

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer [v2]

2022-05-13 Thread Anthony Scarpino
> Hi, > > I need a review of this fix to allow a read-only 'src' buffer to be used with > SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher > operation when a read-only buffer is passed. If the 'src' is read-write, > there is no effect on the current operation > >

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-12 Thread Bradford Wetmore
On Wed, 11 May 2022 22:38:04 GMT, Anthony Scarpino wrote: >> test/jdk/javax/net/ssl/SSLSession/ReadOnlyEngine.java line 162: >> >>> 160: statusServer != HandshakeStatus.NOT_HANDSHAKING); >>> 161: >>> 162: // Read NST >> >> What is NST? > > New Session Ticket Duh, of

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-12 Thread Bradford Wetmore
On Wed, 11 May 2022 23:03:27 GMT, Anthony Scarpino wrote: >> test/jdk/javax/net/ssl/SSLSession/ReadOnlyEngine.java line 172: >> >>> 170: out.clear(); >>> 171: String testString = "ASDF"; >>> 172: in.put(testString.getBytes()).flip(); >> >> If you're going to convert

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-12 Thread Bradford Wetmore
On Wed, 11 May 2022 22:25:43 GMT, Anthony Scarpino wrote: >> test/jdk/javax/net/ssl/SSLSession/ReadOnlyEngine.java line 1: >> >>> 1: /* >> >> Wondering why this is in javax/net/ssl/SSLSession instead of >> sun/security/ssl/SSLCipher. > > I can move it.. I created it from another test which

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-11 Thread Xue-Lei Andrew Fan
On Wed, 11 May 2022 22:49:02 GMT, Anthony Scarpino wrote: >> src/java.base/share/classes/javax/net/ssl/SSLEngine.java line 677: >> >>> 675: * @see #unwrap(ByteBuffer, ByteBuffer[], int, int) >>> 676: * >>> 677: * @implNote The data in {@code src} may be modified during the

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-11 Thread Anthony Scarpino
On Wed, 11 May 2022 00:31:23 GMT, Bradford Wetmore wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-11 Thread Anthony Scarpino
On Wed, 11 May 2022 05:52:38 GMT, Xue-Lei Andrew Fan wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src'

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-11 Thread Anthony Scarpino
On Mon, 9 May 2022 23:48:24 GMT, Bradford Wetmore wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-11 Thread Anthony Scarpino
On Mon, 9 May 2022 23:15:40 GMT, Bradford Wetmore wrote: >> Hi, >> >> I need a review of this fix to allow a read-only 'src' buffer to be used >> with SSLEngine.unwrap(). A temporary read-write buffer is created in the >> SSLCipher operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-10 Thread Xue-Lei Andrew Fan
On Fri, 29 Apr 2022 03:58:57 GMT, Anthony Scarpino wrote: > Hi, > > I need a review of this fix to allow a read-only 'src' buffer to be used with > SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher > operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-10 Thread Bradford Wetmore
On Fri, 29 Apr 2022 03:58:57 GMT, Anthony Scarpino wrote: > Hi, > > I need a review of this fix to allow a read-only 'src' buffer to be used with > SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher > operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-10 Thread Bradford Wetmore
On Fri, 29 Apr 2022 03:58:57 GMT, Anthony Scarpino wrote: > Hi, > > I need a review of this fix to allow a read-only 'src' buffer to be used with > SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher > operation when a read-only buffer is passed. If the 'src' is

Re: RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-05-10 Thread Mark Powers
On Fri, 29 Apr 2022 03:58:57 GMT, Anthony Scarpino wrote: > Hi, > > I need a review of this fix to allow a read-only 'src' buffer to be used with > SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher > operation when a read-only buffer is passed. If the 'src' is

RFR: 8283577: SSLEngine.unwrap on read-only input ByteBuffer

2022-04-29 Thread Anthony Scarpino
Hi, I need a review of this fix to allow a read-only 'src' buffer to be used with SSLEngine.unwrap(). A temporary read-write buffer is created in the SSLCipher operation when a read-only buffer is passed. If the 'src' is read-write, there is no effect on the current operation The PR also

Re: [External] : Re: SSLEngine.unwrap on read-only input ByteBuffer

2022-03-24 Thread Norman Maurer
I agree with Chris here that doing in-place modification of the source buffer is really surprising even if it’s not read-only. This really sounds like something I would consider a „breaking change“ as I can’t imagine users would expect this at all (nothing was ever in the javadocs that would

Re: [External] : Re: SSLEngine.unwrap on read-only input ByteBuffer

2022-03-24 Thread Bradford Wetmore
Problem easily duplicated, thanks for the reproducer. I've updated the bug with the info. Brad On 3/24/2022 9:13 AM, Chris Vest wrote: On Wed, Mar 23, 2022 at 10:38 AM Bradford Wetmore mailto:bradford.wetm...@oracle.com>> wrote: Offhand, sounds like a bug to me.  I've filed:

Re: SSLEngine.unwrap on read-only input ByteBuffer

2022-03-24 Thread Chris Vest
On Wed, Mar 23, 2022 at 10:38 AM Bradford Wetmore < bradford.wetm...@oracle.com> wrote: > Offhand, sounds like a bug to me. I've filed: > > https://bugs.openjdk.java.net/browse/JDK-8283577 Thanks. The in-place use of the input buffer might also be unexpected even when the buffer is not

Re: SSLEngine.unwrap on read-only input ByteBuffer

2022-03-23 Thread Bradford Wetmore
Offhand, sounds like a bug to me. I've filed: https://bugs.openjdk.java.net/browse/JDK-8283577 to track. It's possible an optimization might have been done using an in-place en/decryption, but it should work. By chance, do you have a simple reproducer handy? If not, we should be able to

SSLEngine.unwrap on read-only input ByteBuffer

2022-03-23 Thread Chris Vest
Hi, In Netty we've been trying to design some safer APIs, and attempted to make more use of read-only ByteBuffers. We discovered that SSLEngine.unwrap does not like read-only input buffers, even though the input buffers should in theory only be read from. We obviously make sure that the output