Introduce ticket field in session structure
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index 3c8f1e6..2ffb549 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -338,6 +338,9 @@
x509_cert *peer_cert; /*!< peer X.509 cert chain */
#endif /* POLARSSL_X509_PARSE_C */
+ unsigned char *ticket; /*!< RFC 5077 session ticket */
+ size_t ticket_len; /*!< session ticket length */
+
unsigned char mfl_code; /*!< MaxFragmentLength negotiated by peer */
int trunc_hmac; /*!< flag for truncated hmac activation */
};
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 5337895..7e8ff34 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -3258,6 +3258,14 @@
}
#endif /* POLARSSL_X509_PARSE_C */
+ if( src->ticket != NULL )
+ {
+ if( ( dst->ticket = polarssl_malloc( src->ticket_len ) ) == NULL )
+ return( POLARSSL_ERR_SSL_MALLOC_FAILED );
+
+ memcpy( dst->ticket, src->ticket, src->ticket_len );
+ }
+
return( 0 );
}
@@ -3579,6 +3587,8 @@
}
#endif
+ polarssl_free( session->ticket );
+
memset( session, 0, sizeof( ssl_session ) );
}