ssl_cache.h
mbedtls/private_access.h
mbedtls/build_info.h
mbedtls/ssl.h
mbedtls/threading.h
mbedtls/asn1.h
mbedtls/bignum.h
mbedtls/build_info.h
mbedtls/ccm.h
mbedtls/chacha20.h
mbedtls/chachapoly.h
mbedtls/check_config.h
mbedtls/cipher.h
mbedtls/cmac.h
mbedtls/config_adjust_legacy_crypto.h
mbedtls/config_adjust_psa_from_legacy.h
mbedtls/config_adjust_psa_superset_legacy.h
mbedtls/config_adjust_ssl.h
mbedtls/config_adjust_x509.h
mbedtls/config_psa.h
mbedtls/dhm.h
mbedtls/ecdh.h
mbedtls/ecdsa.h
mbedtls/ecjpake.h
mbedtls/ecp.h
mbedtls/gcm.h
mbedtls/mbedtls_config.h
mbedtls/md.h
mbedtls/md5.h
mbedtls/pk.h
mbedtls/platform_time.h
mbedtls/platform_util.h
mbedtls/poly1305.h
mbedtls/private_access.h
mbedtls/ripemd160.h
mbedtls/rsa.h
mbedtls/sha1.h
mbedtls/sha256.h
mbedtls/sha3.h
mbedtls/sha512.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
psa/build_info.h
psa/crypto.h
psa/crypto_adjust_auto_enabled.h
psa/crypto_adjust_config_dependencies.h
psa/crypto_adjust_config_key_pair_types.h
psa/crypto_adjust_config_synonyms.h
psa/crypto_builtin_composites.h
psa/crypto_builtin_key_derivation.h
psa/crypto_builtin_primitives.h
crypto_compat.h
psa/crypto_driver_common.h
psa/crypto_driver_contexts_composites.h
psa/crypto_driver_contexts_key_derivation.h
psa/crypto_driver_contexts_primitives.h
crypto_extra.h
psa/crypto_legacy.h
crypto_platform.h
crypto_sizes.h
crypto_struct.h
crypto_types.h
crypto_values.h
inttypes.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 mbedtls_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, unsigned char const *session_id, size_t session_id_len, mbedtls_ssl_session *session) mbedtls_ssl_cache_get void * data unsigned char const * session_id size_t session_id_len mbedtls_ssl_session * session

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

data

The SSL cache context to use.

session_id

The pointer to the buffer holding the session ID for the session to load.

session_id_len

The length of `session_id` in bytes.

session

The address at which to store the session associated with `session_id`, if present.

`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, unsigned char const *session_id, size_t session_id_len, const mbedtls_ssl_session *session) mbedtls_ssl_cache_set void * data unsigned char const * session_id size_t session_id_len const mbedtls_ssl_session * session

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

data

The SSL cache context to use.

session_id

The pointer to the buffer holding the session ID associated to `session`.

session_id_len

The length of `session_id` in bytes.

session

The session to store.

`0` on success.

A negative error code on failure.

int int mbedtls_ssl_cache_remove (void *data, unsigned char const *session_id, size_t session_id_len) mbedtls_ssl_cache_remove void * data unsigned char const * session_id size_t session_id_len

Remove the cache entry by the session ID (Thread-safe if MBEDTLS_THREADING_C is enabled)

data

The SSL cache context to use.

session_id

The pointer to the buffer holding the session ID associated to session.

session_id_len

The length of `session_id` in bytes.

`0` on success. This indicates the cache entry for the session with provided ID is removed or does not exist.

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

int static int mbedtls_ssl_cache_get_timeout (mbedtls_ssl_cache_context *cache) mbedtls_ssl_cache_get_timeout mbedtls_ssl_cache_context * cache

Get the cache timeout.

A timeout of 0 indicates no timeout. cache

SSL cache context

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
    #include"mbedtls/private_access.h"

    #include"mbedtls/build_info.h"

    #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_tMBEDTLS_PRIVATE(timestamp);
    #endif

    unsignedcharMBEDTLS_PRIVATE(session_id)[32];
    size_tMBEDTLS_PRIVATE(session_id_len);

    unsignedchar*MBEDTLS_PRIVATE(session);
    size_tMBEDTLS_PRIVATE(session_len);

    mbedtls_ssl_cache_entry*MBEDTLS_PRIVATE(next);
    };

    structmbedtls_ssl_cache_context{
    mbedtls_ssl_cache_entry*MBEDTLS_PRIVATE(chain);
    intMBEDTLS_PRIVATE(timeout);
    intMBEDTLS_PRIVATE(max_entries);
    #ifdefined(MBEDTLS_THREADING_C)
    mbedtls_threading_mutex_tMBEDTLS_PRIVATE(mutex);
    #endif
    };

    voidmbedtls_ssl_cache_init(mbedtls_ssl_cache_context*cache);

    intmbedtls_ssl_cache_get(void*data,
    unsignedcharconst*session_id,
    size_tsession_id_len,
    mbedtls_ssl_session*session);

    intmbedtls_ssl_cache_set(void*data,
    unsignedcharconst*session_id,
    size_tsession_id_len,
    constmbedtls_ssl_session*session);

    intmbedtls_ssl_cache_remove(void*data,
    unsignedcharconst*session_id,
    size_tsession_id_len);

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

    staticinlineintmbedtls_ssl_cache_get_timeout(mbedtls_ssl_cache_context*cache)
    {
    returncache->MBEDTLS_PRIVATE(timeout);
    }
    #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*/