Hi,
On Mon, Jul 30, 2018 at 8:08 PM Xuelei Fan <xuelei....@oracle.com> wrote:
> Would you mind look at the code I posted in the following thread:
> http://mail.openjdk.java.net/pipermail/security-dev/2018-July/017708.html

JDK 11+21:
1. client.closeOutbound() then goes into NEED_WRAP.
2. Client wraps 24 bytes, result is CLOSED, then goes into NOT_HANDSHAKING (?)
3. Server unwraps 24 bytes, result is CLOSED, then goes into NEED_WRAP.
4. Server wraps 24 bytes, result is CLOSED, then goes into NOT_HANDSHAKING.
5. Client unwraps 0 bytes (?)

Current jdk11 tip with your patch:
1. client.closeOutbound() then goes into NEED_WRAP.
2. Client wraps 24 bytes, result is CLOSED, then goes into NEED_UNWRAP.
3. Server unwraps 24 bytes, result is CLOSED, then goes into NEED_WRAP.
4. Server wraps 0 bytes and stays in NEED_WRAP (?)

I don't think this is right.

While I previously complained about step 2 going into NOT_HANDSHAKING,
if you now support full half close, then I think this may be
reasonable, as the server may still send data and only later issue a
close_notify.
However, NEED_UNWRAP like it is now is also reasonable.

At step 3, after the server unwraps the close_notify, the server
should either stay in NOT_HANDSHAKING *and* require a call to
closeOutbound() (which will move the state to NEED_WRAP), or it should
go into NEED_WRAP *and* produce the close_notify.
As it is now, SSLEngine tells the application to wrap(), but it wraps
0 bytes, but tells again the application to wrap(), but still produces
0 bytes, so it's going to be a tight spin loop - not good.

Thanks!

-- 
Simone Bordet
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Reply via email to