1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** NetX Secure Component */
16 /** */
17 /** Transport Layer Security (TLS) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SECURE_SOURCE_CODE
23
24
25 #include "nx_secure_tls.h"
26
27 /**************************************************************************/
28 /* */
29 /* FUNCTION RELEASE */
30 /* */
31 /* _nx_secure_tls_session_time_function_set PORTABLE C */
32 /* 6.1 */
33 /* AUTHOR */
34 /* */
35 /* Timothy Stapko, Microsoft Corporation */
36 /* */
37 /* DESCRIPTION */
38 /* */
39 /* This function sets up a function pointer that TLS will invoke when */
40 /* it needs to get the current time, which is used in various TLS */
41 /* handshake messages and for verification of certificates. */
42 /* */
43 /* The function is expected to return the current GMT in UNIX 32-bit */
44 /* format (seconds since the midnight starting Jan 1, 1970, UTC, */
45 /* ignoring leap seconds), as per the ClientHello requirements in the */
46 /* TLS RFC 5246. */
47 /* */
48 /* INPUT */
49 /* */
50 /* tls_session TLS control block */
51 /* time_func_ptr Pointer to time function */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* status Completion status */
56 /* */
57 /* CALLS */
58 /* */
59 /* None */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application Code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
70 /* 09-30-2020 Timothy Stapko Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* */
73 /**************************************************************************/
_nx_secure_tls_session_time_function_set(NX_SECURE_TLS_SESSION * tls_session,ULONG (* time_func_ptr)(void))74 UINT _nx_secure_tls_session_time_function_set(NX_SECURE_TLS_SESSION *tls_session,
75 ULONG (*time_func_ptr)(void))
76 {
77 /* Set the function pointer in the TLS session. */
78 tls_session -> nx_secure_tls_session_time_function = time_func_ptr;
79
80 return(NX_SUCCESS);
81 }
82
83