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-2019 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 1.9.6
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  uint_t cipherSuiteTypes, uint8_t *p, size_t *written);
66 
68  uint8_t *p, 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
uint8_t length
Definition: dtls_misc.h:149
__start_packed struct @88 TlsChangeCipherSpec
ChangeCipherSpec message.
error_t tlsFormatCertificateVerify(TlsContext *context, TlsCertificateVerify *message, size_t *length)
Format CertificateVerify message.
Definition: tls_common.c:655
uint8_t p
Definition: ndp.h:298
error_t tlsFormatCertificate(TlsContext *context, TlsCertificate *message, size_t *length)
Format Certificate message.
Definition: tls_common.c:566
error_t tlsSendCertificateVerify(TlsContext *context)
Send CertificateVerify message.
Definition: tls_common.c:192
uint8_t level
Definition: tls.h:1702
void TlsFinished
Finished message.
Definition: tls.h:1683
error_t tlsFormatSignatureAlgorithmsExtension(TlsContext *context, uint_t cipherSuiteTypes, uint8_t *p, size_t *written)
Format SignatureAlgorithms extension.
Definition: tls_common.c:795
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:42
error_t tlsParseCertificateVerify(TlsContext *context, const TlsCertificateVerify *message, size_t length)
Parse CertificateVerify message.
Definition: tls_common.c:1432
error_t tlsParseAlert(TlsContext *context, const TlsAlert *message, size_t length)
Parse Alert message.
Definition: tls_common.c:1772
void TlsCertificateVerify
CertificateVerify message.
Definition: tls.h:1676
error_t tlsFormatFinished(TlsContext *context, TlsFinished *message, size_t *length)
Format Finished message.
Definition: tls_common.c:736
error_t tlsParseFinished(TlsContext *context, const TlsFinished *message, size_t length)
Parse Finished message.
Definition: tls_common.c:1656
error_t tlsParseCertificate(TlsContext *context, const TlsCertificate *message, size_t length)
Parse Certificate message.
Definition: tls_common.c:1231
__start_packed struct @89 TlsAlert
Alert message.
error_t tlsParseChangeCipherSpec(TlsContext *context, const TlsChangeCipherSpec *message, size_t length)
Parse ChangeCipherSpec message.
Definition: tls_common.c:1525
error_t tlsFormatAlert(TlsContext *context, uint8_t level, uint8_t description, TlsAlert *message, size_t *length)
Format Alert message.
Definition: tls_common.c:770
error_t tlsFormatChangeCipherSpec(TlsContext *context, TlsChangeCipherSpec *message, size_t *length)
Format ChangeCipherSpec message.
Definition: tls_common.c:714
error_t tlsSendCertificate(TlsContext *context)
Send Certificate message.
Definition: tls_common.c:62
uint8_t message[]
Definition: chap.h:152
error_t tlsFormatSignatureAlgorithmsCertExtension(TlsContext *context, uint8_t *p, size_t *written)
Format SignatureAlgorithmsCert extension.
Definition: tls_common.c:1001
TLS (Transport Layer Security)
error_t tlsSendFinished(TlsContext *context)
Send Finished message.
Definition: tls_common.c:383
error_t tlsSendChangeCipherSpec(TlsContext *context)
Send ChangeCipherSpec message.
Definition: tls_common.c:268
unsigned int uint_t
Definition: compiler_port.h:45
error_t tlsSendAlert(TlsContext *context, uint8_t level, uint8_t description)
Send Alert message.
Definition: tls_common.c:480
void TlsCertificate
Certificate message.
Definition: tls.h:1637
uint8_t description
Definition: tls.h:1703