tls13_misc.h File Reference

TLS 1.3 helper functions. More...

Go to the source code of this file.

Macros

#define TLS13_DHE_KE_SUPPORT   ENABLED
 
#define TLS13_ECDHE_KE_SUPPORT   ENABLED
 
#define TLS13_PSK_KE_SUPPORT   DISABLED
 
#define TLS13_PSK_DHE_KE_SUPPORT   ENABLED
 
#define TLS13_PSK_ECDHE_KE_SUPPORT   ENABLED
 
#define TLS13_EARLY_DATA_SUPPORT   DISABLED
 
#define TLS13_MIDDLEBOX_COMPAT_SUPPORT   ENABLED
 
#define TLS13_MAX_COOKIE_SIZE   256
 
#define TLS13_MAX_TICKET_SIZE   1024
 
#define TLS13_MAX_TICKET_LIFETIME   604800
 
#define TLS13_TICKET_AGE_TOLERANCE   5000
 
#define TLS_NEW_SESSION_TICKET_COUNT   2
 
#define TLS13_MAX_HKDF_DIGEST_SIZE   48
 

Typedefs

struct {
   uint16_t   length
 
   uint8_t   value []
 
Tls13Cookie
 Cookie. More...
 
struct {
   uint16_t   group
 
   uint16_t   length
 
   uint8_t   keyExchange []
 
Tls13KeyShareEntry
 Key share entry. More...
 
struct {
   uint16_t   length
 
   uint8_t   value []
 
Tls13KeyShareList
 List of key shares. More...
 
struct {
   uint8_t   length
 
   uint8_t   value []
 
Tls13PskKeModeList
 List of PSK key exchange modes. More...
 
struct {
   uint16_t   length
 
   uint8_t   value []
 
Tls13PskIdentity
 PSK identity. More...
 
struct {
   uint16_t   length
 
   uint8_t   value []
 
Tls13PskIdentityList
 List of PSK identities. More...
 
struct {
   uint8_t   length
 
   uint8_t   value []
 
Tls13PskBinder
 PSK binder. More...
 
struct {
   uint16_t   length
 
   uint8_t   value []
 
Tls13PskBinderList
 List of PSK binders. More...
 
struct {
   uint8_t   length
 
   uint8_t   value []
 
Tls13CertRequestContext
 Certificate request context. More...
 
struct {
   uint16_t   algorithm
 
   uint16_t   length
 
   uint8_t   value []
 
Tls13DigitalSignature
 Digitally-signed element (TLS 1.3) More...
 
struct {
   uint16_t   serverVersion
 
   uint8_t   random [32]
 
   uint8_t   sessionIdLen
 
   uint8_t   sessionId []
 
Tls13HelloRetryRequest
 HelloRetryRequest message. More...
 
typedef void * Tls13EndOfEarlyData
 EndOfEarlyData message. More...
 
struct {
   uint16_t   extensionsLen
 
   uint8_t   extensions []
 
Tls13EncryptedExtensions
 EncryptedExtensions message. More...
 
struct {
   uint32_t   ticketLifetime
 
   uint32_t   ticketAgeAdd
 
   uint8_t   ticketNonceLen
 
   uint8_t   ticketNonce []
 
Tls13NewSessionTicket
 NewSessionTicket message (TLS 1.3) More...
 
struct {
   uint8_t   requestUpdate
 
Tls13KeyUpdate
 KeyUpdate message. More...
 
struct {
   uint16_t   length
 
   uint8_t   data []
 
Tls13Ticket
 Session ticket. More...
 
struct {
   uint16_t   version
 Protocol version. More...
 
   uint16_t   cipherSuite
 Cipher suite identifier. More...
 
   systime_t   ticketTimestamp
 Timestamp to manage ticket lifetime. More...
 
   uint32_t   ticketLifetime
 Lifetime of the ticket. More...
 
   uint32_t   ticketAgeAdd
 Random value used to obscure the age of the ticket. More...
 
   uint8_t   ticketNonce [4]
 A per-ticket value that is unique across all tickets issued. More...
 
   size_t   ticketPskLen
 Length of the PSK associated with the ticket. More...
 
