tls_client_misc.h File Reference

Helper functions for TLS client. More...

#include "tls.h"

Go to the source code of this file.

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

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

Definition in file tls_client_misc.h.

Function Documentation

◆ tls12VerifyServerKeySignature()

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]contextPointer to the TLS context
[in]signaturePointer to the digital signature
[in]lengthNumber of bytes available in the input stream
[in]paramsPointer to the server's key exchange parameters
[in]paramsLenLength of the server's key exchange parameters
[out]consumedTotal 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]contextPointer to the TLS context
[in]pOutput stream where to write the list of cipher suites
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 156 of file tls_client_misc.c.

◆ tlsFormatClientKeyParams()

error_t tlsFormatClientKeyParams ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format client's key exchange parameters.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the client's key exchange parameters
[out]writtenTotal 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]contextPointer to the TLS context
[in]pOutput stream where to write the list of compression methods
[out]writtenTotal 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]contextPointer 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]contextPointer to the TLS context
[in]pOutput stream where to write the PSK identity hint
[out]writtenTotal 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]contextPointer to the TLS context
[in]pOutput stream where to write session ID
[out]writtenTotal 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]contextPointer 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]contextPointer to the TLS context
[in]pInput stream where to read the PSK identity hint
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal 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]contextPointer to the TLS context
[in]pInput stream where to read the server's key exchange parameters
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal 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]contextPointer to the TLS context
[in]sessionIdPointer to the session ID provided by the server
[in]sessionIdLenLength of the session ID, in bytes
[in]cipherSuiteCipher 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]contextPointer to the TLS context
[in]messagePointer to the received ServerHello message
[in]extensionsServerHello 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]contextPointer to the TLS context
[in]signaturePointer to the digital signature
[in]lengthNumber of bytes available in the input stream
[in]paramsPointer to the server's key exchange parameters
[in]paramsLenLength of the server's key exchange parameters
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 845 of file tls_client_misc.c.