tls_common.h File Reference

Handshake message processing (TLS client and server) More...

#include "tls.h"

Go to the source code of this file.

Functions

error_t tlsSendCertificate (TlsContext *context)
 Send Certificate message. More...
 
error_t tlsSendCertificateVerify (TlsContext *context)
 Send CertificateVerify message. More...
 
error_t tlsSendChangeCipherSpec (TlsContext *context)
 Send ChangeCipherSpec message. More...
 
error_t tlsSendFinished (TlsContext *context)
 Send Finished message. More...
 
error_t tlsSendAlert (TlsContext *context, uint8_t level, uint8_t description)
 Send Alert message. More...
 
error_t tlsFormatCertificate (TlsContext *context, TlsCertificate *message, size_t *length)
 Format Certificate message. More...
 
error_t tlsFormatCertificateVerify (TlsContext *context, TlsCertificateVerify *message, size_t *length)
 Format CertificateVerify message. More...
 
error_t tlsFormatChangeCipherSpec (TlsContext *context, TlsChangeCipherSpec *message, size_t *length)
 Format ChangeCipherSpec message. More...
 
error_t tlsFormatFinished (TlsContext *context, TlsFinished *message, size_t *length)
 Format Finished message. More...
 
error_t tlsFormatAlert (TlsContext *context, uint8_t level, uint8_t description, TlsAlert *message, size_t *length)
 Format Alert message. More...
 
error_t tlsFormatCertAuthoritiesExtension (TlsContext *context, uint8_t *p, size_t *written)
 Format CertificateAuthorities extension. More...
 
error_t tlsFormatCertAuthorities (TlsContext *context, uint8_t *p, size_t *written)
 Format the list of distinguished names of acceptable CAs. More...
 
error_t tlsParseCertificate (TlsContext *context, const TlsCertificate *message, size_t length)
 Parse Certificate message. More...
 
error_t tlsParseCertificateVerify (TlsContext *context, const TlsCertificateVerify *message, size_t length)
 Parse CertificateVerify message. More...
 
error_t tlsParseChangeCipherSpec (TlsContext *context, const TlsChangeCipherSpec *message, size_t length)
 Parse ChangeCipherSpec message. More...
 
error_t tlsParseFinished (TlsContext *context, const TlsFinished *message, size_t length)
 Parse Finished message. More...
 
error_t tlsParseAlert (TlsContext *context, const TlsAlert *message, size_t length)
 Parse Alert message. More...
 

Detailed Description

Handshake message processing (TLS client and server)

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

Function Documentation

◆ tlsFormatAlert()

error_t tlsFormatAlert ( TlsContext context,
uint8_t  level,
uint8_t  description,
TlsAlert message,
size_t *  length 
)

Format Alert message.

Parameters
[in]contextPointer to the TLS context
[in]levelSeverity of the message (warning or fatal)
[in]descriptionDescription of the alert
[out]messageBuffer where to format the Alert message
[out]lengthLength of the resulting Alert message
Returns
Error code

Definition at line 806 of file tls_common.c.

◆ tlsFormatCertAuthorities()

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

Format the list of distinguished names of acceptable CAs.

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

Definition at line 882 of file tls_common.c.

◆ tlsFormatCertAuthoritiesExtension()

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

Format CertificateAuthorities extension.

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

Definition at line 830 of file tls_common.c.

◆ tlsFormatCertificate()

error_t tlsFormatCertificate ( TlsContext context,
TlsCertificate message,
size_t *  length 
)

Format Certificate message.

Parameters
[in]contextPointer to the TLS context
[out]messageBuffer where to format the Certificate message
[out]lengthLength of the resulting Certificate message
Returns
Error code

Definition at line 602 of file tls_common.c.

◆ tlsFormatCertificateVerify()

error_t tlsFormatCertificateVerify ( TlsContext context,
TlsCertificateVerify message,
size_t *  length 
)

Format CertificateVerify message.

Parameters
[in]contextPointer to the TLS context
[out]messageBuffer where to format the CertificateVerify message
[out]lengthLength of the resulting CertificateVerify message
Returns
Error code

Definition at line 691 of file tls_common.c.

◆ tlsFormatChangeCipherSpec()

