]> granicus.if.org Git - openssl/commitdiff
Re-revert (re-insert?) temporary change that made renegotiation work again
authorDr. Stephen Henson <steve@openssl.org>
Sun, 8 Nov 2009 14:30:22 +0000 (14:30 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 8 Nov 2009 14:30:22 +0000 (14:30 +0000)
and add a proper fix: specifically if it is a new session don't send the old
TLS ticket, send a zero length ticket to request a new session.

ssl/s3_clnt.c
ssl/t1_lib.c

index a76162646e56ef84be07dddfba35645689bf4a63..9929d0c92c8be292c64f2d7f22e6087f06c762e8 100644 (file)
@@ -1744,7 +1744,28 @@ int ssl3_get_new_session_ticket(SSL *s)
                }
        memcpy(s->session->tlsext_tick, p, ticklen);
        s->session->tlsext_ticklen = ticklen;
-       
+       /* There are two ways to detect a resumed ticket sesion.
+        * One is to set an appropriate session ID and then the server
+        * must return a match in ServerHello. This allows the normal
+        * client session ID matching to work and we know much 
+        * earlier that the ticket has been accepted.
+        * 
+        * The other way is to set zero length session ID when the
+        * ticket is presented and rely on the handshake to determine
+        * session resumption.
+        *
+        * We choose the former approach because this fits in with
+        * assumptions elsewhere in OpenSSL. The session ID is set
+        * to the SHA256 (or SHA1 is SHA256 is disabled) hash of the
+        * ticket.
+        */ 
+       EVP_Digest(p, ticklen,
+                       s->session->session_id, &s->session->session_id_length,
+#ifndef OPENSSL_NO_SHA256
+                                                       EVP_sha256(), NULL);
+#else
+                                                       EVP_sha1(), NULL);
+#endif
        ret=1;
        return(ret);
 f_err:
index c9a81f243d42be3ea2e8b5890b185894f2f82491..247854e124f3638a41874a86dcf1f82427487e3a 100644 (file)
@@ -177,7 +177,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha
        if (!(SSL_get_options(s) & SSL_OP_NO_TICKET))
                {
                int ticklen;
-               if (s->session && s->session->tlsext_tick)
+               if (!s->new_session && s->session && s->session->tlsext_tick)
                        ticklen = s->session->tlsext_ticklen;
                else
                        ticklen = 0;