Network Services API  1.11.00.10
tls.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef ti_net_TLS__include
33 #define ti_net_TLS__include
34 
35 #ifdef __cpluplus
36 extern "C" {
37 #endif
38 
70 #include <stdint.h>
71 
75 #define TLS_CERT_ROOT "/ti_net_tls"
76 #define TLS_CA_FILENAME "/ca.der"
77 #define TLS_CERT_FILENAME "/cert.der"
78 #define TLS_KEY_FILENAME "/key.der"
79 #define TLS_DHKEY_FILENAME "/dhkey.der"
80 #define TLS_CA_FILENAME_PEM "/ca.pem"
81 #define TLS_CERT_FILENAME_PEM "/cert.pem"
82 #define TLS_KEY_FILENAME_PEM "/key.pem"
83 #define TLS_DHKEY_FILENAME_PEM "/dhkey.pem"
84 
90 typedef enum TLS_Method {
97 } TLS_Method;
104 typedef struct TLS_Params {
105  uint8_t *ca;
106  uint32_t calen;
107  uint8_t *cert;
108  uint32_t certlen;
109  uint8_t *key;
110  uint32_t keylen;
111  uint8_t *dhkey;
112  uint32_t dhkeylen;
113 } TLS_Params;
116 typedef void *TLS_Handle;
117 
123 extern void TLS_Params_init(TLS_Params *params);
124 
125 /* This function is not thread safe */
150 extern TLS_Handle TLS_create(TLS_Method method, TLS_Params *params,
151  char *certDir);
152 
159 extern void TLS_delete(TLS_Handle *tls);
160 
162 #ifdef __cplusplus
163 }
164 #endif
165 #endif
uint32_t calen
Definition: tls.h:106
uint8_t * ca
Definition: tls.h:105
TLS_Method
Definition: tls.h:90
void TLS_Params_init(TLS_Params *params)
Initialize the TLS Params structure to default values.
Definition: tls.h:93
uint8_t * dhkey
Definition: tls.h:111
void * TLS_Handle
Definition: tls.h:116
Definition: tls.h:96
uint32_t certlen
Definition: tls.h:108
void TLS_delete(TLS_Handle *tls)
Destroy the TLS context instance and free the previously allocated instance object.
Definition: tls.h:91
Definition: tls.h:95
struct TLS_Params TLS_Params
TLS instance paramaters.
uint32_t keylen
Definition: tls.h:110
TLS_Handle TLS_create(TLS_Method method, TLS_Params *params, char *certDir)
Allocate and initialize a new TLS context and return its handle.
uint32_t dhkeylen
Definition: tls.h:112
TLS instance paramaters.
Definition: tls.h:104
Definition: tls.h:92
uint8_t * key
Definition: tls.h:109
uint8_t * cert
Definition: tls.h:107
Definition: tls.h:94
Copyright 2016, Texas Instruments Incorporated