ssl_ticket.h
mbedtls/config.h
mbedtls/ssl.h
mbedtls/cipher.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
mbedtls/ssl_ciphersuites.h
ssl_ticket.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_ticket_key
mbedtls_ssl_ticket_context
struct mbedtls_ssl_ticket_key typedef struct mbedtls_ssl_ticket_key mbedtls_ssl_ticket_key mbedtls_ssl_ticket_key

Information for session ticket protection.

struct mbedtls_ssl_ticket_context typedef struct mbedtls_ssl_ticket_context mbedtls_ssl_ticket_context mbedtls_ssl_ticket_context

Context for session ticket handling functions.

mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write mbedtls_ssl_ticket_write

Implementation of the ticket write callback.

See `mbedtls_ssl_ticket_write_t` for description

mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse mbedtls_ssl_ticket_parse

Implementation of the ticket parse callback.

See `mbedtls_ssl_ticket_parse_t` for description

void void mbedtls_ssl_ticket_init (mbedtls_ssl_ticket_context *ctx) mbedtls_ssl_ticket_init mbedtls_ssl_ticket_context * ctx

Initialize a ticket context. (Just make it ready for mbedtls_ssl_ticket_setup() or mbedtls_ssl_ticket_free().)

ctx

Context to be initialized

int int mbedtls_ssl_ticket_setup (mbedtls_ssl_ticket_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, mbedtls_cipher_type_t cipher, uint32_t lifetime) mbedtls_ssl_ticket_setup mbedtls_ssl_ticket_context * ctx int(*)(void *, unsigned char *, size_t) f_rng void * p_rng mbedtls_cipher_type_t cipher uint32_t lifetime

Prepare context to be actually used.

ctx

Context to be set up

f_rng

RNG callback function

p_rng

RNG callback context

cipher

AEAD cipher to use for ticket protection. Recommended value: MBEDTLS_CIPHER_AES_256_GCM.

lifetime

Tickets lifetime in seconds Recommended value: 86400 (one day).

It is highly recommended to select a cipher that is at least as strong as the strongest ciphersuite supported. Usually that means a 256-bit key.

The lifetime of the keys is twice the lifetime of tickets. It is recommended to pick a reasonable lifetime so as not to negate the benefits of forward secrecy.

0 if successful, or a specific MBEDTLS_ERR_XXX error code

void void mbedtls_ssl_ticket_free (mbedtls_ssl_ticket_context *ctx) mbedtls_ssl_ticket_free mbedtls_ssl_ticket_context * ctx

Free a context's content and zeroize it.

ctx

Context to be cleaned up

TLS server ticket callbacks implementation.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_SSL_TICKET_H
    #defineMBEDTLS_SSL_TICKET_H

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

    /*
    *Thisimplementationofthesessionticketcallbacksincludeskey
    *management,rotatingthekeysperiodicallyinordertopreserveforward
    *secrecy,whenMBEDTLS_HAVE_TIMEisdefined.
    */

    #include"mbedtls/ssl.h"
    #include"mbedtls/cipher.h"

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

    #ifdef__cplusplus
    extern"C"{
    #endif

    typedefstructmbedtls_ssl_ticket_key{
    unsignedcharname[4];
    uint32_tgeneration_time;
    mbedtls_cipher_context_tctx;
    }
    mbedtls_ssl_ticket_key;

    typedefstructmbedtls_ssl_ticket_context{
    mbedtls_ssl_ticket_keykeys[2];
    unsignedcharactive;
    uint32_tticket_lifetime;
    int(*f_rng)(void*,unsignedchar*,size_t);
    void*p_rng;
    #ifdefined(MBEDTLS_THREADING_C)
    mbedtls_threading_mutex_tmutex;
    #endif
    }
    mbedtls_ssl_ticket_context;

    voidmbedtls_ssl_ticket_init(mbedtls_ssl_ticket_context*ctx);

    intmbedtls_ssl_ticket_setup(mbedtls_ssl_ticket_context*ctx,
    int(*f_rng)(void*,unsignedchar*,size_t),void*p_rng,
    mbedtls_cipher_type_tcipher,
    uint32_tlifetime);

    mbedtls_ssl_ticket_write_tmbedtls_ssl_ticket_write;

    mbedtls_ssl_ticket_parse_tmbedtls_ssl_ticket_parse;

    voidmbedtls_ssl_ticket_free(mbedtls_ssl_ticket_context*ctx);

    #ifdef__cplusplus
    }
    #endif

    #endif/*ssl_ticket.h*/