51#if !defined(MBEDTLS_CONFIG_FILE)
54#include MBEDTLS_CONFIG_FILE
57#if defined(MBEDTLS_SSL_CACHE_C)
59#if defined(MBEDTLS_PLATFORM_C)
63#define mbedtls_calloc calloc
64#define mbedtls_free free
78#if defined(MBEDTLS_THREADING_C)
79 mbedtls_mutex_init( &
cache->mutex );
86#if defined(MBEDTLS_HAVE_TIME)
92#if defined(MBEDTLS_THREADING_C)
93 if( mbedtls_mutex_lock( &
cache->mutex ) != 0 )
105#if defined(MBEDTLS_HAVE_TIME)
106 if(
cache->timeout != 0 &&
111 if(
session->ciphersuite !=
entry->session.ciphersuite ||
117 entry->session.id_len ) != 0 )
124#if defined(MBEDTLS_X509_CRT_PARSE_C)
139 entry->peer_cert.len ) != 0 )
154#if defined(MBEDTLS_THREADING_C)
155 if( mbedtls_mutex_unlock( &
cache->mutex ) != 0 )
165#if defined(MBEDTLS_HAVE_TIME)
173#if defined(MBEDTLS_THREADING_C)
174 if( (
ret = mbedtls_mutex_lock( &
cache->mutex ) ) != 0 )
185#if defined(MBEDTLS_HAVE_TIME)
186 if(
cache->timeout != 0 &&
187 (
int) (
t -
cur->timestamp ) >
cache->timeout )
197#if defined(MBEDTLS_HAVE_TIME)
198 if( oldest == 0 ||
cur->timestamp < oldest )
200 oldest =
cur->timestamp;
211#if defined(MBEDTLS_HAVE_TIME)
262#if defined(MBEDTLS_HAVE_TIME)
269#if defined(MBEDTLS_X509_CRT_PARSE_C)
293 cur->peer_cert.len =
session->peer_cert->raw.len;
302#if defined(MBEDTLS_THREADING_C)
303 if( mbedtls_mutex_unlock( &
cache->mutex ) != 0 )
310#if defined(MBEDTLS_HAVE_TIME)
339#if defined(MBEDTLS_X509_CRT_PARSE_C)
346#if defined(MBEDTLS_THREADING_C)
347 mbedtls_mutex_free( &
cache->mutex );
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void mbedtls_x509_crt_init(mbedtls_x509_crt *crt)
Initialize a certificate (chain)
int mbedtls_x509_crt_parse(mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen)
Parse one DER-encoded or one or more concatenated PEM-encoded certificates and add them to the chaine...
#define memcpy(s1, s2, n)
Configuration options (set of defines)
void mbedtls_ssl_session_free(mbedtls_ssl_session *session)
Free referenced items in an SSL session including the peer certificate and clear memory.
SSL session cache implementation.
#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT
#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES
int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session)
Cache set callback implementation (Thread-safe if MBEDTLS_THREADING_C is enabled)
void mbedtls_ssl_cache_init(mbedtls_ssl_cache_context *cache)
Initialize an SSL cache context.
void mbedtls_ssl_cache_free(mbedtls_ssl_cache_context *cache)
Free referenced items in a cache context and clear memory.
void mbedtls_ssl_cache_set_max_entries(mbedtls_ssl_cache_context *cache, int max)
Set the maximum number of cache entries (Default: MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES (50))
int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session)
Cache get callback implementation (Thread-safe if MBEDTLS_THREADING_C is enabled)
This structure is used for storing cache entries.
mbedtls_ssl_cache_entry * next
mbedtls_x509_buf peer_cert
mbedtls_ssl_session session