tls_common.h
Go to the documentation of this file.
1 /**
2  * @file tls_common.h
3  * @brief Handshake message processing (TLS client and server)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _TLS_COMMON_H
32 #define _TLS_COMMON_H
33 
34 //Dependencies
35 #include "tls.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //TLS related functions
47 error_t tlsSendAlert(TlsContext *context, uint8_t level, uint8_t description);
48 
50  TlsCertificate *message, size_t *length);
51 
54 
57 
59  TlsFinished *message, size_t *length);
60 
61 error_t tlsFormatAlert(TlsContext *context, uint8_t level,
62  uint8_t description, TlsAlert *message, size_t *length);
63 
65  uint8_t *p, size_t *written);
66 
67 error_t tlsFormatCertAuthorities(TlsContext *context, uint8_t *p,
68  size_t *written);
69 
71  const TlsCertificate *message, size_t length);
72 
74  const TlsCertificateVerify *message, size_t length);
75 
77  const TlsChangeCipherSpec *message, size_t length);
78 
80  const TlsFinished *message, size_t length);
81 
83  const TlsAlert *message, size_t length);
84 
85 //C++ guard
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif
error_t tlsFormatCertificateVerify(TlsContext *context, TlsCertificateVerify *message, size_t *length)
Format CertificateVerify message.
Definition: tls_common.c:691
uint8_t p
Definition: ndp.h:300
uint8_t message[]
Definition: chap.h:154
error_t tlsFormatCertificate(TlsContext *context, TlsCertificate *message, size_t *length)
Format Certificate message.
Definition: tls_common.c:602
error_t tlsSendCertificateVerify(TlsContext *context)
Send CertificateVerify message.
Definition: tls_common.c:192
TlsChangeCipherSpec
Definition: tls.h:1862
error_t tlsFormatCertAuthoritiesExtension(TlsContext *context, uint8_t *p, size_t *written)
Format CertificateAuthorities extension.
Definition: tls_common.c:830
void TlsFinished
Finished message.
Definition: tls.h:1852
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
error_t tlsParseCertificateVerify(TlsContext *context, const TlsCertificateVerify *message, size_t length)
Parse CertificateVerify message.
Definition: tls_common.c:1227
error_t tlsParseAlert(TlsContext *context, const TlsAlert *message, size_t length)
Parse Alert message.
Definition: tls_common.c:1601
void TlsCertificateVerify
CertificateVerify message.
Definition: tls.h:1833
TlsAlert
Definition: tls.h:1873
error_t tlsFormatFinished(TlsContext *context, TlsFinished *message, size_t *length)
Format Finished message.
Definition: tls_common.c:772
error_t tlsParseFinished(TlsContext *context, const TlsFinished *message, size_t length)
Parse Finished message.
Definition: tls_common.c:1455
uint8_t length
Definition: tcp.h:368
error_t tlsParseCertificate(TlsContext *context, const TlsCertificate *message, size_t length)
Parse Certificate message.
Definition: tls_common.c:1018
error_t tlsParseChangeCipherSpec(TlsContext *context, const TlsChangeCipherSpec *message, size_t length)
Parse ChangeCipherSpec message.
Definition: tls_common.c:1324
error_t tlsFormatAlert(TlsContext *context, uint8_t level, uint8_t description, TlsAlert *message, size_t *length)
Format Alert message.
Definition: tls_common.c:806
error_t tlsFormatChangeCipherSpec(TlsContext *context, TlsChangeCipherSpec *message, size_t *length)
Format ChangeCipherSpec message.
Definition: tls_common.c:750
error_t tlsSendCertificate(TlsContext *context)
Send Certificate message.
Definition: tls_common.c:66
TLS (Transport Layer Security)
error_t tlsSendFinished(TlsContext *context)
Send Finished message.
Definition: tls_common.c:394
error_t tlsSendChangeCipherSpec(TlsContext *context)
Send ChangeCipherSpec message.
Definition: tls_common.c:273
error_t tlsSendAlert(TlsContext *context, uint8_t level, uint8_t description)
Send Alert message.
Definition: tls_common.c:516
error_t tlsFormatCertAuthorities(TlsContext *context, uint8_t *p, size_t *written)
Format the list of distinguished names of acceptable CAs.
Definition: tls_common.c:882
void TlsCertificate
Certificate message.
Definition: tls.h:1794
uint8_t description
Definition: tls.h:1872