ssl_cache.h
mbedtls/config.h
mbedtls/ssl.h
mbedtls/threading.h
mbedtls/asn1.h
mbedtls/bignum.h
mbedtls/check_config.h
mbedtls/cipher.h
mbedtls/config.h
mbedtls/dhm.h
mbedtls/ecdh.h
mbedtls/ecdsa.h
mbedtls/ecp.h
mbedtls/md.h
mbedtls/pk.h
mbedtls/platform_time.h
mbedtls/platform_util.h
mbedtls/rsa.h
mbedtls/ssl.h
ssl_cache.h
mbedtls/ssl_ciphersuites.h
mbedtls/threading.h
mbedtls/x509.h
mbedtls/x509_crl.h
mbedtls/x509_crt.h
limits.h
pthread.h
stddef.h
stdint.h
stdio.h
stdlib.h
time.h
mbedtls_ssl_cache_entry
mbedtls_ssl_cache_context
SECTION: Module settings

The configuration options you can set for this module are in this section. Either change them in config.h or define them on the compiler command line.

MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT
86400

1 day

MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES
50

Maximum entries in cache

struct mbedtls_ssl_cache_context typedef struct mbedtls_ssl_cache_context mbedtls_ssl_cache_context mbedtls_ssl_cache_context
struct mbedtls_ssl_cache_entry typedef struct mbedtls_ssl_cache_entry mbedtls_ssl_cache_entry mbedtls_ssl_cache_entry
void void mbedtls_ssl_cache_init (mbedtls_ssl_cache_context *cache) mbedtls_ssl_cache_init mbedtls_ssl_cache_context * cache

Initialize an SSL cache context.

cache

SSL cache context

int int mbedtls_ssl_cache_get (void *data, mbedtls_ssl_session *session) mbedtls_ssl_cache_get void * data mbedtls_ssl_session * session

Cache get callback implementation (Thread-safe if MBEDTLS_THREADING_C is enabled)

data

SSL cache context

session

session to retrieve entry for

`0` on success.

MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND if there is no cache entry with specified session ID found, or any other negative error code for other failures.

int int mbedtls_ssl_cache_set (void *data, const mbedtls_ssl_session *session) mbedtls_ssl_cache_set void * data const mbedtls_ssl_session * session

Cache set callback implementation (Thread-safe if MBEDTLS_THREADING_C is enabled)

data

SSL cache context

session

session to store entry for

`0` on success.

A negative error code on failure.

void void mbedtls_ssl_cache_set_timeout (mbedtls_ssl_cache_context *cache, int timeout) mbedtls_ssl_cache_set_timeout mbedtls_ssl_cache_context * cache int timeout

Set the cache timeout (Default: MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT (1 day))

A timeout of 0 indicates no timeout.

cache

SSL cache context

timeout

cache entry timeout in seconds

void void mbedtls_ssl_cache_set_max_entries (mbedtls_ssl_cache_context *cache, int max) 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))

cache

SSL cache context

max

cache entry maximum

void void mbedtls_ssl_cache_free (mbedtls_ssl_cache_context *cache) mbedtls_ssl_cache_free mbedtls_ssl_cache_context * cache

Free referenced items in a cache context and clear memory.

cache

SSL cache context

SSL session cache implementation.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_SSL_CACHE_H
    #defineMBEDTLS_SSL_CACHE_H

    #if!defined(MBEDTLS_CONFIG_FILE)
    #include"mbedtls/config.h"
    #else
    #includeMBEDTLS_CONFIG_FILE
    #endif

    #include"mbedtls/ssl.h"

    #ifdefined(MBEDTLS_THREADING_C)
    #include"mbedtls/threading.h"
    #endif

    #if!defined(MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT)
    #defineMBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT86400
    #endif

    #if!defined(MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES)
    #defineMBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES50
    #endif

    #ifdef__cplusplus
    extern"C"{
    #endif

    typedefstructmbedtls_ssl_cache_contextmbedtls_ssl_cache_context;
    typedefstructmbedtls_ssl_cache_entrymbedtls_ssl_cache_entry;

    structmbedtls_ssl_cache_entry{
    #ifdefined(MBEDTLS_HAVE_TIME)
    mbedtls_time_ttimestamp;
    #endif
    mbedtls_ssl_sessionsession;
    #ifdefined(MBEDTLS_X509_CRT_PARSE_C)&&\
    defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
    mbedtls_x509_bufpeer_cert;
    #endif
    mbedtls_ssl_cache_entry*next;
    };

    structmbedtls_ssl_cache_context{
    mbedtls_ssl_cache_entry*chain;
    inttimeout;
    intmax_entries;
    #ifdefined(MBEDTLS_THREADING_C)
    mbedtls_threading_mutex_tmutex;
    #endif
    };

    voidmbedtls_ssl_cache_init(mbedtls_ssl_cache_context*cache);

    intmbedtls_ssl_cache_get(void*data,mbedtls_ssl_session*session);

    intmbedtls_ssl_cache_set(void*data,constmbedtls_ssl_session*session);

    #ifdefined(MBEDTLS_HAVE_TIME)
    voidmbedtls_ssl_cache_set_timeout(mbedtls_ssl_cache_context*cache,inttimeout);
    #endif/*MBEDTLS_HAVE_TIME*/

    voidmbedtls_ssl_cache_set_max_entries(mbedtls_ssl_cache_context*cache,intmax);

    voidmbedtls_ssl_cache_free(mbedtls_ssl_cache_context*cache);

    #ifdef__cplusplus
    }
    #endif

    #endif/*ssl_cache.h*/