Helper functions for TLS client. More...
#include "tls.h"
#include "tls_cipher_suites.h"
#include "tls_client.h"
#include "tls_client_misc.h"
#include "tls_common.h"
#include "tls_extensions.h"
#include "tls_sign_verify.h"
#include "tls_sign_misc.h"
#include "tls_cache.h"
#include "tls_ffdhe.h"
#include "tls_record.h"
#include "tls_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL TLS_TRACE_LEVEL |
Functions | |
error_t | tlsFormatInitialClientHello (TlsContext *context) |
Format initial ClientHello message. More... | |
error_t | tlsFormatSessionId (TlsContext *context, uint8_t *p, size_t *written) |
Format session ID. More... | |
error_t | tlsFormatCipherSuites (TlsContext *context, uint8_t *p, size_t *written) |
Format the list of cipher suites supported by the client. More... | |
error_t | tlsFormatCompressMethods (TlsContext *context, uint8_t *p, size_t *written) |
Format the list of compression methods supported by the client. More... | |
error_t | tlsFormatPskIdentity (TlsContext *context, uint8_t *p, size_t *written) |
Format PSK identity. More... | |
__weak_func error_t | tlsFormatClientKeyParams (TlsContext *context, uint8_t *p, size_t *written) |
Format client's key exchange parameters. More... | |
error_t | tlsParsePskIdentityHint (TlsContext *context, const uint8_t *p, size_t length, size_t *consumed) |
Parse PSK identity hint. More... | |
error_t | tlsParseServerKeyParams (TlsContext *context, const uint8_t *p, size_t length, size_t *consumed) |
Parse server's key exchange parameters. More... | |
error_t | tlsVerifyServerKeySignature (TlsContext *context, const TlsDigitalSignature *signature, size_t length, const uint8_t *params, size_t paramsLen, size_t *consumed) |
Verify server's key exchange parameters signature (TLS 1.0 and TLS 1.1) More... | |
__weak_func error_t | tls12VerifyServerKeySignature (TlsContext *context, const Tls12DigitalSignature *signature, size_t length, const uint8_t *params, size_t paramsLen, size_t *consumed) |
Verify server's key exchange parameters signature (TLS 1.2) More... | |
error_t | tlsSelectClientVersion (TlsContext *context, const TlsServerHello *message, const TlsHelloExtensions *extensions) |
Version selection. More... | |
error_t | tlsResumeSession (TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, uint16_t cipherSuite) |
Resume TLS session via session ID. More... | |
bool_t | tlsIsTicketValid (TlsContext *context) |
Check whether a session ticket is valid. More... | |
Detailed Description
Helper functions for TLS client.
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.
- Version
- 2.4.4
Definition in file tls_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL TLS_TRACE_LEVEL |
Definition at line 32 of file tls_client_misc.c.
Function Documentation
◆ tls12VerifyServerKeySignature()
__weak_func error_t tls12VerifyServerKeySignature | ( | TlsContext * | context, |
const Tls12DigitalSignature * | signature, | ||
size_t | length, | ||
const uint8_t * | params, | ||
size_t | paramsLen, | ||
size_t * | consumed | ||
) |
Verify server's key exchange parameters signature (TLS 1.2)
- Parameters
-
[in] context Pointer to the TLS context [in] signature Pointer to the digital signature [in] length Number of bytes available in the input stream [in] params Pointer to the server's key exchange parameters [in] paramsLen Length of the server's key exchange parameters [out] consumed Total number of bytes that have been consumed
- Returns
- Error code
Definition at line 1030 of file tls_client_misc.c.
◆ tlsFormatCipherSuites()
error_t tlsFormatCipherSuites | ( | TlsContext * | context, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format the list of cipher suites supported by the client.
- Parameters
-
[in] context Pointer to the TLS context [in] p Output stream where to write the list of cipher suites [out] written Total number of bytes that have been written
- Returns
- Error code
Definition at line 156 of file tls_client_misc.c.
◆ tlsFormatClientKeyParams()
__weak_func error_t tlsFormatClientKeyParams | ( | TlsContext * | context, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format client's key exchange parameters.
- Parameters
-
[in] context Pointer to the TLS context [in] p Output stream where to write the client's key exchange parameters [out] written Total number of bytes that have been written
- Returns
- Error code
Definition at line 366 of file tls_client_misc.c.
◆ tlsFormatCompressMethods()
error_t tlsFormatCompressMethods | ( | TlsContext * | context, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format the list of compression methods supported by the client.
- Parameters
-
[in] context Pointer to the TLS context [in] p Output stream where to write the list of compression methods [out] written Total number of bytes that have been written
- Returns
- Error code
Definition at line 292 of file tls_client_misc.c.
◆ tlsFormatInitialClientHello()
error_t tlsFormatInitialClientHello | ( | TlsContext * | context | ) |
Format initial ClientHello message.
- Parameters
-
[in] context Pointer to the TLS context
- Returns
- Error code
Definition at line 59 of file tls_client_misc.c.
◆ tlsFormatPskIdentity()
error_t tlsFormatPskIdentity | ( | TlsContext * | context, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format PSK identity.
- Parameters
-
[in] context Pointer to the TLS context [in] p Output stream where to write the PSK identity hint [out] written Total number of bytes that have been written
- Returns
- Error code
Definition at line 321 of file tls_client_misc.c.
◆ tlsFormatSessionId()
error_t tlsFormatSessionId | ( | TlsContext * | context, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format session ID.
- Parameters
-
[in] context Pointer to the TLS context [in] p Output stream where to write session ID [out] written Total number of bytes that have been written
- Returns
- Error code
Definition at line 103 of file tls_client_misc.c.
◆ tlsIsTicketValid()
bool_t tlsIsTicketValid | ( | TlsContext * | context | ) |
Check whether a session ticket is valid.
- Parameters
-
[in] context Pointer to the TLS context
- Returns
- TRUE is the session ticket is valid, else FALSE
Definition at line 1507 of file tls_client_misc.c.
◆ tlsParsePskIdentityHint()
error_t tlsParsePskIdentityHint | ( | TlsContext * | context, |
const uint8_t * | p, | ||
size_t | length, | ||
size_t * | consumed | ||
) |
Parse PSK identity hint.
- Parameters
-
[in] context Pointer to the TLS context [in] p Input stream where to read the PSK identity hint [in] length Number of bytes available in the input stream [out] consumed Total number of bytes that have been consumed
- Returns
- Error code
Definition at line 547 of file tls_client_misc.c.
◆ tlsParseServerKeyParams()
error_t tlsParseServerKeyParams | ( | TlsContext * | context, |
const uint8_t * | p, | ||
size_t | length, | ||
size_t * | consumed | ||
) |
Parse server's key exchange parameters.
- Parameters
-
[in] context Pointer to the TLS context [in] p Input stream where to read the server's key exchange parameters [in] length Number of bytes available in the input stream [out] consumed Total number of bytes that have been consumed
- Returns
- Error code
Definition at line 598 of file tls_client_misc.c.
◆ tlsResumeSession()
error_t tlsResumeSession | ( | TlsContext * | context, |
const uint8_t * | sessionId, | ||
size_t | sessionIdLen, | ||
uint16_t | cipherSuite | ||
) |
Resume TLS session via session ID.
- Parameters
-
[in] context Pointer to the TLS context [in] sessionId Pointer to the session ID provided by the server [in] sessionIdLen Length of the session ID, in bytes [in] cipherSuite Cipher suite selected by the server
- Returns
- Error code
Definition at line 1458 of file tls_client_misc.c.
◆ tlsSelectClientVersion()
error_t tlsSelectClientVersion | ( | TlsContext * | context, |
const TlsServerHello * | message, | ||
const TlsHelloExtensions * | extensions | ||
) |
Version selection.
- Parameters
-
[in] context Pointer to the TLS context [in] message Pointer to the received ServerHello message [in] extensions ServerHello extensions offered by the server
- Returns
- Error code
Definition at line 1293 of file tls_client_misc.c.
◆ tlsVerifyServerKeySignature()
error_t tlsVerifyServerKeySignature | ( | TlsContext * | context, |
const TlsDigitalSignature * | signature, | ||
size_t | length, | ||
const uint8_t * | params, | ||
size_t | paramsLen, | ||
size_t * | consumed | ||
) |
Verify server's key exchange parameters signature (TLS 1.0 and TLS 1.1)
- Parameters
-
[in] context Pointer to the TLS context [in] signature Pointer to the digital signature [in] length Number of bytes available in the input stream [in] params Pointer to the server's key exchange parameters [in] paramsLen Length of the server's key exchange parameters [out] consumed Total number of bytes that have been consumed
- Returns
- Error code
Definition at line 845 of file tls_client_misc.c.