tls13_client_extensions.c File Reference

Formatting and parsing of extensions (TLS 1.3 client) More...

#include "tls.h"
#include "tls_misc.h"
#include "tls13_client_extensions.h"
#include "tls13_ticket.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tls13FormatCookieExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format Cookie extension. More...
 
error_t tls13FormatClientKeyShareExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format KeyShare extension (ClientHello message) More...
 
error_t tls13FormatPskKeModesExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format PskKeyExchangeModes extension. More...
 
error_t tls13FormatClientPreSharedKeyExtension (TlsContext *context, uint8_t *p, size_t *written, Tls13PskIdentityList **identityList, Tls13PskBinderList **binderList)
 Format PreSharedKey extension. More...
 
error_t tls13FormatClientEarlyDataExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format EarlyData extension. More...
 
error_t tls13ParseServerSupportedVersionsExtension (TlsContext *context, const TlsExtension *selectedVersion)
 Parse SupportedVersions extension. More...
 
error_t tls13ParseCookieExtension (TlsContext *context, const Tls13Cookie *cookie)
 Parse Cookie extension. More...
 
error_t tls13ParseSelectedGroupExtension (TlsContext *context, const TlsExtension *selectedGroup)
 Parse KeyShare extension (HelloRetryRequest message) More...
 
error_t tls13ParseServerKeyShareExtension (TlsContext *context, const Tls13KeyShareEntry *serverShare)
 Parse KeyShare extension (ServerHello message) More...
 
error_t tls13ParseServerPreSharedKeyExtension (TlsContext *context, const TlsExtension *selectedIdentity)
 Parse PreSharedKey extension. More...
 
error_t tls13ParseServerEarlyDataExtension (TlsContext *context, TlsMessageType msgType, const TlsExtension *earlyDataIndication)
 Parse EarlyData extension. More...
 

Detailed Description

Formatting and parsing of extensions (TLS 1.3 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.4

Definition in file tls13_client_extensions.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls13_client_extensions.c.

Function Documentation

◆ tls13FormatClientEarlyDataExtension()

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

Format EarlyData extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the EarlyData extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 476 of file tls13_client_extensions.c.

◆ tls13FormatClientKeyShareExtension()

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

Format KeyShare extension (ClientHello message)

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the KeyShare extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 108 of file tls13_client_extensions.c.

◆ tls13FormatClientPreSharedKeyExtension()

error_t tls13FormatClientPreSharedKeyExtension ( TlsContext context,
uint8_t *  p,
size_t *  written,
Tls13PskIdentityList **  identityList,
Tls13PskBinderList **  binderList 
)

Format PreSharedKey extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the PreSharedKey extension
[out]writtenTotal number of bytes that have been written
[out]identityListPointer to the list of the identities that the client is willing to negotiate with the server
[out]binderListPointer to the list of HMAC values, one for each PSK offered in the PreSharedKey extension
Returns
Error code

Definition at line 312 of file tls13_client_extensions.c.

◆ tls13FormatCookieExtension()

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

Format Cookie extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the Cookie extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 54 of file tls13_client_extensions.c.

◆ tls13FormatPskKeModesExtension()

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

Format PskKeyExchangeModes extension.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the PskKeyExchangeModes extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 250 of file tls13_client_extensions.c.

◆ tls13ParseCookieExtension()

error_t tls13ParseCookieExtension ( TlsContext context,
const Tls13Cookie cookie 
)

Parse Cookie extension.

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

Definition at line 552 of file tls13_client_extensions.c.

◆ tls13ParseSelectedGroupExtension()

error_t tls13ParseSelectedGroupExtension ( TlsContext context,
const TlsExtension selectedGroup 
)

Parse KeyShare extension (HelloRetryRequest message)

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

Definition at line 604 of file tls13_client_extensions.c.

◆ tls13ParseServerEarlyDataExtension()

error_t tls13ParseServerEarlyDataExtension ( TlsContext context,
TlsMessageType  msgType,
const TlsExtension earlyDataIndication 
)

Parse EarlyData extension.

Parameters
[in]msgTypeHandshake message type
[in]contextPointer to the TLS context
[in]earlyDataIndicationPointer to the EarlyData extension
Returns
Error code

Definition at line 863 of file tls13_client_extensions.c.

◆ tls13ParseServerKeyShareExtension()

error_t tls13ParseServerKeyShareExtension ( TlsContext context,
const Tls13KeyShareEntry serverShare 
)

Parse KeyShare extension (ServerHello message)

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

Definition at line 654 of file tls13_client_extensions.c.

◆ tls13ParseServerPreSharedKeyExtension()

error_t tls13ParseServerPreSharedKeyExtension ( TlsContext context,
const TlsExtension selectedIdentity 
)

Parse PreSharedKey extension.

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

Definition at line 758 of file tls13_client_extensions.c.

◆ tls13ParseServerSupportedVersionsExtension()

error_t tls13ParseServerSupportedVersionsExtension ( TlsContext context,
const TlsExtension selectedVersion 
)

Parse SupportedVersions extension.

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

Definition at line 516 of file tls13_client_extensions.c.