You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conscrypt's session management is not compatible with TLS 1.3 and has bugs around how handshake properties are extracted. (SSL_get_session + session->tlsext_hostname should not be used for extracting the SNI. SSL_get_session also should not be used for adding sessions to the session cache.)
The correct way to do this is to query handshake properties off the SSL (SSL_get_servername) and use a callback (SSL_CTX_sess_set_new_cb) for storing sessions in the session cache. Conscrypt's problems seem to stem from the javax.net.ssl API exposing both SSLSocket.getSession and SSLSocket.getHandshakeSession without actually exposing an external session cache (i.e. it appears that session lookup for client and server is handled internally rather than the caller picking an SSLSession for an SSLSocket).
With an internal session cache, a Java SSLSession should not be backed by SSL_SESSION. It should be a pointer back to the SSLSocket and extract properties off the SSL directly. SSL_SESSION management should be entirely internal and done in the standard way with the callback.
Java does provide an SSLSessionContext.getSession API which gets in the way of this, but since the returned SSLSessions aren't useful for anything, always returning null seems a sound choice. At a glance, it appears Netty does this and always makes SSLSocket.getSession and SSLSocket.getHandshakeSession return child objects of the socket as described here.
Activity
davidben commentedon Mar 1, 2017
Java does provide an
SSLSessionContext.getSessionAPI which gets in the way of this, but since the returnedSSLSessions aren't useful for anything, always returningnullseems a sound choice. At a glance, it appears Netty does this and always makesSSLSocket.getSessionandSSLSocket.getHandshakeSessionreturn child objects of the socket as described here.kruton commentedon Mar 21, 2017
Comments on this unsubmitted CL are relevant.
nmittler commentedon Apr 4, 2017
We should import some of the android tests to verify these changes.
https://android.googlesource.com/platform/libcore/+/master/luni/src/test/java/libcore/
then it's stuff like javax/net/ssl/SSLSocketTest.java
Subdirectories for many of the tests:
https://android.googlesource.com/platform/libcore/+/master/luni/src/test/java/libcore/java/security/
https://android.googlesource.com/platform/libcore/+/master/luni/src/test/java/libcore/javax/net/ssl/
https://android.googlesource.com/platform/libcore/+/master/luni/src/test/java/libcore/javax/crypto/
Refactoring sessions.
nmittler commentedon Apr 6, 2017
FYI, Kenny's work on this was captured in these 2 CLs (the latter is to be applied on the former):
https://android-review.googlesource.com/#/c/309613/
https://android-review.googlesource.com/#/c/312011/
4 remaining items
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management
Refactoring session management (#172)