/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * Copyright (c) 2025-present Eclipse ThreadX Contributors * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Secure Component */ /** */ /** Transport Layer Security (TLS) */ /** */ /**************************************************************************/ /**************************************************************************/ #define NX_SECURE_SOURCE_CODE #include "nx_secure_tls.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _nx_secure_tls_session_time_function_set PORTABLE C */ /* 6.4.3 */ /* AUTHOR */ /* */ /* Timothy Stapko, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function sets up a function pointer that TLS will invoke when */ /* it needs to get the current time, which is used in various TLS */ /* handshake messages and for verification of certificates. */ /* */ /* The function is expected to return the current GMT in UNIX 32-bit */ /* format (seconds since the midnight starting Jan 1, 1970, UTC, */ /* ignoring leap seconds), as per the ClientHello requirements in the */ /* TLS RFC 5246. */ /* */ /* INPUT */ /* */ /* tls_session TLS control block */ /* time_func_ptr Pointer to time function */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* */ /**************************************************************************/ UINT _nx_secure_tls_session_time_function_set(NX_SECURE_TLS_SESSION *tls_session, ULONG (*time_func_ptr)(void)) { /* Set the function pointer in the TLS session. */ tls_session -> nx_secure_tls_session_time_function = time_func_ptr; return(NX_SUCCESS); }