Network Services API  1.11.00.10
Data Structures | Typedefs | Functions
TLS

Data Structures

struct  TLS_Params
 TLS instance paramaters. More...
 

Typedefs

typedef void * TLS_Handle
 

Functions

void TLS_Params_init (TLS_Params *params)
 Initialize the TLS Params structure to default values. More...
 
TLS_Handle TLS_create (TLS_Method method, TLS_Params *params, char *certDir)
 Allocate and initialize a new TLS context and return its handle. More...
 
void TLS_delete (TLS_Handle *tls)
 Destroy the TLS context instance and free the previously allocated instance object. More...
 

TLS Method

enum  TLS_Method {
  TLS_METHOD_CLIENT_TLSV1 = 1,
  TLS_METHOD_CLIENT_TLSV1_1,
  TLS_METHOD_CLIENT_TLSV1_2,
  TLS_METHOD_SERVER_TLSV1,
  TLS_METHOD_SERVER_TLSV1_1,
  TLS_METHOD_SERVER_TLSV1_2
}
 
typedef enum TLS_Method TLS_Method
 
typedef struct TLS_Params TLS_Params
 TLS instance paramaters. More...
 

Detailed Description

This module provides a simple interface to create and delete TLS contexts for TI-RTOS supported TLS layers (i.e. SimpleLink and WolfSSL). These contexts can be shared with supported networking protocols like HTTP, MQTT and other protocols which require TLS and are connecting to the same host server.

The certificates can be provided either as a buffer input or as a string containing the location of certificates on the file system. The file system based approach is supported only for TI-RTOS/SimpleLink and Linux/Sitara devices. When the file system location is provided, the certificates have to be specifically named as:

When multiple TLS context instances are created, it is suggested the file system location for the certificates be separate for each instance.

The certificates input should be in PEM format except for certificates that are flashed on SimpleLink devices which should in DER format. This module converts the input PEM certificates to DER format and stores them on flash (for SimpleLink devices) and loads them on buffers (for WolfSSL supported devices).

Typedef Documentation

typedef enum TLS_Method TLS_Method
typedef struct TLS_Params TLS_Params

TLS instance paramaters.

typedef void* TLS_Handle

Enumeration Type Documentation

enum TLS_Method
Enumerator
TLS_METHOD_CLIENT_TLSV1 

TLS v1 Client

TLS_METHOD_CLIENT_TLSV1_1 

TLS v1.1 Client

TLS_METHOD_CLIENT_TLSV1_2 

TLS v1.2 Client

TLS_METHOD_SERVER_TLSV1 

TLS v1 Server

TLS_METHOD_SERVER_TLSV1_1 

TLS v1.1 Server

TLS_METHOD_SERVER_TLSV1_2 

TLS v1.2 Server

Function Documentation

void TLS_Params_init ( TLS_Params params)

Initialize the TLS Params structure to default values.

Parameters
[in]paramsA pointer to the TLS_Params struct
TLS_Handle TLS_create ( TLS_Method  method,
TLS_Params params,
char *  certDir 
)

Allocate and initialize a new TLS context and return its handle.

This function takes in TLS_Method and either a structure of certificate/key buffers or the location of the certificates on file system. The buffers takes precedence over locations when both inputs are provided.

Remarks
This function is not thread safe. It is suggested to create all TLS contexts from a single thread/task or use locks around this functon in your application.
Parameters
[in]methodTLS version (see TLS_Method)
[in]paramsPointer to struct containing certificate/key buffers
[in]certDir(Optional) location of certificates on file system. The certificates/key have to be specifically named as:
  • "ca" for root CA certificates
  • "cert" for client/server certificates
  • "key" for client/server key
  • "dhkey" for Diffie-Hellman key
Returns
a TLS_Handle on success or NULL on failure
void TLS_delete ( TLS_Handle tls)

Destroy the TLS context instance and free the previously allocated instance object.

Parameters
[in]tlsPointer to the TLS context instance
Copyright 2016, Texas Instruments Incorporated