tls_key_material.c File Reference

Key material generation. More...

#include "tls/tls.h"
#include "tls/tls_key_material.h"
#include "tls/tls_transcript_hash.h"
#include "kdf/tls_kdf.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tlsGenerateSessionKeys (TlsContext *context)
 Generate session keys. More...
 
__weak_func error_t tlsGenerateMasterSecret (TlsContext *context)
 Master secret computation. More...
 
error_t tlsGenerateExtendedMasterSecret (TlsContext *context)
 Extended master secret computation. More...
 
error_t tlsGeneratePskPremasterSecret (TlsContext *context)
 Premaster secret generation (for PSK cipher suites) More...
 
__weak_func error_t tlsGenerateKeyBlock (TlsContext *context, size_t keyBlockLen)
 Key expansion function. More...
 
void tlsDumpSecret (TlsContext *context, const char_t *label, const uint8_t *secret, size_t secretLen)
 Dump secret key (for debugging purpose only) More...
 

Detailed Description

Key material generation.

License

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

Copyright (C) 2010-2026 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.6.6

Definition in file tls_key_material.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_key_material.c.

Function Documentation

◆ tlsDumpSecret()

void tlsDumpSecret ( TlsContext *  context,
const char_t *  label,
const uint8_t *  secret,
size_t  secretLen 
)

Dump secret key (for debugging purpose only)

Parameters
[in]contextPointer to the TLS context
[in]labelIdentifying label (NULL-terminated string)
[in]secretPointer to the secret key
[in]secretLenLength of the secret key, in bytes

Definition at line 444 of file tls_key_material.c.

◆ tlsGenerateExtendedMasterSecret()

error_t tlsGenerateExtendedMasterSecret ( TlsContext *  context)

Extended master secret computation.

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

Definition at line 193 of file tls_key_material.c.

◆ tlsGenerateKeyBlock()

__weak_func error_t tlsGenerateKeyBlock ( TlsContext *  context,
size_t  keyBlockLen 
)

Key expansion function.

Parameters
[in]contextPointer to the TLS context
[in]keyBlockLenDesired length for the resulting key block
Returns
Error code

Definition at line 393 of file tls_key_material.c.

◆ tlsGenerateMasterSecret()

__weak_func error_t tlsGenerateMasterSecret ( TlsContext *  context)

Master secret computation.

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

Definition at line 143 of file tls_key_material.c.

◆ tlsGeneratePskPremasterSecret()

error_t tlsGeneratePskPremasterSecret ( TlsContext *  context)

Premaster secret generation (for PSK cipher suites)

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

Definition at line 291 of file tls_key_material.c.

◆ tlsGenerateSessionKeys()

error_t tlsGenerateSessionKeys ( TlsContext *  context)

Generate session keys.

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

Definition at line 51 of file tls_key_material.c.