1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Secure Component                                                 */
17 /**                                                                       */
18 /**    Transport Layer Security (TLS)                                     */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 /* Locate TLS data in this file.  */
24 
25 #define NX_SECURE_TLS_INIT
26 #define NX_SECURE_SYSTEM_INIT
27 #define NX_SECURE_SOURCE_CODE
28 
29 #include "nx_secure_tls.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _nx_secure_tls_initialize                           PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Timothy Stapko, Microsoft Corporation                               */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function initializes the various control data structures for   */
44 /*    the TLS component.                                                  */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    None                                                                */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    None                                                                */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    tx_mutex_create                       Create TLS protection mutex   */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application Code                                                    */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
67 /*  09-30-2020     Timothy Stapko           Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
_nx_secure_tls_initialize(VOID)71 VOID _nx_secure_tls_initialize(VOID)
72 {
73 
74     /* Initialize the created TLS instance variables. */
75     _nx_secure_tls_created_ptr = NX_NULL;
76     _nx_secure_tls_created_count = 0;
77 
78     /* Create the internal TLS protection mutex. */
79     tx_mutex_create(&_nx_secure_tls_protection, "TLS mutex", TX_NO_INHERIT);
80 }
81 
82