   uint8_t   ticketPsk [TLS13_MAX_HKDF_DIGEST_SIZE]
 PSK associated with the ticket. More...
 
Tls13SessionState
 Session state information. More...
 

Enumerations

enum  Tls13SignatureScheme {
  TLS_SIGN_SCHEME_NONE = 0x0000, TLS_SIGN_SCHEME_RSA_PKCS1_SHA256 = 0x0401, TLS_SIGN_SCHEME_RSA_PKCS1_SHA384 = 0x0501, TLS_SIGN_SCHEME_RSA_PKCS1_SHA512 = 0x0601,
  TLS_SIGN_SCHEME_ECDSA_SECP256R1_SHA256 = 0x0403, TLS_SIGN_SCHEME_ECDSA_SECP384R1_SHA384 = 0x0503, TLS_SIGN_SCHEME_ECDSA_SECP521R1_SHA512 = 0x0603, TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA256 = 0x0804,
  TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA384 = 0x0805, TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA512 = 0x0806, TLS_SIGN_SCHEME_ED25519 = 0x0807, TLS_SIGN_SCHEME_ED448 = 0x0808,
  TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA256 = 0x0809, TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA384 = 0x080A, TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA512 = 0x080B, TLS_SIGN_SCHEME_RSA_PKCS1_SHA1 = 0x0201,
  TLS_SIGN_SCHEME_ECDSA_SHA1 = 0x0203
}
 Signature schemes (TLS 1.3) More...
 
enum  Tls13PskKeyExchMode { TLS_PSK_KEY_EXCH_MODE_PSK_KE = 0, TLS_PSK_KEY_EXCH_MODE_PSK_DHE_KE = 1 }
 PSK key exchange modes. More...
 
enum  Tls13KeyUpdateRequest { TLS_KEY_UPDATE_NOT_REQUESTED = 0, TLS_KEY_UPDATE_REQUESTED = 1 }
 Key update requests. More...
 

Functions

error_t tls13ComputePskBinder (TlsContext *context, const void *clientHello, size_t clientHelloLen, size_t truncatedClientHelloLen, const Tls13PskIdentity *identity, uint8_t *binder, size_t binderLen)
 
error_t tls13GenerateKeyShare (TlsContext *context, uint16_t namedGroup)
 
error_t tls13GenerateSharedSecret (TlsContext *context, const uint8_t *keyShare, size_t length)
 
error_t tls13GenerateSignature (TlsContext *context, uint8_t *p, size_t *length)
 
error_t tls13VerifySignature (TlsContext *context, const uint8_t *p, size_t length)
 
error_t tls13DigestClientHello1 (TlsContext *context)
 
bool_t tls13IsPskValid (TlsContext *context)
 
bool_t tls13IsTicketValid (TlsContext *context)
 
bool_t tls13IsGroupSupported (TlsContext *context, uint16_t namedGroup)
 
bool_t tls13IsEcdheGroupSupported (TlsContext *context, uint16_t namedGroup)
 
bool_t tls13IsFfdheGroupSupported (TlsContext *context, uint16_t namedGroup)
 
error_t tls13CheckDuplicateKeyShare (uint16_t namedGroup, const uint8_t *p, size_t length)
 
error_t tls13FormatCertExtensions (uint8_t *p, size_t *written)
 
error_t tls13ParseCertExtensions (const uint8_t *p, size_t length, size_t *consumed)
 

Variables

const uint8_t tls11DowngradeRandom [8]
 
const uint8_t tls12DowngradeRandom [8]
 
const uint8_t tls13HelloRetryRequestRandom [32]
 

Detailed Description

TLS 1.3 helper functions.

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file tls13_misc.h.

Macro Definition Documentation

◆ TLS13_DHE_KE_SUPPORT

#define TLS13_DHE_KE_SUPPORT   ENABLED

Definition at line 34 of file tls13_misc.h.

◆ TLS13_EARLY_DATA_SUPPORT

#define TLS13_EARLY_DATA_SUPPORT   DISABLED

Definition at line 69 of file tls13_misc.h.

◆ TLS13_ECDHE_KE_SUPPORT

#define TLS13_ECDHE_KE_SUPPORT   ENABLED

Definition at line 41 of file tls13_misc.h.

◆ TLS13_MAX_COOKIE_SIZE

#define TLS13_MAX_COOKIE_SIZE   256

Definition at line 83 of file tls13_misc.h.

◆ TLS13_MAX_HKDF_DIGEST_SIZE

#define TLS13_MAX_HKDF_DIGEST_SIZE   48

Definition at line 118 of file tls13_misc.h.

◆ TLS13_MAX_TICKET_LIFETIME

#define TLS13_MAX_TICKET_LIFETIME   604800

Definition at line 97 of file tls13_misc.h.

◆ TLS13_MAX_TICKET_SIZE

#define TLS13_MAX_TICKET_SIZE   1024

Definition at line 90 of file tls13_misc.h.

◆ TLS13_MIDDLEBOX_COMPAT_SUPPORT

#define TLS13_MIDDLEBOX_COMPAT_SUPPORT   ENABLED

Definition at line 76 of file tls13_misc.h.

◆ TLS13_PSK_DHE_KE_SUPPORT

#define TLS13_PSK_DHE_KE_SUPPORT   ENABLED

Definition at line 55 of file tls13_misc.h.

◆ TLS13_PSK_ECDHE_KE_SUPPORT

#define TLS13_PSK_ECDHE_KE_SUPPORT   ENABLED

Definition at line 62 of file tls13_misc.h.

◆ TLS13_PSK_KE_SUPPORT

#define TLS13_PSK_KE_SUPPORT   DISABLED

Definition at line 48 of file tls13_misc.h.

◆ TLS13_TICKET_AGE_TOLERANCE

#define TLS13_TICKET_AGE_TOLERANCE   5000

Definition at line 104 of file tls13_misc.h.

◆ TLS_NEW_SESSION_TICKET_COUNT

#define TLS_NEW_SESSION_TICKET_COUNT   2

Definition at line 111 of file tls13_misc.h.

Typedef Documentation

◆ Tls13CertRequestContext

typedef { ... } Tls13CertRequestContext

Certificate request context.

◆ Tls13Cookie

typedef { ... } Tls13Cookie

Cookie.

◆ Tls13DigitalSignature

typedef { ... } Tls13DigitalSignature

Digitally-signed element (TLS 1.3)

◆ Tls13EncryptedExtensions

typedef { ... } Tls13EncryptedExtensions

EncryptedExtensions message.

◆ Tls13EndOfEarlyData

typedef void* Tls13EndOfEarlyData

EndOfEarlyData message.

Definition at line 312 of file tls13_misc.h.

◆ Tls13HelloRetryRequest

typedef { ... } Tls13HelloRetryRequest

HelloRetryRequest message.

◆ Tls13KeyShareEntry

typedef { ... } Tls13KeyShareEntry

Key share entry.

◆ Tls13KeyShareList

typedef { ... } Tls13KeyShareList

List of key shares.

◆ Tls13KeyUpdate

typedef { ... } Tls13KeyUpdate

KeyUpdate message.

◆ Tls13NewSessionTicket

typedef { ... } Tls13NewSessionTicket

NewSessionTicket message (TLS 1.3)

◆ Tls13PskBinder

typedef { ... } Tls13PskBinder

PSK binder.

◆ Tls13PskBinderList

typedef { ... } Tls13PskBinderList

List of PSK binders.

◆ Tls13PskIdentity

typedef { ... } Tls13PskIdentity

PSK identity.

◆ Tls13PskIdentityList

typedef { ... } Tls13PskIdentityList

List of PSK identities.

◆ Tls13PskKeModeList

typedef { ... } Tls13PskKeModeList

List of PSK key exchange modes.

◆ Tls13SessionState

typedef { ... } Tls13SessionState

Session state information.

◆ Tls13Ticket

typedef { ... } Tls13Ticket

Session ticket.

Enumeration Type Documentation

◆ Tls13KeyUpdateRequest

Key update requests.

Enumerator
TLS_KEY_UPDATE_NOT_REQUESTED 
TLS_KEY_UPDATE_REQUESTED 

Definition at line 170 of file tls13_misc.h.

◆ Tls13PskKeyExchMode

PSK key exchange modes.

Enumerator
TLS_PSK_KEY_EXCH_MODE_PSK_KE 
TLS_PSK_KEY_EXCH_MODE_PSK_DHE_KE 

Definition at line 159 of file tls13_misc.h.

◆ Tls13SignatureScheme

Signature schemes (TLS 1.3)

Enumerator
TLS_SIGN_SCHEME_NONE 
TLS_SIGN_SCHEME_RSA_PKCS1_SHA256 
TLS_SIGN_SCHEME_RSA_PKCS1_SHA384 
TLS_SIGN_SCHEME_RSA_PKCS1_SHA512 
TLS_SIGN_SCHEME_ECDSA_SECP256R1_SHA256 
TLS_SIGN_SCHEME_ECDSA_SECP384R1_SHA384 
TLS_SIGN_SCHEME_ECDSA_SECP521R1_SHA512 
TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA256 
TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA384 
TLS_SIGN_SCHEME_RSA_PSS_RSAE_SHA512 
TLS_SIGN_SCHEME_ED25519 
TLS_SIGN_SCHEME_ED448 
TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA256 
TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA384 
TLS_SIGN_SCHEME_RSA_PSS_PSS_SHA512 
TLS_SIGN_SCHEME_RSA_PKCS1_SHA1 
TLS_SIGN_SCHEME_ECDSA_SHA1 

Definition at line 133 of file tls13_misc.h.

Function Documentation

◆ tls13CheckDuplicateKeyShare()

error_t tls13CheckDuplicateKeyShare ( uint16_t  namedGroup,
const uint8_t *  p,
size_t  length 
)

◆ tls13ComputePskBinder()

error_t tls13ComputePskBinder ( TlsContext context,
const void *  clientHello,
size_t  clientHelloLen,
size_t  truncatedClientHelloLen,
const Tls13PskIdentity identity,
uint8_t *  binder,
size_t  binderLen 
)

◆ tls13DigestClientHello1()

error_t tls13DigestClientHello1 ( TlsContext context)

◆ tls13FormatCertExtensions()

error_t tls13FormatCertExtensions ( uint8_t *  p,
size_t *  written 
)

◆ tls13GenerateKeyShare()

error_t tls13GenerateKeyShare ( TlsContext context,
uint16_t  namedGroup 
)

◆ tls13GenerateSharedSecret()

error_t tls13GenerateSharedSecret ( TlsContext context,
const uint8_t *  keyShare,
size_t  length 
)

◆ tls13GenerateSignature()

error_t tls13GenerateSignature ( TlsContext context,
uint8_t *  p,
size_t *  length 
)

◆ tls13IsEcdheGroupSupported()

bool_t tls13IsEcdheGroupSupported ( TlsContext context,
uint16_t  namedGroup 
)

◆ tls13IsFfdheGroupSupported()

bool_t tls13IsFfdheGroupSupported ( TlsContext context,
uint16_t  namedGroup 
)

◆ tls13IsGroupSupported()

bool_t tls13IsGroupSupported ( TlsContext context,
uint16_t  namedGroup 
)

◆ tls13IsPskValid()

bool_t tls13IsPskValid ( TlsContext context)

◆ tls13IsTicketValid()

bool_t tls13IsTicketValid ( TlsContext context)

◆ tls13ParseCertExtensions()

error_t tls13ParseCertExtensions ( const uint8_t *  p,
size_t  length,
size_t *  consumed 
)

◆ tls13VerifySignature()

error_t tls13VerifySignature ( TlsContext context,
const uint8_t *  p,
size_t  length 
)

Variable Documentation

◆ algorithm

uint16_t algorithm

Definition at line 289 of file tls13_misc.h.

◆ cipherSuite

uint16_t cipherSuite

Cipher suite identifier.

Definition at line 367 of file tls13_misc.h.

◆ data

uint8_t data[]

Definition at line 356 of file tls13_misc.h.

◆ extensions

uint8_t extensions[]

Definition at line 322 of file tls13_misc.h.

◆ extensionsLen

uint16_t extensionsLen

Definition at line 321 of file tls13_misc.h.

◆ group

uint16_t group

Definition at line 200 of file tls13_misc.h.

◆ keyExchange

uint8_t keyExchange[]

Definition at line 202 of file tls13_misc.h.

◆ length

uint16_t length

Definition at line 189 of file tls13_misc.h.

◆ random

uint8_t random[32]

Definition at line 302 of file tls13_misc.h.

◆ requestUpdate

uint8_t requestUpdate

Definition at line 345 of file tls13_misc.h.

◆ serverVersion

uint16_t serverVersion

Definition at line 301 of file tls13_misc.h.

◆ sessionId

uint8_t sessionId[]

Definition at line 304 of file tls13_misc.h.

◆ sessionIdLen

uint8_t sessionIdLen

Definition at line 303 of file tls13_misc.h.

◆ ticketAgeAdd

uint32_t ticketAgeAdd

Random value used to obscure the age of the ticket.

Definition at line 333 of file tls13_misc.h.

◆ ticketLifetime

uint32_t ticketLifetime

Lifetime of the ticket.

Definition at line 332 of file tls13_misc.h.

◆ ticketNonce

uint8_t ticketNonce[4]

A per-ticket value that is unique across all tickets issued.

Definition at line 335 of file tls13_misc.h.

◆ ticketNonceLen

uint8_t ticketNonceLen

Definition at line 334 of file tls13_misc.h.

◆ ticketPsk

uint8_t ticketPsk[TLS13_MAX_HKDF_DIGEST_SIZE]

PSK associated with the ticket.

Definition at line 373 of file tls13_misc.h.

◆ ticketPskLen

size_t ticketPskLen

Length of the PSK associated with the ticket.

Definition at line 372 of file tls13_misc.h.

◆ ticketTimestamp

systime_t ticketTimestamp

Timestamp to manage ticket lifetime.

Definition at line 368 of file tls13_misc.h.

◆ tls11DowngradeRandom

const uint8_t tls11DowngradeRandom[8]

◆ tls12DowngradeRandom

const uint8_t tls12DowngradeRandom[8]

◆ tls13HelloRetryRequestRandom

const uint8_t tls13HelloRetryRequestRandom[32]

◆ value

uint8_t value[]

Definition at line 190 of file tls13_misc.h.

◆ version

uint16_t version

Protocol version.

Definition at line 366 of file tls13_misc.h.