32 #if defined(POLARSSL_SSL_CACHE_C)
36 #if defined(POLARSSL_MEMORY_C)
39 #define polarssl_malloc malloc
40 #define polarssl_free free
52 #if defined(POLARSSL_THREADING_C)
60 #if defined(POLARSSL_HAVE_TIME)
61 time_t t = time( NULL );
66 #if defined(POLARSSL_THREADING_C)
79 #if defined(POLARSSL_HAVE_TIME)
98 #if defined(POLARSSL_X509_CRT_PARSE_C)
128 #if defined(POLARSSL_THREADING_C)
139 #if defined(POLARSSL_HAVE_TIME)
140 time_t t = time( NULL ), oldest = 0;
147 #if defined(POLARSSL_THREADING_C)
159 #if defined(POLARSSL_HAVE_TIME)
171 #if defined(POLARSSL_HAVE_TIME)
172 if( oldest == 0 || cur->
timestamp < oldest )
185 #if defined(POLARSSL_HAVE_TIME)
193 #if defined(POLARSSL_X509_CRT_PARSE_C)
208 if( cache->
chain == NULL )
217 #if defined(POLARSSL_X509_CRT_PARSE_C)
246 #if defined(POLARSSL_HAVE_TIME)
253 #if defined(POLARSSL_X509_CRT_PARSE_C)
277 #if defined(POLARSSL_THREADING_C)
285 #if defined(POLARSSL_HAVE_TIME)
288 if( timeout < 0 ) timeout = 0;
296 if( max < 0 ) max = 0;
314 #if defined(POLARSSL_X509_CRT_PARSE_C)
322 #if defined(POLARSSL_THREADING_C)
int(* polarssl_mutex_lock)(threading_mutex_t *mutex)
void ssl_cache_init(ssl_cache_context *cache)
Initialize an SSL cache context.
void *(* polarssl_malloc)(size_t len)
x509_buf raw
The raw certificate data (DER).
#define SSL_CACHE_DEFAULT_TIMEOUT
SSL session cache implementation.
void ssl_session_free(ssl_session *session)
Free referenced items in an SSL session including the peer certificate and clear memory.
int x509_crt_parse(x509_crt *chain, const unsigned char *buf, size_t buflen)
Parse one or more certificates and add them to the chained list.
Configuration options (set of defines)
int ssl_cache_get(void *data, ssl_session *session)
Cache get callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled) ...
void ssl_cache_free(ssl_cache_context *cache)
Free referenced items in a cache context and clear memory.
This structure is used for storing cache entries.
Container for an X.509 certificate.
void x509_crt_init(x509_crt *crt)
Initialize a certificate (chain)
void(* polarssl_free)(void *ptr)
unsigned char * p
ASN1 data, e.g.
void ssl_cache_set_timeout(ssl_cache_context *cache, int timeout)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_TIMEOUT (1 day))
int(* polarssl_mutex_free)(threading_mutex_t *mutex)
Type-length-value structure that allows for ASN1 using DER.
size_t len
ASN1 length, e.g.
#define SSL_CACHE_DEFAULT_MAX_ENTRIES
void ssl_cache_set_max_entries(ssl_cache_context *cache, int max)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_MAX_ENTRIES (50))
int(* polarssl_mutex_unlock)(threading_mutex_t *mutex)
int(* polarssl_mutex_init)(threading_mutex_t *mutex)
int ssl_cache_set(void *data, const ssl_session *session)
Cache set callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled) ...