error_t tlsFormatChangeCipherSpec ( TlsContext context,
TlsChangeCipherSpec message,
size_t *  length 
)

Format ChangeCipherSpec message.

Parameters
[in]contextPointer to the TLS context
[out]messageBuffer where to format the ChangeCipherSpec message
[out]lengthLength of the resulting ChangeCipherSpec message
Returns
Error code

Definition at line 750 of file tls_common.c.

◆ tlsFormatFinished()

error_t tlsFormatFinished ( TlsContext context,
TlsFinished message,
size_t *  length 
)

Format Finished message.

Parameters
[in]contextPointer to the TLS context
[out]messageBuffer where to format the Finished message
[out]lengthLength of the resulting Finished message
Returns
Error code

Definition at line 772 of file tls_common.c.

◆ tlsParseAlert()

error_t tlsParseAlert ( TlsContext context,
const TlsAlert message,
size_t  length 
)

Parse Alert message.

Parameters
[in]contextPointer to the TLS context
[in]messageIncoming Alert message to parse
[in]lengthMessage length
Returns
Error code

Definition at line 1601 of file tls_common.c.

◆ tlsParseCertificate()

error_t tlsParseCertificate ( TlsContext context,
const TlsCertificate message,
size_t  length 
)

Parse Certificate message.

Parameters
[in]contextPointer to the TLS context
[in]messageIncoming Certificate message to parse
[in]lengthMessage length
Returns
Error code

Definition at line 1018 of file tls_common.c.

◆ tlsParseCertificateVerify()

error_t tlsParseCertificateVerify ( TlsContext context,
const TlsCertificateVerify message,
size_t  length 
)

Parse CertificateVerify message.

The CertificateVerify message is used to provide explicit verification of a client certificate. This message is only sent following a client certificate that has signing capability

Parameters
[in]contextPointer to the TLS context
[in]messageIncoming CertificateVerify message to parse
[in]lengthMessage length
Returns
Error code

Definition at line 1227 of file tls_common.c.

◆ tlsParseChangeCipherSpec()

error_t tlsParseChangeCipherSpec ( TlsContext context,
const TlsChangeCipherSpec message,
size_t  length 
)

Parse ChangeCipherSpec message.

Parameters
[in]contextPointer to the TLS context
[in]messageIncoming ChangeCipherSpec message to parse
[in]lengthMessage length
Returns
Error code

Definition at line 1324 of file tls_common.c.

◆ tlsParseFinished()

error_t tlsParseFinished ( TlsContext context,
const TlsFinished message,
size_t  length 
)

Parse Finished message.

Parameters
[in]contextPointer to the TLS context
[in]messageIncoming Finished message to parse
[in]lengthMessage length
Returns
Error code

Definition at line 1455 of file tls_common.c.

◆ tlsSendAlert()

error_t tlsSendAlert ( TlsContext context,
uint8_t  level,
uint8_t  description 
)

Send Alert message.

Parameters
[in]contextPointer to the TLS context
[in]levelSeverity of the message (warning or fatal)
[in]descriptionDescription of the alert
Returns
Error code

Definition at line 516 of file tls_common.c.

◆ tlsSendCertificate()

error_t tlsSendCertificate ( TlsContext context)

Send Certificate message.

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

Definition at line 66 of file tls_common.c.

◆ tlsSendCertificateVerify()

error_t tlsSendCertificateVerify ( TlsContext context)

Send CertificateVerify message.

The CertificateVerify message is used to provide explicit verification of a client certificate. This message is only sent following a client certificate that has signing capability

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

Definition at line 192 of file tls_common.c.

◆ tlsSendChangeCipherSpec()

error_t tlsSendChangeCipherSpec ( TlsContext context)

Send ChangeCipherSpec message.

The change cipher spec message is sent by both the client and the server to notify the receiving party that subsequent records will be protected under the newly negotiated CipherSpec and keys

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

Definition at line 273 of file tls_common.c.

◆ tlsSendFinished()

error_t tlsSendFinished ( TlsContext context)

Send Finished message.

A Finished message is always sent immediately after a change cipher spec message to verify that the key exchange and authentication processes were successful. It is essential that a change cipher spec message be received between the other handshake messages and the Finished message

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

Definition at line 394 of file tls_common.c.