tls_client_misc.h
Go to the documentation of this file.
1 /**
2  * @file tls_client_misc.h
3  * @brief Helper functions for TLS client
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_CLIENT_MISC_H
32 #define _TLS_CLIENT_MISC_H
33 
34 //Dependencies
35 #include "tls.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //TLS client specific functions
44 
45 error_t tlsFormatSessionId(TlsContext *context, uint8_t *p,
46  size_t *written);
47 
48 error_t tlsFormatCipherSuites(TlsContext *context, uint8_t *p,
49  size_t *written);
50 
51 error_t tlsFormatCompressMethods(TlsContext *context, uint8_t *p,
52  size_t *written);
53 
54 error_t tlsFormatPskIdentity(TlsContext *context, uint8_t *p,
55  size_t *written);
56 
57 error_t tlsFormatClientKeyParams(TlsContext *context, uint8_t *p,
58  size_t *written);
59 
60 error_t tlsParsePskIdentityHint(TlsContext *context, const uint8_t *p,
61  size_t length, size_t *consumed);
62 
63 error_t tlsParseServerKeyParams(TlsContext *context, const uint8_t *p,
64  size_t length, size_t *consumed);
65 
67  const TlsDigitalSignature *signature, size_t length,
68  const uint8_t *params, size_t paramsLen, size_t *consumed);
69 
71  const Tls12DigitalSignature *signature, size_t length,
72  const uint8_t *params, size_t paramsLen, size_t *consumed);
73 
76 
77 error_t tlsResumeSession(TlsContext *context, const uint8_t *sessionId,
78  size_t sessionIdLen, uint16_t cipherSuite);
79 
81 
82 //C++ guard
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
error_t tls12VerifyServerKeySignature(TlsContext *context, const Tls12DigitalSignature *signature, size_t length, const uint8_t *params, size_t paramsLen, size_t *consumed)
Verify server's key exchange parameters signature (TLS 1.2)
uint8_t extensions[]
Definition: ntp_common.h:207
bool_t tlsIsTicketValid(TlsContext *context)
Check whether a session ticket is valid.
int bool_t
Definition: compiler_port.h:53
uint8_t sessionId[]
Definition: tls.h:1773
uint16_t cipherSuite
Cipher suite identifier.
Definition: tls.h:1883
error_t tlsFormatClientKeyParams(TlsContext *context, uint8_t *p, size_t *written)
Format client's key exchange parameters.
TlsDigitalSignature
Definition: tls.h:1717
uint8_t p
Definition: ndp.h:300
uint8_t message[]
Definition: chap.h:154
error_t tlsSelectClientVersion(TlsContext *context, const TlsServerHello *message, const TlsHelloExtensions *extensions)
Version selection.
error_t tlsParsePskIdentityHint(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse PSK identity hint.
uint8_t sessionIdLen
Definition: tls.h:1772
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:43
error_t tlsFormatInitialClientHello(TlsContext *context)
Format initial ClientHello message.
Tls12DigitalSignature
Definition: tls.h:1729
uint8_t length
Definition: tcp.h:368
Hello extensions.
Definition: tls.h:2098
error_t tlsParseServerKeyParams(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse server's key exchange parameters.
error_t tlsFormatPskIdentity(TlsContext *context, uint8_t *p, size_t *written)
Format PSK identity.
TlsServerHello
Definition: tls.h:1787
error_t tlsResumeSession(TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, uint16_t cipherSuite)
Resume TLS session via session ID.
TLS (Transport Layer Security)
error_t tlsFormatCompressMethods(TlsContext *context, uint8_t *p, size_t *written)
Format the list of compression methods supported by the client.
error_t tlsVerifyServerKeySignature(TlsContext *context, const TlsDigitalSignature *signature, size_t length, const uint8_t *params, size_t paramsLen, size_t *consumed)
Verify server's key exchange parameters signature (TLS 1.0 and TLS 1.1)
error_t tlsFormatSessionId(TlsContext *context, uint8_t *p, size_t *written)
Format session ID.
error_t tlsFormatCipherSuites(TlsContext *context, uint8_t *p, size_t *written)
Format the list of cipher suites supported by the client.