tls13_key_material.c File Reference

TLS 1.3 key schedule. More...

#include "tls.h"
#include "tls_key_material.h"
#include "tls_transcript_hash.h"
#include "tls_misc.h"
#include "tls13_key_material.h"
#include "tls13_ticket.h"
#include "kdf/hkdf.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tls13HkdfExpandLabel (TlsTransportProtocol transportProtocol, const HashAlgo *hash, const uint8_t *secret, size_t secretLen, const char_t *label, const uint8_t *context, size_t contextLen, uint8_t *output, size_t outputLen)
 HKDF-Expand-Label function. More...
 
error_t tls13DeriveSecret (TlsContext *context, const uint8_t *secret, size_t secretLen, const char_t *label, const char_t *message, size_t messageLen, uint8_t *output, size_t outputLen)
 Derive-Secret function. More...
 
error_t tls13GenerateEarlyTrafficKeys (TlsContext *context)
 Compute early traffic keys. More...
 
error_t tls13GenerateHandshakeTrafficKeys (TlsContext *context)
 Compute handshake traffic keys. More...
 
error_t tls13GenerateServerAppTrafficKeys (TlsContext *context)
 Compute server application traffic keys. More...
 
error_t tls13GenerateClientAppTrafficKeys (TlsContext *context)
 Compute client application traffic keys. More...
 

Detailed Description

TLS 1.3 key schedule.

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

Definition in file tls13_key_material.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls13_key_material.c.

Function Documentation

◆ tls13DeriveSecret()

error_t tls13DeriveSecret ( TlsContext context,
const uint8_t *  secret,
size_t  secretLen,
const char_t label,
const char_t message,
size_t  messageLen,
uint8_t *  output,
size_t  outputLen 
)

Derive-Secret function.

Parameters
[in]contextPointer to the TLS context
[in]secretPointer to the secret
[in]secretLenLength of the secret
[in]labelIdentifying label (NULL-terminated string)
[in]messageConcatenation of the indicated handshake messages
[in]messageLenLength of the indicated handshake messages
[out]outputPointer to the output
[in]outputLenDesired output length
Returns
Error code

Definition at line 156 of file tls13_key_material.c.

◆ tls13GenerateClientAppTrafficKeys()

error_t tls13GenerateClientAppTrafficKeys ( TlsContext context)

Compute client application traffic keys.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 746 of file tls13_key_material.c.

◆ tls13GenerateEarlyTrafficKeys()

error_t tls13GenerateEarlyTrafficKeys ( TlsContext context)

Compute early traffic keys.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 213 of file tls13_key_material.c.

◆ tls13GenerateHandshakeTrafficKeys()

error_t tls13GenerateHandshakeTrafficKeys ( TlsContext context)

Compute handshake traffic keys.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 332 of file tls13_key_material.c.

◆ tls13GenerateServerAppTrafficKeys()

error_t tls13GenerateServerAppTrafficKeys ( TlsContext context)

Compute server application traffic keys.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 544 of file tls13_key_material.c.

◆ tls13HkdfExpandLabel()

error_t tls13HkdfExpandLabel ( TlsTransportProtocol  transportProtocol,
const HashAlgo hash,
const uint8_t *  secret,
size_t  secretLen,
const char_t label,
const uint8_t *  context,
size_t  contextLen,
uint8_t *  output,
size_t  outputLen 
)

HKDF-Expand-Label function.

Parameters
[in]transportProtocolTransport protocol (TLS or DTLS)
[in]hashHash function used by HKDF
[in]secretPointer to the secret
[in]secretLenLength of the secret
[in]labelIdentifying label (NULL-terminated string)
[in]contextPointer to the upper-layer context
[in]contextLenLength of the upper-layer context
[out]outputPointer to the output
[in]outputLenDesired output length
Returns
Error code

Definition at line 62 of file tls13_key_material.c.