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  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneSSL Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _TLS_CLIENT_MISC_H
30 #define _TLS_CLIENT_MISC_H
31 
32 //Dependencies
33 #include "tls.h"
34 
35 //C++ guard
36 #ifdef __cplusplus
37  extern "C" {
38 #endif
39 
40 //TLS client specific functions
42 
43 error_t tlsFormatSessionId(TlsContext *context, uint8_t *p,
44  size_t *written);
45 
46 error_t tlsFormatCipherSuites(TlsContext *context, uint_t *cipherSuiteTypes,
47  uint8_t *p, size_t *written);
48 
49 error_t tlsFormatCompressMethods(TlsContext *context, uint8_t *p,
50  size_t *written);
51 
52 error_t tlsFormatPskIdentity(TlsContext *context, uint8_t *p,
53  size_t *written);
54 
55 error_t tlsFormatClientKeyParams(TlsContext *context, uint8_t *p,
56  size_t *written);
57 
58 error_t tlsParsePskIdentityHint(TlsContext *context, const uint8_t *p,
59  size_t length, size_t *consumed);
60 
61 error_t tlsParseServerKeyParams(TlsContext *context, const uint8_t *p,
62  size_t length, size_t *consumed);
63 
65  const TlsDigitalSignature *signature, size_t length,
66  const uint8_t *params, size_t paramsLen, size_t *consumed);
67 
69  const Tls12DigitalSignature *signature, size_t length,
70  const uint8_t *params, size_t paramsLen, size_t *consumed);
71 
74 
75 error_t tlsResumeClientSession(TlsContext *context, const uint8_t *sessionId,
76  size_t sessionIdLen, uint16_t cipherSuite, uint8_t compressMethod);
77 
78 //C++ guard
79 #ifdef __cplusplus
80  }
81 #endif
82 
83 #endif
TLS (Transport Layer Security)
error_t tlsFormatPskIdentity(TlsContext *context, uint8_t *p, size_t *written)
Format PSK identity.
error_t tlsResumeClientSession(TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, uint16_t cipherSuite, uint8_t compressMethod)
Resume TLS session via session ID.
uint8_t p
Definition: ndp.h:295
uint8_t sessionIdLen
Definition: tls.h:1609
uint8_t message[]
Definition: chap.h:150
error_t tlsParseServerKeyParams(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse server's key exchange parameters.
uint8_t sessionId[]
Definition: tls.h:1610
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 @86 TlsServerHello
ServerHello message.
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 tlsParsePskIdentityHint(TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
Parse PSK identity hint.
error_t tlsFormatCompressMethods(TlsContext *context, uint8_t *p, size_t *written)
Format the list of compression methods supported by the client.
uint8_t signature
Definition: tls.h:1364
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)
uint16_t cipherSuite
Cipher suite identifier.
Definition: tls13_misc.h:367
__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.
error_t
Error codes.
Definition: error.h:40
uint8_t extensions[]
Definition: tls13_misc.h:322
unsigned int uint_t
Definition: compiler_port.h:43
__start_packed struct @81 TlsDigitalSignature
Digitally-signed element (SSL 3.0, TLS 1.0 and TLS 1.1)
error_t tlsFormatInitialClientHello(TlsContext *context)
Format initial ClientHello message.
Hello extensions.
Definition: tls.h:1878
error_t tlsSelectClientVersion(TlsContext *context, const TlsServerHello *message, const TlsHelloExtensions *extensions)
Version selection.
error_t tlsFormatSessionId(TlsContext *context, uint8_t *p, size_t *written)
Format session ID.
uint8_t length
Definition: dtls_misc.h:140
#define TlsContext
Definition: tls.h:34