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-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_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, uint_t *cipherSuiteTypes,
49  uint8_t *p, 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 tlsResumeClientSession(TlsContext *context, const uint8_t *sessionId,
78  size_t sessionIdLen, uint16_t cipherSuite);
79 
80 //C++ guard
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #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 length
Definition: dtls_misc.h:149
__start_packed struct @82 Tls12DigitalSignature
Digitally-signed element (TLS 1.2)
error_t tlsFormatClientKeyParams(TlsContext *context, uint8_t *p, size_t *written)
Format client's key exchange parameters.
uint8_t p
Definition: ndp.h:298
error_t tlsFormatCipherSuites(TlsContext *context, uint_t *cipherSuiteTypes, uint8_t *p, size_t *written)
Format the list of cipher suites supported by the client.
__start_packed struct @81 TlsDigitalSignature
Digitally-signed element (SSL 3.0, TLS 1.0 and TLS 1.1)
uint8_t signature
Definition: tls.h:1370
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:1615
#define TlsContext
Definition: tls.h:36
error_t
Error codes.
Definition: error.h:42
error_t tlsFormatInitialClientHello(TlsContext *context)
Format initial ClientHello message.
error_t tlsResumeClientSession(TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, uint16_t cipherSuite)
Resume TLS session via session ID.
Hello extensions.
Definition: tls.h:1894
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.
uint8_t extensions[]
Definition: tls13_misc.h:327
uint16_t cipherSuite
Cipher suite identifier.
Definition: tls13_misc.h:372
__start_packed struct @86 TlsServerHello
ServerHello message.
uint8_t sessionId[]
Definition: tls.h:1616
uint8_t message[]
Definition: chap.h:152
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.
unsigned int uint_t
Definition: compiler_port.h:45
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 (SSL 3.0, TLS 1.0 and TLS 1.1)
error_t tlsFormatSessionId(TlsContext *context, uint8_t *p, size_t *written)
Format session ID.