Start adding ticket keys (only key_name for now)
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index f7b9bd9..f4d6e24 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2973,6 +2973,28 @@
}
/*
+ * Allocate and initialize ticket keys
+ */
+static int ssl_ticket_keys_init( ssl_context *ssl )
+{
+ int ret;
+ ssl_ticket_keys *tkeys;
+
+ if( ssl->ticket_keys != NULL )
+ return( 0 );
+
+ if( ( tkeys = polarssl_malloc( sizeof( ssl_ticket_keys ) ) ) == NULL )
+ return( POLARSSL_ERR_SSL_MALLOC_FAILED );
+
+ if( ( ret = ssl->f_rng( ssl->p_rng, tkeys->key_name, 16 ) ) != 0 )
+ return( ret );
+
+ ssl->ticket_keys = tkeys;
+
+ return( 0 );
+}
+
+/*
* SSL set accessors
*/
void ssl_set_endpoint( ssl_context *ssl, int endpoint )
@@ -3232,7 +3254,13 @@
{
ssl->session_tickets = use_tickets;
- return( 0 );
+ if( ssl->endpoint == SSL_IS_CLIENT )
+ return( 0 );
+
+ if( ssl->f_rng == NULL )
+ return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
+
+ return( ssl_ticket_keys_init( ssl ) );
}
/*
@@ -3671,6 +3699,8 @@
polarssl_free( ssl->session );
}
+ polarssl_free( ssl->ticket_keys );
+
if ( ssl->hostname != NULL)
{
memset( ssl->hostname, 0, ssl->hostname_len );