tls_client_misc.c File Reference

Helper functions for TLS client. More...

#include <string.h>
#include "tls.h"
#include "tls_cipher_suites.h"
#include "tls_client.h"
#include "tls_client_misc.h"
#include "tls_common.h"
#include "tls_extensions.h"
#include "tls_signature.h"
#include "tls_cache.h"
#include "tls_ffdhe.h"
#include "tls_record.h"
#include "tls_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

error_t tlsFormatInitialClientHello (TlsContext *context)
 Format initial ClientHello message. More...
 
error_t tlsFormatSessionId (TlsContext *context, uint8_t *p, size_t *written)
 Format session ID. More...
 
error_t tlsFormatCipherSuites (TlsContext *context, uint_t *cipherSuiteTypes, uint8_t *p, size_t *written)
 Format the list of cipher suites supported by the client. More...
 
error_t tlsFormatCompressMethods (TlsContext *context, uint8_t *p, size_t *written)
 Format the list of compression methods supported by the client. More...
 
error_t tlsFormatPskIdentity (TlsContext *context, uint8_t *p, size_t *written)
 Format PSK identity. More...
 
error_t tlsFormatClientKeyParams (TlsContext *context, uint8_t *p, size_t *written)
 Format client's key exchange parameters. More...
 
error_t tlsParsePskIdentityHint (TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
 Parse PSK identity hint. More...
 
error_t tlsParseServerKeyParams (TlsContext *context, const uint8_t *p, size_t length, size_t *consumed)
 Parse server's key exchange parameters. More...
 
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) More...
 
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) More...
 
error_t tlsSelectClientVersion (TlsContext *context, const TlsServerHello *message, const TlsHelloExtensions *extensions)
 Version selection. More...
 
error_t tlsResumeClientSession (TlsContext *context, const uint8_t *sessionId, size_t sessionIdLen, uint16_t cipherSuite, uint8_t compressMethod)
 Resume TLS session via session ID. More...
 

Detailed Description

Helper functions for TLS client.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file tls_client_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 30 of file tls_client_misc.c.

Function Documentation

◆ tls12VerifyServerKeySignature()

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)

Parameters
[in]contextPointer to the TLS context
[in]signaturePointer to the digital signature
[in]lengthNumber of bytes available in the input stream
[in]paramsPointer to the server's key exchange parameters
[in]paramsLenLength of the server's key exchange parameters
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 1024 of file tls_client_misc.c.

◆ tlsFormatCipherSuites()

error_t tlsFormatCipherSuites ( TlsContext context,
uint_t cipherSuiteTypes,
uint8_t *  p,
size_t *  written 
)

Format the list of cipher suites supported by the client.

Parameters
[in]contextPointer to the TLS context
[out]cipherSuiteTypesTypes of cipher suites proposed by the client
[in]pOutput stream where to write the list of cipher suites
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 154 of file tls_client_misc.c.

◆ tlsFormatClientKeyParams()

error_t tlsFormatClientKeyParams ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format client's key exchange parameters.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the client's key exchange parameters
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 364 of file tls_client_misc.c.

◆ tlsFormatCompressMethods()

error_t tlsFormatCompressMethods ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format the list of compression methods supported by the client.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the list of compression methods
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 290 of file tls_client_misc.c.

◆ tlsFormatInitialClientHello()

error_t tlsFormatInitialClientHello ( TlsContext context)

Format initial ClientHello message.

Parameters
[in]contextPointer to the TLS context
Returns
Error code

Definition at line 57 of file tls_client_misc.c.

◆ tlsFormatPskIdentity()

error_t tlsFormatPskIdentity ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format PSK identity.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write the PSK identity hint
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 319 of file tls_client_misc.c.

◆ tlsFormatSessionId()

error_t tlsFormatSessionId ( TlsContext context,
uint8_t *  p,
size_t *  written 
)

Format session ID.

Parameters
[in]contextPointer to the TLS context
[in]pOutput stream where to write session ID
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 101 of file tls_client_misc.c.

◆ tlsParsePskIdentityHint()

error_t tlsParsePskIdentityHint ( TlsContext context,
const uint8_t *  p,
size_t  length,
size_t *  consumed 
)

Parse PSK identity hint.

Parameters
[in]contextPointer to the TLS context
[in]pInput stream where to read the PSK identity hint
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 565 of file tls_client_misc.c.

◆ tlsParseServerKeyParams()

error_t tlsParseServerKeyParams ( TlsContext context,
const uint8_t *  p,
size_t  length,
size_t *  consumed 
)

Parse server's key exchange parameters.

Parameters
[in]contextPointer to the TLS context
[in]pInput stream where to read the server's key exchange parameters
[in]lengthNumber of bytes available in the input stream
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 616 of file tls_client_misc.c.

◆ tlsResumeClientSession()

error_t tlsResumeClientSession ( TlsContext context,
const uint8_t *  sessionId,
size_t  sessionIdLen,
uint16_t  cipherSuite,
uint8_t  compressMethod 
)

Resume TLS session via session ID.

Parameters
[in]contextPointer to the TLS context
[in]sessionIdPointer to the session ID provided by the server
[in]sessionIdLenLength of the session ID, in bytes
[in]cipherSuiteCipher suite selected by the server
[in]compressMethodCompression method selected by the server
Returns
Error code

Definition at line 1458 of file tls_client_misc.c.

◆ tlsSelectClientVersion()

error_t tlsSelectClientVersion ( TlsContext context,
const TlsServerHello message,
const TlsHelloExtensions extensions 
)

Version selection.

Parameters
[in]contextPointer to the TLS context
[in]messagePointer to the received ServerHello message
[in]extensionsServerHello extensions offered by the server
Returns
Error code

Definition at line 1292 of file tls_client_misc.c.

◆ tlsVerifyServerKeySignature()

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)

Parameters
[in]contextPointer to the TLS context
[in]signaturePointer to the digital signature
[in]lengthNumber of bytes available in the input stream
[in]paramsPointer to the server's key exchange parameters
[in]paramsLenLength of the server's key exchange parameters
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 843 of file tls_client_misc.c.