tls_server_misc.h
Go to the documentation of this file.
1 /**
2  * @file tls_server_misc.h
3  * @brief Helper functions for TLS 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_SERVER_MISC_H
32 #define _TLS_SERVER_MISC_H
33 
34 //Dependencies
35 #include "tls.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //TLS server specific functions
44  uint8_t *p, size_t *written);
45 
47  uint8_t *p, size_t *written);
48 
50  TlsDigitalSignature *signature, const uint8_t *params,
51  size_t paramsLen, size_t *written);
52 
54  Tls12DigitalSignature *signature, const uint8_t *params,
55  size_t paramsLen, size_t *written);
56 
58  const TlsCipherSuites *cipherSuites);
59 
60 error_t tlsResumeStatefulSession(TlsContext *context, const uint8_t *sessionId,
61  size_t sessionIdLen, const TlsCipherSuites *cipherSuites,
63 
64 error_t tlsResumeStatelessSession(TlsContext *context, const uint8_t *sessionId,
65  size_t sessionIdLen, const TlsCipherSuites *cipherSuites,
67 
68 error_t tlsNegotiateVersion(TlsContext *context, uint16_t clientVersion,
69  const TlsSupportedVersionList *supportedVersionList);
70 
71 error_t tlsNegotiateCipherSuite(TlsContext *context, const HashAlgo *hashAlgo,
72  const TlsCipherSuites *cipherSuites, TlsHelloExtensions *extensions);
73 
75  const TlsSupportedGroupList *groupList);
76 
78  const TlsSupportedGroupList *groupList);
79 
82 
84  const TlsCompressMethods *compressMethods);
85 
87  const uint8_t *p, size_t length, size_t *consumed);
88 
90  const uint8_t *p, size_t length, size_t *consumed);
91 
92 //C++ guard
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
uint8_t extensions[]
Definition: ntp_common.h:207
error_t tls12GenerateServerKeySignature(TlsContext *context, Tls12DigitalSignature *signature, const uint8_t *params, size_t paramsLen, size_t *written)
Sign server's key exchange parameters (TLS 1.2)
uint8_t sessionId[]
Definition: tls.h:1773
TlsDigitalSignature
Definition: tls.h:1717
error_t tlsResumeStatefulSession(TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, const TlsCipherSuites *cipherSuites, const TlsHelloExtensions *extensions)
Resume TLS session via session ID.
uint8_t p
Definition: ndp.h:300
error_t tlsNegotiateVersion(TlsContext *context, uint16_t clientVersion, const TlsSupportedVersionList *supportedVersionList)
Version negotiation.
error_t tlsParseCompressMethods(TlsContext *context, const TlsCompressMethods *compressMethods)
Parse the list of compression methods supported by the client.
error_t tlsSelectGroup(TlsContext *context, const TlsSupportedGroupList *groupList)
Select the group to be used when performing (EC)DHE key exchange.
uint8_t sessionIdLen
Definition: tls.h:1772
error_t tlsResumeStatelessSession(TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, const TlsCipherSuites *cipherSuites, const TlsHelloExtensions *extensions)
Resume TLS session via session ticket.
TlsCipherSuites
Definition: tls.h:1517
error_t tlsParseClientKeyParams(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse client's key exchange parameters.
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
Tls12DigitalSignature
Definition: tls.h:1729
error_t tlsCheckSignalingCipherSuiteValues(TlsContext *context, const TlsCipherSuites *cipherSuites)
Check whether the ClientHello includes any SCSV cipher suites.
error_t tlsNegotiateCipherSuite(TlsContext *context, const HashAlgo *hashAlgo, const TlsCipherSuites *cipherSuites, TlsHelloExtensions *extensions)
Cipher suite negotiation.
error_t tlsParsePskIdentity(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse PSK identity.
uint8_t length
Definition: tcp.h:368
error_t tlsFormatPskIdentityHint(TlsContext *context, uint8_t *p, size_t *written)
Format PSK identity hint.
error_t tlsSelectCertificate(TlsContext *context, const TlsHelloExtensions *extensions)
Certificate selection process.
TlsCompressMethods
Definition: tls.h:1528
Hello extensions.
Definition: tls.h:2098
error_t tlsSelectEcdheGroup(TlsContext *context, const TlsSupportedGroupList *groupList)
Select the named curve to be used when performing ECDHE key exchange.
TLS (Transport Layer Security)
Common interface for hash algorithms.
Definition: crypto.h:1046
TlsSupportedGroupList
Definition: tls.h:1651
TlsSupportedVersionList
Definition: tls.h:1595
error_t tlsGenerateServerKeySignature(TlsContext *context, TlsDigitalSignature *signature, const uint8_t *params, size_t paramsLen, size_t *written)
Sign server's key exchange parameters (TLS 1.0 and TLS 1.1)
error_t tlsFormatServerKeyParams(TlsContext *context, uint8_t *p, size_t *written)
Format server's key exchange parameters.