8241248: NullPointerException in sun.security.ssl.HKDF.extract(HKDF.java:93)

Reviewed-by: jnimeh, xuelei
This commit is contained in:
Alexey Bakhtin 2021-05-10 09:45:35 +00:00 committed by Vladimir Kempik
parent 0f925d1f58
commit 1603ca2342
4 changed files with 42 additions and 5 deletions

View file

@ -372,9 +372,11 @@ final class PreSharedKeyExtension {
SSLSessionImpl s = null;
for (PskIdentity requestedId : pskSpec.identities) {
// If we are keeping state, see if the identity is in the cache
// If we are keeping state, see if the identity is in the
// cache. Note that for TLS 1.3, we would also clean
// up the cached session if it is not rejoinable.
if (requestedId.identity.length == SessionId.MAX_LENGTH) {
s = sessionCache.get(requestedId.identity);
s = sessionCache.pull(requestedId.identity);
}
// See if the identity is a stateless ticket
if (s == null &&

View file

@ -175,6 +175,15 @@ final class SSLSessionContextImpl implements SSLSessionContext {
return (SSLSessionImpl)getSession(id);
}
// package-private method, find and remove session from cache
// return found session
SSLSessionImpl pull(byte[] id) {
if (id != null) {
return sessionCache.pull(new SessionId(id));
}
return null;
}
// package-private method, used ONLY by ClientHandshaker
SSLSessionImpl get(String hostname, int port) {
/*

View file

@ -560,9 +560,6 @@ final class ServerHello {
setUpPskKD(shc,
shc.resumingSession.consumePreSharedKey());
// The session can't be resumed again---remove it from cache
sessionCache.remove(shc.resumingSession.getSessionId());
}
// update the responders