tls_ticket.h File Reference

TLS session tickets. More...

#include "tls.h"
#include "cipher/aes.h"
#include "aead/gcm.h"

Go to the source code of this file.

Data Structures

struct  TlsTicketEncryptionState
 Session ticket encryption state. More...
 
struct  TlsTicketContext
 Session ticket encryption context. More...
 

Macros

#define TLS_TICKET_KEY_NAME_SIZE   16
 
#define TLS_TICKET_KEY_SIZE   32
 
#define TLS_TICKET_IV_SIZE   12
 
#define TLS_TICKET_TAG_SIZE   16
 

Functions

error_t tlsInitTicketContext (TlsTicketContext *ticketContext)
 Initialize ticket encryption context. More...
 
error_t tlsEncryptTicket (TlsContext *context, const uint8_t *plaintext, size_t plaintextLen, uint8_t *ciphertext, size_t *ciphertextLen, void *param)
 Session ticket encryption. More...
 
error_t tlsDecryptTicket (TlsContext *context, const uint8_t *ciphertext, size_t ciphertextLen, uint8_t *plaintext, size_t *plaintextLen, void *param)
 Session ticket decryption. More...
 
error_t tlsGenerateTicketKeys (TlsTicketContext *ticketContext, const PrngAlgo *prngAlgo, void *prngContext)
 Generate a new set of keys. More...
 
void tlsCheckTicketKeyLifetime (TlsTicketEncryptionState *state)
 Check the validity of a given set of keys. More...
 
bool_t tlsCompareTicketKeyName (const uint8_t *ticket, size_t ticketLen, const TlsTicketEncryptionState *state)
 Key name comparison. More...
 
void tlsFreeTicketContext (TlsTicketContext *ticketContext)
 Properly dispose ticket encryption context. More...
 

Detailed Description

TLS session tickets.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file tls_ticket.h.

Macro Definition Documentation

◆ TLS_TICKET_IV_SIZE

#define TLS_TICKET_IV_SIZE   12

Definition at line 55 of file tls_ticket.h.

◆ TLS_TICKET_KEY_NAME_SIZE

#define TLS_TICKET_KEY_NAME_SIZE   16

Definition at line 41 of file tls_ticket.h.

◆ TLS_TICKET_KEY_SIZE

#define TLS_TICKET_KEY_SIZE   32

Definition at line 48 of file tls_ticket.h.

◆ TLS_TICKET_TAG_SIZE

#define TLS_TICKET_TAG_SIZE   16

Definition at line 62 of file tls_ticket.h.

Function Documentation

◆ tlsCheckTicketKeyLifetime()

void tlsCheckTicketKeyLifetime ( TlsTicketEncryptionState state)

Check the validity of a given set of keys.

Parameters
[in]statePointer to ticket encryption state

Definition at line 387 of file tls_ticket.c.

◆ tlsCompareTicketKeyName()

bool_t tlsCompareTicketKeyName ( const uint8_t *  ticket,
size_t  ticketLen,
const TlsTicketEncryptionState state 
)

Key name comparison.

Parameters
[in]ticketEncrypted ticket
[in]ticketLenLength of the encrypted ticket, in bytes
[in]statePointer to ticket encryption state

Definition at line 414 of file tls_ticket.c.

◆ tlsDecryptTicket()

error_t tlsDecryptTicket ( TlsContext context,
const uint8_t *  ciphertext,
size_t  ciphertextLen,
uint8_t *  plaintext,
size_t *  plaintextLen,
void *  param 
)

Session ticket decryption.

Parameters
[in]contextPointer to the TLS context
[in]ciphertextEncrypted ticket
[in]ciphertextLenLength of the encrypted ticket, in bytes
[out]plaintextPlaintext session state
[out]plaintextLenLength of the plaintext session state, in bytes
[in]paramPointer to the ticket encryption context
Returns
Error code

Definition at line 221 of file tls_ticket.c.

◆ tlsEncryptTicket()

error_t tlsEncryptTicket ( TlsContext context,
const uint8_t *  plaintext,
size_t  plaintextLen,
uint8_t *  ciphertext,
size_t *  ciphertextLen,
void *  param 
)

Session ticket encryption.

Parameters
[in]contextPointer to the TLS context
[in]plaintextPlaintext session state
[in]plaintextLenLength of the plaintext session state, in bytes
[out]ciphertextEncrypted ticket
[out]ciphertextLenLength of the encrypted ticket, in bytes
[in]paramPointer to the ticket encryption context
Returns
Error code

Definition at line 81 of file tls_ticket.c.

◆ tlsFreeTicketContext()

void tlsFreeTicketContext ( TlsTicketContext ticketContext)

Properly dispose ticket encryption context.

Parameters
[in]ticketContextPointer to ticket encryption context to be released

Definition at line 448 of file tls_ticket.c.

◆ tlsGenerateTicketKeys()

error_t tlsGenerateTicketKeys ( TlsTicketContext ticketContext,
const PrngAlgo prngAlgo,
void *  prngContext 
)

Generate a new set of keys.

Parameters
[in]ticketContextPointer to ticket encryption context
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
Returns
Error code

Definition at line 346 of file tls_ticket.c.

◆ tlsInitTicketContext()

error_t tlsInitTicketContext ( TlsTicketContext ticketContext)

Initialize ticket encryption context.

Parameters
[in]ticketContextPointer to ticket encryption context
Returns
Error code

Definition at line 49 of file tls_ticket.c.