tls_extensions.c File Reference

Parsing and checking of TLS extensions. More...

#include "tls.h"
#include "tls_cipher_suites.h"
#include "tls_extensions.h"
#include "tls_transcript_hash.h"
#include "tls_record.h"
#include "dtls_record.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tlsParseHelloExtensions (TlsMessageType msgType, const uint8_t *p, size_t length, TlsHelloExtensions *extensions)
 Parse Hello extensions. More...
 
error_t tlsCheckHelloExtensions (TlsMessageType msgType, uint16_t version, TlsHelloExtensions *extensions)
 Check Hello extensions. More...
 
error_t tlsCheckDuplicateExtension (uint16_t type, const uint8_t *p, size_t length)
 Check whether the specified extension type is a duplicate. More...
 
bool_t tlsIsAlpnProtocolSupported (TlsContext *context, const char_t *protocol, size_t length)
 Check whether the specified ALPN protocol is supported. More...
 

Detailed Description

Parsing and checking of TLS extensions.

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

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_extensions.c.

Function Documentation

◆ tlsCheckDuplicateExtension()

error_t tlsCheckDuplicateExtension ( uint16_t  type,
const uint8_t *  p,
size_t  length 
)

Check whether the specified extension type is a duplicate.

Parameters
[in]typeExtension type
[in]pInput stream where to read the list of extensions
[in]lengthNumber of bytes available in the input stream
Returns
Error code

Definition at line 1049 of file tls_extensions.c.

◆ tlsCheckHelloExtensions()

error_t tlsCheckHelloExtensions ( TlsMessageType  msgType,
uint16_t  version,
TlsHelloExtensions extensions 
)

Check Hello extensions.

Parameters
[in]msgTypeHandshake message type
[in]versionTLS version
[in]extensionsList of Hello extensions offered by the peer
Returns
Error code

Definition at line 710 of file tls_extensions.c.

◆ tlsIsAlpnProtocolSupported()

bool_t tlsIsAlpnProtocolSupported ( TlsContext context,
const char_t protocol,
size_t  length 
)

Check whether the specified ALPN protocol is supported.

Parameters
[in]contextPointer to the TLS context
[in]protocolPointer to the protocol name
[in]lengthLength of the protocol name, in bytes
Returns
TRUE if the specified protocol is supported, else FALSE

Definition at line 1103 of file tls_extensions.c.

◆ tlsParseHelloExtensions()

error_t tlsParseHelloExtensions ( TlsMessageType  msgType,
const uint8_t *  p,
size_t  length,
TlsHelloExtensions extensions 
)

Parse Hello extensions.

Parameters
[in]msgTypeHandshake message type
[in]pInput stream where to read the list of extensions
[in]lengthNumber of bytes available in the input stream
[out]extensionsList of Hello extensions resulting from the parsing process
Returns
Error code

Definition at line 56 of file tls_extensions.c.