Loading...
Searching...
No Matches
ssl_cookie.h
Go to the documentation of this file.
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_COOKIE_H
#define MBEDTLS_SSL_COOKIE_H
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "mbedtls/ssl.h"
#if !defined(MBEDTLS_USE_PSA_CRYPTO)
#if defined(MBEDTLS_THREADING_C)
#include "mbedtls/threading.h"
#endif
#endif /* !MBEDTLS_USE_PSA_CRYPTO */
#ifndef MBEDTLS_SSL_COOKIE_TIMEOUT
#define MBEDTLS_SSL_COOKIE_TIMEOUT 60
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct mbedtls_ssl_cookie_ctx {
#if defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_svc_key_id_t MBEDTLS_PRIVATE(psa_hmac_key);
psa_algorithm_t MBEDTLS_PRIVATE(psa_hmac_alg);
#else
mbedtls_md_context_t MBEDTLS_PRIVATE(hmac_ctx);
#endif /* MBEDTLS_USE_PSA_CRYPTO */
#if !defined(MBEDTLS_HAVE_TIME)
unsigned long MBEDTLS_PRIVATE(serial);
#endif
unsigned long MBEDTLS_PRIVATE(timeout);
#if !defined(MBEDTLS_USE_PSA_CRYPTO)
#if defined(MBEDTLS_THREADING_C)
mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
#endif
#endif /* !MBEDTLS_USE_PSA_CRYPTO */
} mbedtls_ssl_cookie_ctx;
void mbedtls_ssl_cookie_init(mbedtls_ssl_cookie_ctx *ctx);
int mbedtls_ssl_cookie_setup(mbedtls_ssl_cookie_ctx *ctx,
mbedtls_f_rng_t *f_rng,
void *p_rng);
void mbedtls_ssl_cookie_set_timeout(mbedtls_ssl_cookie_ctx *ctx, unsigned long delay);
void mbedtls_ssl_cookie_free(mbedtls_ssl_cookie_ctx *ctx);
mbedtls_ssl_cookie_write_t mbedtls_ssl_cookie_write;
mbedtls_ssl_cookie_check_t mbedtls_ssl_cookie_check;
#ifdef __cplusplus
}
#endif
#endif /* ssl_cookie.h */
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition crypto_types.h:134
mbedtls_svc_key_id_t
psa_key_id_t mbedtls_svc_key_id_t
Definition crypto_types.h:292
build_info.h
Build-time configuration info.
mbedtls_f_rng_t
int mbedtls_f_rng_t(void *p_rng, unsigned char *output, size_t output_size)
The type of custom random generator (RNG) callbacks.
Definition platform_util.h:209
private_access.h
Macro wrapper for struct's members.
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition private_access.h:15
ssl.h
SSL/TLS functions.
mbedtls_ssl_cookie_write_t
int mbedtls_ssl_cookie_write_t(void *ctx, unsigned char **p, unsigned char *end, const unsigned char *info, size_t ilen)
Callback type: generate a cookie.
Definition ssl.h:3068
mbedtls_ssl_cookie_check_t
int mbedtls_ssl_cookie_check_t(void *ctx, const unsigned char *cookie, size_t clen, const unsigned char *info, size_t ilen)
Callback type: verify a cookie.
Definition ssl.h:3085
mbedtls_ssl_cookie_write
mbedtls_ssl_cookie_write_t mbedtls_ssl_cookie_write
Generate cookie, see mbedtls_ssl_cookie_write_t.
Definition ssl_cookie.h:95
mbedtls_ssl_cookie_setup
int mbedtls_ssl_cookie_setup(mbedtls_ssl_cookie_ctx *ctx, mbedtls_f_rng_t *f_rng, void *p_rng)
Setup cookie context (generate keys).
mbedtls_ssl_cookie_set_timeout
void mbedtls_ssl_cookie_set_timeout(mbedtls_ssl_cookie_ctx *ctx, unsigned long delay)
Set expiration delay for cookies (Default MBEDTLS_SSL_COOKIE_TIMEOUT).
mbedtls_ssl_cookie_free
void mbedtls_ssl_cookie_free(mbedtls_ssl_cookie_ctx *ctx)
Free cookie context.
mbedtls_ssl_cookie_check
mbedtls_ssl_cookie_check_t mbedtls_ssl_cookie_check
Verify cookie, see mbedtls_ssl_cookie_write_t.
Definition ssl_cookie.h:100
mbedtls_ssl_cookie_init
void mbedtls_ssl_cookie_init(mbedtls_ssl_cookie_ctx *ctx)
Initialize cookie context.
mbedtls_md_context_t
Definition md.h:122
mbedtls_ssl_cookie_ctx
Context for the default cookie functions.
Definition ssl_cookie.h:44
mbedtls_threading_mutex_t
Definition threading.h:29
threading.h
Threading abstraction layer.