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 /* Bring in externs for caller checking code. */ 29 30 NX_SECURE_CALLER_CHECKING_EXTERNS 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _nxe_secure_tls_session_renegotiate_callback_set PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Timothy Stapko, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function checks for errors when setting the TLS session */ 45 /* re-negotiation callback function pointer. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* tls_session TLS control block */ 50 /* func_ptr Pointer to callback function */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* status Completion status */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* _nx_secure_tls_session_renegotiate_callback_set */ 59 /* Actual function pointer set */ 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 /* fixed renegotiation bug, */ 72 /* resulting in version 6.1 */ 73 /* */ 74 /**************************************************************************/ 75 #ifndef NX_SECURE_TLS_DISABLE_SECURE_RENEGOTIATION _nxe_secure_tls_session_renegotiate_callback_set(NX_SECURE_TLS_SESSION * tls_session,ULONG (* func_ptr)(NX_SECURE_TLS_SESSION * session))76UINT _nxe_secure_tls_session_renegotiate_callback_set(NX_SECURE_TLS_SESSION *tls_session, 77 ULONG (*func_ptr)(NX_SECURE_TLS_SESSION *session)) 78 { 79 UINT status; 80 81 82 if (tls_session == NX_NULL || func_ptr == NX_NULL) 83 { 84 return(NX_PTR_ERROR); 85 } 86 87 /* Make sure the session is initialized. */ 88 if(tls_session -> nx_secure_tls_id != NX_SECURE_TLS_ID) 89 { 90 return(NX_SECURE_TLS_SESSION_UNINITIALIZED); 91 } 92 93 /* Check for appropriate caller. */ 94 NX_THREADS_ONLY_CALLER_CHECKING 95 96 /* We want to be able to set the function to NX_NULL to disable it, so don't check for it. */ 97 status = _nx_secure_tls_session_renegotiate_callback_set(tls_session, func_ptr); 98 99 return(status); 100 } 101 #endif /* NX_SECURE_TLS_DISABLE_SECURE_RENEGOTIATION */ 102 103