Mbed TLS v4.1.1
Loading...
Searching...
No Matches
ssl_ticket.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10#ifndef MBEDTLS_SSL_TICKET_H
11#define MBEDTLS_SSL_TICKET_H
12#include "mbedtls/private_access.h"
13
14#include "mbedtls/build_info.h"
15
16/*
17 * This implementation of the session ticket callbacks includes key
18 * management, rotating the keys periodically in order to preserve forward
19 * secrecy, when MBEDTLS_HAVE_TIME is defined.
20 */
21
22#include "mbedtls/ssl.h"
23
24#if defined(MBEDTLS_HAVE_TIME)
26#endif
27
28#include "psa/crypto.h"
29
30#if defined(MBEDTLS_THREADING_C)
31#include "mbedtls/threading.h"
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#define MBEDTLS_SSL_TICKET_MAX_KEY_BYTES 32
39#define MBEDTLS_SSL_TICKET_KEY_NAME_BYTES 4
40
44typedef struct mbedtls_ssl_ticket_key {
45 unsigned char MBEDTLS_PRIVATE(name)[MBEDTLS_SSL_TICKET_KEY_NAME_BYTES];
47#if defined(MBEDTLS_HAVE_TIME)
48 mbedtls_time_t MBEDTLS_PRIVATE(generation_time);
49#endif
53 uint32_t MBEDTLS_PRIVATE(lifetime);
54 mbedtls_svc_key_id_t MBEDTLS_PRIVATE(key);
55 psa_algorithm_t MBEDTLS_PRIVATE(alg);
56 psa_key_type_t MBEDTLS_PRIVATE(key_type);
57 size_t MBEDTLS_PRIVATE(key_bits);
58}
60
65 mbedtls_ssl_ticket_key MBEDTLS_PRIVATE(keys)[2];
66 unsigned char MBEDTLS_PRIVATE(active);
67
68 uint32_t MBEDTLS_PRIVATE(ticket_lifetime);
69
71
72#if defined(MBEDTLS_THREADING_C)
73 mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
74#endif
75}
77
86
115 psa_algorithm_t alg, psa_key_type_t key_type, psa_key_bits_t key_bits,
116 uint32_t lifetime);
117
157 const unsigned char *name, size_t nlength,
158 const unsigned char *k, size_t klength,
159 uint32_t lifetime);
160
167
174
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif /* ssl_ticket.h */
Platform Security Architecture cryptography module.
uint16_t psa_key_bits_t
uint16_t psa_key_type_t
Encoding of a key type.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
psa_key_id_t mbedtls_svc_key_id_t
Build-time configuration info.
Mbed TLS Platform time abstraction.
time_t mbedtls_time_t
SSL/TLS functions.
int mbedtls_ssl_ticket_write_t(void *p_ticket, const mbedtls_ssl_session *session, unsigned char *start, const unsigned char *end, size_t *tlen, uint32_t *lifetime)
Callback type: generate and write session ticket.
Definition ssl.h:2543
int mbedtls_ssl_ticket_parse_t(void *p_ticket, mbedtls_ssl_session *session, unsigned char *buf, size_t len)
Callback type: parse and load session ticket.
Definition ssl.h:2573
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...
void mbedtls_ssl_ticket_free(mbedtls_ssl_ticket_context *ctx)
Free a context's content and zeroize it.
#define MBEDTLS_SSL_TICKET_KEY_NAME_BYTES
Definition ssl_ticket.h:39
int mbedtls_ssl_ticket_rotate(mbedtls_ssl_ticket_context *ctx, const unsigned char *name, size_t nlength, const unsigned char *k, size_t klength, uint32_t lifetime)
Rotate session ticket encryption key to new specified key. Provides for external control of session t...
mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write
Implementation of the ticket write callback.
Definition ssl_ticket.h:166
mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse
Implementation of the ticket parse callback.
Definition ssl_ticket.h:173
int mbedtls_ssl_ticket_setup(mbedtls_ssl_ticket_context *ctx, psa_algorithm_t alg, psa_key_type_t key_type, psa_key_bits_t key_bits, uint32_t lifetime)
Prepare context to be actually used.
Context for session ticket handling functions.
Definition ssl_ticket.h:64
Information for session ticket protection.
Definition ssl_ticket.h:44
Threading abstraction layer.