RetroArch
Macros | Functions
ssl_ticket.c File Reference
#include "mbedtls/config.h"
#include "mbedtls/platform.h"
#include "mbedtls/ssl_ticket.h"
#include <string.h>
#include "arc4_alt.h"
Include dependency graph for ssl_ticket.c:

Macros

#define MAX_KEY_BYTES   32 /* 256 bits */
 

Functions

void 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().) More...
 
static int ssl_ticket_gen_key (mbedtls_ssl_ticket_context *ctx, unsigned char index)
 
static int ssl_ticket_update_keys (mbedtls_ssl_ticket_context *ctx)
 
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)
 Prepare context to be actually used. More...
 
static int ssl_save_session (const mbedtls_ssl_session *session, unsigned char *buf, size_t buf_len, size_t *olen)
 
static int ssl_load_session (mbedtls_ssl_session *session, const unsigned char *buf, size_t len)
 
int mbedtls_ssl_ticket_write (void *p_ticket, const mbedtls_ssl_session *session, unsigned char *start, const unsigned char *end, size_t *tlen, uint32_t *ticket_lifetime)
 
static mbedtls_ssl_ticket_keyssl_ticket_select_key (mbedtls_ssl_ticket_context *ctx, const unsigned char name[4])
 
int mbedtls_ssl_ticket_parse (void *p_ticket, mbedtls_ssl_session *session, unsigned char *buf, size_t len)
 
void mbedtls_ssl_ticket_free (mbedtls_ssl_ticket_context *ctx)
 Free a context's content and zeroize it. More...
 

Macro Definition Documentation

◆ MAX_KEY_BYTES

#define MAX_KEY_BYTES   32 /* 256 bits */

Function Documentation

◆ mbedtls_ssl_ticket_free()

void mbedtls_ssl_ticket_free ( mbedtls_ssl_ticket_context ctx)

Free a context's content and zeroize it.

Parameters
ctxContext to be cleaned up
Here is the call graph for this function:

◆ mbedtls_ssl_ticket_init()

void 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().)

Parameters
ctxContext to be initialized
Here is the call graph for this function:

◆ mbedtls_ssl_ticket_parse()

int mbedtls_ssl_ticket_parse ( void p_ticket,
mbedtls_ssl_session session,
unsigned char *  buf,
size_t  len 
)
Here is the call graph for this function:

◆ mbedtls_ssl_ticket_setup()

int 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.

Parameters
ctxContext to be set up
f_rngRNG callback function
p_rngRNG callback context
cipherAEAD cipher to use for ticket protection. Recommended value: MBEDTLS_CIPHER_AES_256_GCM.
lifetimeTickets lifetime in seconds Recommended value: 86400 (one day).
Note
It is highly recommended to select a cipher that is at least as strong as the 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 reasonnable lifetime so as not to negate the benefits of forward secrecy.
Returns
0 if successful, or a specific MBEDTLS_ERR_XXX error code
Here is the call graph for this function:

◆ mbedtls_ssl_ticket_write()

int mbedtls_ssl_ticket_write ( void p_ticket,
const mbedtls_ssl_session session,
unsigned char *  start,
const unsigned char *  end,
size_t *  tlen,
uint32_t ticket_lifetime 
)
Here is the call graph for this function:

◆ ssl_load_session()

static int ssl_load_session ( mbedtls_ssl_session session,
const unsigned char *  buf,
size_t  len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssl_save_session()

static int ssl_save_session ( const mbedtls_ssl_session session,
unsigned char *  buf,
size_t  buf_len,
size_t *  olen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssl_ticket_gen_key()

static int ssl_ticket_gen_key ( mbedtls_ssl_ticket_context ctx,
unsigned char  index 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssl_ticket_select_key()

static mbedtls_ssl_ticket_key* ssl_ticket_select_key ( mbedtls_ssl_ticket_context ctx,
const unsigned char  name[4] 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ssl_ticket_update_keys()

static int ssl_ticket_update_keys ( mbedtls_ssl_ticket_context ctx)
static
Here is the call graph for this function:
Here is the caller graph for this function: