00001 00023 #ifndef MBEDTLS_SSL_TICKET_H 00024 #define MBEDTLS_SSL_TICKET_H 00025 00026 /* 00027 * This implementation of the session ticket callbacks includes key 00028 * management, rotating the keys periodically in order to preserve forward 00029 * secrecy, when MBEDTLS_HAVE_TIME is defined. 00030 */ 00031 00032 #include "ssl.h" 00033 #include "cipher.h" 00034 00035 #if defined(MBEDTLS_THREADING_C) 00036 #include "threading.h" 00037 #endif 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00046 typedef struct 00047 { 00048 unsigned char name[4]; 00049 uint32_t generation_time; 00050 mbedtls_cipher_context_t ctx; 00051 } 00052 mbedtls_ssl_ticket_key; 00053 00057 typedef struct 00058 { 00059 mbedtls_ssl_ticket_key keys[2]; 00060 unsigned char active; 00062 uint32_t ticket_lifetime; 00065 int (*f_rng)(void *, unsigned char *, size_t); 00066 void *p_rng; 00068 #if defined(MBEDTLS_THREADING_C) 00069 mbedtls_threading_mutex_t mutex; 00070 #endif 00071 } 00072 mbedtls_ssl_ticket_context; 00073 00081 void mbedtls_ssl_ticket_init( mbedtls_ssl_ticket_context *ctx ); 00082 00105 int mbedtls_ssl_ticket_setup( mbedtls_ssl_ticket_context *ctx, 00106 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng, 00107 mbedtls_cipher_type_t cipher, 00108 uint32_t lifetime ); 00109 00115 mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write; 00116 00122 mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse; 00123 00129 void mbedtls_ssl_ticket_free( mbedtls_ssl_ticket_context *ctx ); 00130 00131 #ifdef __cplusplus 00132 } 00133 #endif 00134 00135 #endif /* ssl_ticket.h */