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 #define NX_SECURE_SOURCE_CODE
24
25
26 #include "nx_secure_tls.h"
27
28 /**************************************************************************/
29 /* */
30 /* FUNCTION RELEASE */
31 /* */
32 /* _nx_secure_tls_session_time_function_set PORTABLE C */
33 /* 6.1 */
34 /* AUTHOR */
35 /* */
36 /* Timothy Stapko, Microsoft Corporation */
37 /* */
38 /* DESCRIPTION */
39 /* */
40 /* This function sets up a function pointer that TLS will invoke when */
41 /* it needs to get the current time, which is used in various TLS */
42 /* handshake messages and for verification of certificates. */
43 /* */
44 /* The function is expected to return the current GMT in UNIX 32-bit */
45 /* format (seconds since the midnight starting Jan 1, 1970, UTC, */
46 /* ignoring leap seconds), as per the ClientHello requirements in the */
47 /* TLS RFC 5246. */
48 /* */
49 /* INPUT */
50 /* */
51 /* tls_session TLS control block */
52 /* time_func_ptr Pointer to time function */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* None */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* Application Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
71 /* 09-30-2020 Timothy Stapko Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_nx_secure_tls_session_time_function_set(NX_SECURE_TLS_SESSION * tls_session,ULONG (* time_func_ptr)(void))75 UINT _nx_secure_tls_session_time_function_set(NX_SECURE_TLS_SESSION *tls_session,
76 ULONG (*time_func_ptr)(void))
77 {
78 /* Set the function pointer in the TLS session. */
79 tls_session -> nx_secure_tls_session_time_function = time_func_ptr;
80
81 return(NX_SUCCESS);
82 }
83
84