2008-09-28 10:09:22 -04:00
|
|
|
This patch adds support for TLS SessionTicket extension (RFC 5077) for
|
|
|
|
the parts used by EAP-FAST (RFC 4851).
|
|
|
|
|
|
|
|
This is based on the patch from Alexey Kobozev <akobozev@cisco.com>
|
|
|
|
(sent to openssl-dev mailing list on Tue, 07 Jun 2005 15:40:58 +0300).
|
|
|
|
|
|
|
|
OpenSSL 0.9.8i does not enable TLS extension support by default, so it
|
|
|
|
will need to be enabled by adding enable-tlsext to config script
|
|
|
|
command line.
|
|
|
|
|
|
|
|
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/s3_clnt.c
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/s3_clnt.c 2008-06-16 19:56:41.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/s3_clnt.c 2008-11-23 20:39:40.000000000 +0200
|
|
|
|
@@ -759,6 +759,21 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
goto f_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef OPENSSL_NO_TLSEXT
|
|
|
|
+ /* check if we want to resume the session based on external pre-shared secret */
|
|
|
|
+ if (s->version >= TLS1_VERSION && s->tls_session_secret_cb)
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ SSL_CIPHER *pref_cipher=NULL;
|
|
|
|
+ s->session->master_key_length=sizeof(s->session->master_key);
|
|
|
|
+ if (s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length,
|
|
|
|
+ NULL, &pref_cipher, s->tls_session_secret_cb_arg))
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
|
|
|
+ s->session->cipher=pref_cipher ?
|
|
|
|
+ pref_cipher : ssl_get_cipher_by_char(s,p+j);
|
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+ }
|
|
|
|
+#endif /* OPENSSL_NO_TLSEXT */
|
|
|
|
+
|
|
|
|
if (j != 0 && j == s->session->session_id_length
|
|
|
|
&& memcmp(p,s->session->session_id,j) == 0)
|
|
|
|
{
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -2701,11 +2716,8 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
{
|
|
|
|
int ok;
|
|
|
|
long n;
|
|
|
|
- /* If we have no ticket or session ID is non-zero length (a match of
|
|
|
|
- * a non-zero session length would never reach here) it cannot be a
|
|
|
|
- * resumed session.
|
|
|
|
- */
|
|
|
|
- if (!s->session->tlsext_tick || s->session->session_id_length)
|
|
|
|
+ /* If we have no ticket it cannot be a resumed session. */
|
|
|
|
+ if (!s->session->tlsext_tick)
|
|
|
|
return 1;
|
|
|
|
/* this function is called when we really expect a Certificate
|
|
|
|
* message, so permit appropriate message length */
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/s3_srvr.c
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/s3_srvr.c 2008-09-14 21:16:09.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/s3_srvr.c 2008-11-23 20:37:40.000000000 +0200
|
|
|
|
@@ -959,6 +959,59 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /* Check if we want to use external pre-shared secret for this
|
|
|
|
+ * handshake for not reused session only. We need to generate
|
|
|
|
+ * server_random before calling tls_session_secret_cb in order to allow
|
|
|
|
+ * SessionTicket processing to use it in key derivation. */
|
|
|
|
+ {
|
|
|
|
+ unsigned long Time;
|
|
|
|
+ unsigned char *pos;
|
|
|
|
+ Time=(unsigned long)time(NULL); /* Time */
|
|
|
|
+ pos=s->s3->server_random;
|
|
|
|
+ l2n(Time,pos);
|
|
|
|
+ if (RAND_pseudo_bytes(pos,SSL3_RANDOM_SIZE-4) <= 0)
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ al=SSL_AD_INTERNAL_ERROR;
|
|
|
|
+ goto f_err;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!s->hit && s->version >= TLS1_VERSION && s->tls_session_secret_cb)
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ SSL_CIPHER *pref_cipher=NULL;
|
|
|
|
+
|
|
|
|
+ s->session->master_key_length=sizeof(s->session->master_key);
|
|
|
|
+ if(s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length,
|
|
|
|
+ ciphers, &pref_cipher, s->tls_session_secret_cb_arg))
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ s->hit=1;
|
|
|
|
+ s->session->ciphers=ciphers;
|
|
|
|
+ s->session->verify_result=X509_V_OK;
|
|
|
|
+
|
|
|
|
+ ciphers=NULL;
|
|
|
|
+
|
|
|
|
+ /* check if some cipher was preferred by call back */
|
|
|
|
+ pref_cipher=pref_cipher ? pref_cipher : ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));
|
|
|
|
+ if (pref_cipher == NULL)
|
|
|
|
+ {
|
|
|
|
+ al=SSL_AD_HANDSHAKE_FAILURE;
|
|
|
|
+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER);
|
|
|
|
+ goto f_err;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ s->session->cipher=pref_cipher;
|
|
|
|
+
|
|
|
|
+ if (s->cipher_list)
|
|
|
|
+ sk_SSL_CIPHER_free(s->cipher_list);
|
|
|
|
+
|
|
|
|
+ if (s->cipher_list_by_id)
|
|
|
|
+ sk_SSL_CIPHER_free(s->cipher_list_by_id);
|
|
|
|
+
|
|
|
|
+ s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers);
|
|
|
|
+ s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers);
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+ }
|
|
|
|
#endif
|
|
|
|
/* Worst case, we will use the NULL compression, but if we have other
|
|
|
|
* options, we will now look for them. We have i-1 compression
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -1097,16 +1150,22 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
unsigned char *buf;
|
|
|
|
unsigned char *p,*d;
|
|
|
|
int i,sl;
|
|
|
|
- unsigned long l,Time;
|
|
|
|
+ unsigned long l;
|
|
|
|
+#ifdef OPENSSL_NO_TLSEXT
|
|
|
|
+ unsigned long Time;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (s->state == SSL3_ST_SW_SRVR_HELLO_A)
|
|
|
|
{
|
|
|
|
buf=(unsigned char *)s->init_buf->data;
|
|
|
|
+#ifdef OPENSSL_NO_TLSEXT
|
|
|
|
p=s->s3->server_random;
|
|
|
|
+ /* Generate server_random if it was not needed previously */
|
|
|
|
Time=(unsigned long)time(NULL); /* Time */
|
|
|
|
l2n(Time,p);
|
|
|
|
if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0)
|
|
|
|
return -1;
|
|
|
|
+#endif
|
|
|
|
/* Do the message type and length last */
|
|
|
|
d=p= &(buf[4]);
|
|
|
|
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/ssl_err.c
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/ssl_err.c 2008-08-13 22:44:44.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/ssl_err.c 2008-11-23 20:33:43.000000000 +0200
|
|
|
|
@@ -253,6 +253,7 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
{ERR_FUNC(SSL_F_TLS1_ENC), "TLS1_ENC"},
|
|
|
|
{ERR_FUNC(SSL_F_TLS1_SETUP_KEY_BLOCK), "TLS1_SETUP_KEY_BLOCK"},
|
|
|
|
{ERR_FUNC(SSL_F_WRITE_PENDING), "WRITE_PENDING"},
|
2008-11-23 14:18:26 -05:00
|
|
|
+{ERR_FUNC(SSL_F_SSL_SET_SESSION_TICKET_EXT), "SSL_set_session_ticket_ext"},
|
2008-09-28 10:09:22 -04:00
|
|
|
{0,NULL}
|
|
|
|
};
|
|
|
|
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/ssl.h
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/ssl.h 2008-08-13 22:44:44.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/ssl.h 2008-11-23 20:35:41.000000000 +0200
|
|
|
|
@@ -344,6 +344,7 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
* 'struct ssl_st *' function parameters used to prototype callbacks
|
|
|
|
* in SSL_CTX. */
|
|
|
|
typedef struct ssl_st *ssl_crock_st;
|
2008-11-23 14:18:26 -05:00
|
|
|
+typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;
|
2008-09-28 10:09:22 -04:00
|
|
|
|
|
|
|
/* used to hold info on the particular ciphers used */
|
|
|
|
typedef struct ssl_cipher_st
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -362,6 +363,9 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
|
|
|
|
DECLARE_STACK_OF(SSL_CIPHER)
|
|
|
|
|
2008-11-23 14:18:26 -05:00
|
|
|
+typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, int len, void *arg);
|
2008-09-28 10:09:22 -04:00
|
|
|
+typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg);
|
|
|
|
+
|
|
|
|
/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
|
|
|
|
typedef struct ssl_method_st
|
|
|
|
{
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -1034,6 +1038,18 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
|
|
|
|
/* RFC4507 session ticket expected to be received or sent */
|
|
|
|
int tlsext_ticket_expected;
|
|
|
|
+
|
2008-11-23 14:18:26 -05:00
|
|
|
+ /* TLS Session Ticket extension override */
|
|
|
|
+ TLS_SESSION_TICKET_EXT *tlsext_session_ticket;
|
|
|
|
+
|
|
|
|
+ /* TLS Session Ticket extension callback */
|
|
|
|
+ tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb;
|
|
|
|
+ void *tls_session_ticket_ext_cb_arg;
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
|
|
|
+ /* TLS pre-shared secret session resumption */
|
|
|
|
+ tls_session_secret_cb_fn tls_session_secret_cb;
|
|
|
|
+ void *tls_session_secret_cb_arg;
|
|
|
|
+
|
|
|
|
SSL_CTX * initial_ctx; /* initial ctx, used to store sessions */
|
|
|
|
#define session_ctx initial_ctx
|
|
|
|
#else
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -1632,6 +1648,15 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
int SSL_COMP_add_compression_method(int id,void *cm);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+/* TLS extensions functions */
|
2008-11-23 14:18:26 -05:00
|
|
|
+int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
|
|
|
|
+
|
|
|
|
+int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,
|
|
|
|
+ void *arg);
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
|
|
|
+/* Pre-shared secret session resumption functions */
|
|
|
|
+int SSL_set_session_secret_cb(SSL *s, tls_session_secret_cb_fn tls_session_secret_cb, void *arg);
|
|
|
|
+
|
|
|
|
/* BEGIN ERROR CODES */
|
|
|
|
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
|
|
|
* made after this point may be overwritten when the script is next run.
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -1824,6 +1849,7 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
#define SSL_F_TLS1_ENC 210
|
|
|
|
#define SSL_F_TLS1_SETUP_KEY_BLOCK 211
|
|
|
|
#define SSL_F_WRITE_PENDING 212
|
2008-11-23 14:18:26 -05:00
|
|
|
+#define SSL_F_SSL_SET_SESSION_TICKET_EXT 213
|
2008-09-28 10:09:22 -04:00
|
|
|
|
|
|
|
/* Reason codes. */
|
|
|
|
#define SSL_R_APP_DATA_IN_HANDSHAKE 100
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/ssl_sess.c
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/ssl_sess.c 2008-06-04 21:35:27.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/ssl_sess.c 2008-11-23 20:32:24.000000000 +0200
|
|
|
|
@@ -707,6 +707,61 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
return(s->session_timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef OPENSSL_NO_TLSEXT
|
2008-11-23 14:18:26 -05:00
|
|
|
+int SSL_set_session_secret_cb(SSL *s, int (*tls_session_secret_cb)(SSL *s, void *secret, int *secret_len,
|
2008-09-28 10:09:22 -04:00
|
|
|
+ STACK_OF(SSL_CIPHER) *peer_ciphers, SSL_CIPHER **cipher, void *arg), void *arg)
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ if (s == NULL) return(0);
|
|
|
|
+ s->tls_session_secret_cb = tls_session_secret_cb;
|
|
|
|
+ s->tls_session_secret_cb_arg = arg;
|
|
|
|
+ return(1);
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
2008-11-23 14:18:26 -05:00
|
|
|
+int SSL_set_session_ticket_ext_cb(SSL *s, tls_session_ticket_ext_cb_fn cb,
|
|
|
|
+ void *arg)
|
2008-09-28 10:09:22 -04:00
|
|
|
+ {
|
2008-11-23 14:18:26 -05:00
|
|
|
+ if (s == NULL) return(0);
|
|
|
|
+ s->tls_session_ticket_ext_cb = cb;
|
|
|
|
+ s->tls_session_ticket_ext_cb_arg = arg;
|
|
|
|
+ return(1);
|
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
2008-11-23 14:18:26 -05:00
|
|
|
+int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len)
|
|
|
|
+ {
|
|
|
|
+ if (s->version >= TLS1_VERSION)
|
2008-09-28 10:09:22 -04:00
|
|
|
+ {
|
2008-11-23 14:18:26 -05:00
|
|
|
+ if (s->tlsext_session_ticket)
|
|
|
|
+ {
|
|
|
|
+ OPENSSL_free(s->tlsext_session_ticket);
|
|
|
|
+ s->tlsext_session_ticket = NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ s->tlsext_session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
|
|
|
|
+ if (!s->tlsext_session_ticket)
|
|
|
|
+ {
|
|
|
|
+ SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE);
|
2008-09-28 10:09:22 -04:00
|
|
|
+ return 0;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
2008-11-23 14:18:26 -05:00
|
|
|
+ if (ext_data)
|
|
|
|
+ {
|
|
|
|
+ s->tlsext_session_ticket->length = ext_len;
|
|
|
|
+ s->tlsext_session_ticket->data = s->tlsext_session_ticket + 1;
|
|
|
|
+ memcpy(s->tlsext_session_ticket->data, ext_data, ext_len);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ s->tlsext_session_ticket->length = 0;
|
|
|
|
+ s->tlsext_session_ticket->data = NULL;
|
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
|
|
|
+ return 1;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
|
|
|
+ return 0;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+#endif /* OPENSSL_NO_TLSEXT */
|
|
|
|
+
|
|
|
|
typedef struct timeout_param_st
|
|
|
|
{
|
|
|
|
SSL_CTX *ctx;
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/t1_lib.c
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/t1_lib.c 2008-09-04 01:13:04.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/t1_lib.c 2008-11-23 20:31:20.000000000 +0200
|
|
|
|
@@ -106,6 +106,12 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
|
|
|
|
void tls1_free(SSL *s)
|
|
|
|
{
|
|
|
|
+#ifndef OPENSSL_NO_TLSEXT
|
2008-11-23 14:18:26 -05:00
|
|
|
+ if (s->tlsext_session_ticket)
|
|
|
|
+ {
|
|
|
|
+ OPENSSL_free(s->tlsext_session_ticket);
|
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
+#endif
|
|
|
|
ssl3_free(s);
|
|
|
|
}
|
|
|
|
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -175,8 +181,23 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
int ticklen;
|
|
|
|
if (s->session && s->session->tlsext_tick)
|
|
|
|
ticklen = s->session->tlsext_ticklen;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ else if (s->session && s->tlsext_session_ticket &&
|
|
|
|
+ s->tlsext_session_ticket->data)
|
|
|
|
+ {
|
|
|
|
+ ticklen = s->tlsext_session_ticket->length;
|
2008-09-28 10:09:22 -04:00
|
|
|
+ s->session->tlsext_tick = OPENSSL_malloc(ticklen);
|
|
|
|
+ if (!s->session->tlsext_tick)
|
|
|
|
+ return NULL;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ memcpy(s->session->tlsext_tick,
|
|
|
|
+ s->tlsext_session_ticket->data,
|
2008-09-28 10:09:22 -04:00
|
|
|
+ ticklen);
|
|
|
|
+ s->session->tlsext_ticklen = ticklen;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
else
|
|
|
|
ticklen = 0;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ if (ticklen == 0 && s->tlsext_session_ticket &&
|
|
|
|
+ s->tlsext_session_ticket->data == NULL)
|
2008-09-28 10:09:22 -04:00
|
|
|
+ goto skip_ext;
|
|
|
|
/* Check for enough room 2 for extension type, 2 for len
|
|
|
|
* rest for ticket
|
|
|
|
*/
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -190,6 +211,7 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
ret += ticklen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ skip_ext:
|
|
|
|
|
|
|
|
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp)
|
|
|
|
{
|
2008-11-23 14:18:26 -05:00
|
|
|
@@ -407,6 +429,15 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
+ else if (type == TLSEXT_TYPE_session_ticket)
|
|
|
|
+ {
|
|
|
|
+ if (s->tls_session_ticket_ext_cb &&
|
|
|
|
+ !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg))
|
|
|
|
+ {
|
|
|
|
+ *al = TLS1_AD_INTERNAL_ERROR;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
else if (type == TLSEXT_TYPE_status_request
|
|
|
|
&& s->ctx->tlsext_status_cb)
|
|
|
|
{
|
|
|
|
@@ -553,6 +584,12 @@
|
|
|
|
}
|
|
|
|
else if (type == TLSEXT_TYPE_session_ticket)
|
|
|
|
{
|
|
|
|
+ if (s->tls_session_ticket_ext_cb &&
|
|
|
|
+ !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg))
|
|
|
|
+ {
|
|
|
|
+ *al = TLS1_AD_INTERNAL_ERROR;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
if ((SSL_get_options(s) & SSL_OP_NO_TICKET)
|
|
|
|
|| (size > 0))
|
|
|
|
{
|
|
|
|
@@ -776,6 +813,15 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
s->tlsext_ticket_expected = 1;
|
|
|
|
return 0; /* Cache miss */
|
|
|
|
}
|
|
|
|
+ if (s->tls_session_secret_cb)
|
2008-11-23 14:18:26 -05:00
|
|
|
+ {
|
|
|
|
+ /* Indicate cache miss here and instead of
|
|
|
|
+ * generating the session from ticket now,
|
|
|
|
+ * trigger abbreviated handshake based on
|
|
|
|
+ * external mechanism to calculate the master
|
|
|
|
+ * secret later. */
|
2008-09-28 10:09:22 -04:00
|
|
|
+ return 0;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ }
|
2008-09-28 10:09:22 -04:00
|
|
|
return tls_decrypt_ticket(s, p, size, session_id, len,
|
|
|
|
ret);
|
|
|
|
}
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/ssl/tls1.h
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/ssl/tls1.h 2008-04-30 19:11:33.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/ssl/tls1.h 2008-11-23 20:22:38.000000000 +0200
|
|
|
|
@@ -398,6 +398,13 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+/* TLS extension struct */
|
2008-11-23 14:18:26 -05:00
|
|
|
+struct tls_session_ticket_ext_st
|
|
|
|
+ {
|
2008-09-28 10:09:22 -04:00
|
|
|
+ unsigned short length;
|
|
|
|
+ void *data;
|
2008-11-23 14:18:26 -05:00
|
|
|
+ };
|
2008-09-28 10:09:22 -04:00
|
|
|
+
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2008-11-23 14:18:26 -05:00
|
|
|
Index: openssl-0.9.8i/util/ssleay.num
|
|
|
|
===================================================================
|
2008-09-28 10:09:22 -04:00
|
|
|
--- openssl-0.9.8i.orig/util/ssleay.num 2008-06-05 13:57:21.000000000 +0300
|
2008-11-23 14:18:26 -05:00
|
|
|
+++ openssl-0.9.8i/util/ssleay.num 2008-11-23 20:22:05.000000000 +0200
|
|
|
|
@@ -242,3 +242,5 @@
|
2008-09-28 10:09:22 -04:00
|
|
|
SSL_get_servername 291 EXIST::FUNCTION:TLSEXT
|
|
|
|
SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT
|
|
|
|
SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE
|
2008-11-23 14:18:26 -05:00
|
|
|
+SSL_set_session_ticket_ext 306 EXIST::FUNCTION:TLSEXT
|
|
|
|
+SSL_set_session_secret_cb 307 EXIST::FUNCTION:TLSEXT
|