Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <agl@chromium.org>2014-06-20 23:00:00 +0400
committerAdam Langley <agl@chromium.org>2014-06-21 00:17:36 +0400
commit0289c730517210b6cb7413a097d08fcd2087b7f2 (patch)
treeccc45f399c4099df523c1abbfa2dda7a017b3491 /ssl/ssl_sess.c
parentaeb088ac096ac7ca672a1066fba291935dfa4782 (diff)
Fix TLS-PSK identity hint implementation issues.
PSK identity hint can be stored in SSL_CTX and in SSL/SSL_SESSION, similar to other TLS parameters, with the value in SSL/SSL_SESSION taking precedence over the one in SSL_CTX. The value in SSL_CTX is shared (used as the default) between all SSL instances associated with that SSL_CTX, whereas the value in SSL/SSL_SESSION is confined to that particular TLS/SSL connection/session. The existing implementation of TLS-PSK does not correctly distinguish between PSK identity hint in SSL_CTX and in SSL/SSL_SESSION. This change fixes these issues: 1. SSL_use_psk_identity_hint does nothing and returns "success" when the SSL object does not have an associated SSL_SESSION. 2. On the client, the hint in SSL_CTX (which is shared between multiple SSL instances) is overwritten with the hint received from server or reset to NULL if no hint was received. 3. On the client, psk_client_callback is invoked with the hint from SSL_CTX rather than from current SSL/SSL_SESSION (i.e., the one received from the server). Issue #2 above masks this issue. 4. On the server, the hint in SSL/SSL_SESSION is ignored and the hint from SSL_CTX is sent to the client. 5. On the server, the hint in SSL/SSL_SESSION is reset to the one in SSL_CTX after the ClientKeyExchange message step. This change fixes the issues by: * Adding storage for the hint in the SSL object. The idea being that the hint in the associated SSL_SESSION takes precedence. * Reading the hint during the handshake only from the associated SSL_SESSION object. * Initializing the hint in SSL object with the one from the SSL_CTX object. * Initializing the hint in SSL_SESSION object with the one from the SSL object. * Making SSL_use_psk_identity_hint and SSL_get_psk_identity_hint set/get the hint to/from SSL_SESSION associated with the provided SSL object, or, if no SSL_SESSION is available, set/get the hint to/from the provided SSL object. * Removing code which resets the hint during handshake.
Diffstat (limited to 'ssl/ssl_sess.c')
-rw-r--r--ssl/ssl_sess.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 923a9923..0e7d4ae9 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -403,6 +403,18 @@ int ssl_get_new_session(SSL *s, int session)
}
}
#endif
+#ifndef OPENSSL_NO_PSK
+ if (s->psk_identity_hint)
+ {
+ ss->psk_identity_hint = BUF_strdup(s->psk_identity_hint);
+ if (ss->psk_identity_hint == NULL)
+ {
+ OPENSSL_PUT_ERROR(SSL, ssl_get_new_session, ERR_R_MALLOC_FAILURE);
+ SSL_SESSION_free(ss);
+ return 0;
+ }
+ }
+#endif
}
else
{