tls_client_extensions.c File Reference

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

#include <string.h>
#include "tls.h"
#include "tls_cipher_suites.h"
#include "tls_client_extensions.h"
#include "tls_extensions.h"
#include "tls_ffdhe.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 tlsFormatClientSupportedVersionsExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format SupportedVersions extension. More...
 
error_t tlsFormatClientSniExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format SNI extension. More...
 
error_t tlsFormatClientMaxFragLenExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format MaxFragmentLength extension. More...
 
error_t tlsFormatClientRecordSizeLimitExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format RecordSizeLimit extension. More...
 
error_t tlsFormatSupportedGroupsExtension (TlsContext *context, uint_t cipherSuiteTypes, uint8_t *p, size_t *written)
 Format SupportedGroups extension. More...
 
error_t tlsFormatClientEcPointFormatsExtension (TlsContext *context, uint_t cipherSuiteTypes, uint8_t *p, size_t *written)
 Format EcPointFormats extension. More...
 
error_t tlsFormatClientAlpnExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format ALPN extension. More...
 
error_t tlsFormatClientCertTypeListExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format ClientCertType extension. More...
 
error_t tlsFormatServerCertTypeListExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format ServerCertType extension. More...
 
error_t tlsFormatClientEmsExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format ExtendedMasterSecret extension. More...
 
error_t tlsFormatClientRenegoInfoExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format RenegotiationInfo extension. More...
 
error_t tlsFormatClientHelloPaddingExtension (TlsContext *context, size_t clientHelloLen, uint8_t *p, size_t *written)
 Format ClientHello Padding extension. More...
 
error_t tlsParseServerSniExtension (TlsContext *context, const TlsServerNameList *serverNameList)
 Parse SNI extension. More...
 
error_t tlsParseServerMaxFragLenExtension (TlsContext *context, const uint8_t *maxFragLen)
 Parse MaxFragmentLength extension. More...
 
error_t tlsParseServerRecordSizeLimitExtension (TlsContext *context, const uint8_t *recordSizeLimit)
 Parse RecordSizeLimit extension. More...
 
error_t tlsParseServerEcPointFormatsExtension (TlsContext *context, const TlsEcPointFormatList *ecPointFormatList)
 Parse EcPointFormats extension. More...
 
error_t tlsParseServerAlpnExtension (TlsContext *context, const TlsProtocolNameList *protocolNameList)
 Parse ALPN extension. More...
 
error_t tlsParseClientCertTypeExtension (TlsContext *context, const uint8_t *clientCertType)
 Parse ClientCertType extension. More...
 
error_t tlsParseServerCertTypeExtension (TlsContext *context, const uint8_t *serverCertType)
 Parse ServerCertType extension. More...
 
error_t tlsParseServerEmsExtension (TlsContext *context, const uint8_t *extendedMasterSecret)
 Parse ExtendedMasterSecret extension. More...
 
error_t tlsParseServerRenegoInfoExtension (TlsContext *context, const TlsHelloExtensions *extensions)
 Parse RenegotiationInfo extension. More...
 

Variables

const uint16_t tlsSupportedGroups []
 

Detailed Description

Formatting and parsing of extensions (TLS client)

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file tls_client_extensions.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 30 of file tls_client_extensions.c.

Function Documentation

◆ tlsFormatClientAlpnExtension()

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

Format ALPN extension.

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

Definition at line 528 of file tls_client_extensions.c.

◆ tlsFormatClientCertTypeListExtension()

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

Format ClientCertType extension.

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

Definition at line 614 of file tls_client_extensions.c.

◆ tlsFormatClientEcPointFormatsExtension()

error_t tlsFormatClientEcPointFormatsExtension ( TlsContext context,
uint_t  cipherSuiteTypes,
uint8_t *  p,
size_t *  written 
)

Format EcPointFormats extension.

Parameters
[in]contextPointer to the TLS context
[in]cipherSuiteTypesTypes of cipher suites proposed by the client
[in]pOutput stream where to write the EcPointFormats extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 466 of file tls_client_extensions.c.

◆ tlsFormatClientEmsExtension()

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

Format ExtendedMasterSecret extension.

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

Definition at line 730 of file tls_client_extensions.c.

◆ tlsFormatClientHelloPaddingExtension()

error_t tlsFormatClientHelloPaddingExtension ( TlsContext context,
size_t  clientHelloLen,
uint8_t *  p,
size_t *  written 
)

Format ClientHello Padding extension.

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

Definition at line 843 of file tls_client_extensions.c.

◆ tlsFormatClientMaxFragLenExtension()

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

Format MaxFragmentLength extension.

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

Definition at line 237 of file tls_client_extensions.c.

◆ tlsFormatClientRecordSizeLimitExtension()

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

Format RecordSizeLimit extension.

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

Definition at line 298 of file tls_client_extensions.c.

◆ tlsFormatClientRenegoInfoExtension()

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

Format RenegotiationInfo extension.

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

Definition at line 775 of file tls_client_extensions.c.

◆ tlsFormatClientSniExtension()

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

Format SNI extension.

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

Definition at line 173 of file tls_client_extensions.c.

◆ tlsFormatClientSupportedVersionsExtension()

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

Format SupportedVersions extension.

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

Definition at line 79 of file tls_client_extensions.c.

◆ tlsFormatServerCertTypeListExtension()

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

Format ServerCertType extension.

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

Definition at line 670 of file tls_client_extensions.c.

◆ tlsFormatSupportedGroupsExtension()

error_t tlsFormatSupportedGroupsExtension ( TlsContext context,
uint_t  cipherSuiteTypes,
uint8_t *  p,
size_t *  written 
)

Format SupportedGroups extension.

Parameters
[in]contextPointer to the TLS context
[in]cipherSuiteTypesTypes of cipher suites proposed by the client
[in]pOutput stream where to write the SupportedGroups extension
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 356 of file tls_client_extensions.c.

◆ tlsParseClientCertTypeExtension()

error_t tlsParseClientCertTypeExtension ( TlsContext context,
const uint8_t *  clientCertType 
)

Parse ClientCertType extension.

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

Definition at line 1161 of file tls_client_extensions.c.

◆ tlsParseServerAlpnExtension()

error_t tlsParseServerAlpnExtension ( TlsContext context,
const TlsProtocolNameList protocolNameList 
)

Parse ALPN extension.

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

Definition at line 1081 of file tls_client_extensions.c.

◆ tlsParseServerCertTypeExtension()

error_t tlsParseServerCertTypeExtension ( TlsContext context,
const uint8_t *  serverCertType 
)

Parse ServerCertType extension.

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

Definition at line 1195 of file tls_client_extensions.c.

◆ tlsParseServerEcPointFormatsExtension()

error_t tlsParseServerEcPointFormatsExtension ( TlsContext context,
const TlsEcPointFormatList ecPointFormatList 
)

Parse EcPointFormats extension.

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

Definition at line 1033 of file tls_client_extensions.c.

◆ tlsParseServerEmsExtension()

error_t tlsParseServerEmsExtension ( TlsContext context,
const uint8_t *  extendedMasterSecret 
)

Parse ExtendedMasterSecret extension.

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

Definition at line 1237 of file tls_client_extensions.c.

◆ tlsParseServerMaxFragLenExtension()

error_t tlsParseServerMaxFragLenExtension ( TlsContext context,
const uint8_t *  maxFragLen 
)

Parse MaxFragmentLength extension.

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

Definition at line 928 of file tls_client_extensions.c.

◆ tlsParseServerRecordSizeLimitExtension()

error_t tlsParseServerRecordSizeLimitExtension ( TlsContext context,
const uint8_t *  recordSizeLimit 
)

Parse RecordSizeLimit extension.

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

Definition at line 977 of file tls_client_extensions.c.

◆ tlsParseServerRenegoInfoExtension()

error_t tlsParseServerRenegoInfoExtension ( TlsContext context,
const TlsHelloExtensions extensions 
)

Parse RenegotiationInfo extension.

Parameters
[in]contextPointer to the TLS context
[in]extensionsServerHello extensions offered by the server
Returns
Error code

Definition at line 1290 of file tls_client_extensions.c.

◆ tlsParseServerSniExtension()

error_t tlsParseServerSniExtension ( TlsContext context,
const TlsServerNameList serverNameList 
)

Parse SNI extension.

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

Definition at line 901 of file tls_client_extensions.c.

Variable Documentation

◆ tlsSupportedGroups