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 /** Datagram Transport Layer Security (DTLS) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 #define NX_SECURE_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "nx_secure_dtls.h" 28 29 /**************************************************************************/ 30 /* */ 31 /* FUNCTION RELEASE */ 32 /* */ 33 /* _nx_secure_dtls_client_protocol_version_override PORTABLE C */ 34 /* 6.1 */ 35 /* AUTHOR */ 36 /* */ 37 /* Timothy Stapko, Microsoft Corporation */ 38 /* */ 39 /* DESCRIPTION */ 40 /* */ 41 /* This function overrides the DTLS protocol version to use for the */ 42 /* DTLS session. This allows for a different version of DTLS to be */ 43 /* utilized even if a newer version is enabled. For example, to use */ 44 /* DTLSv1.0 for a specific host but use DTLSv1.2 for all other hosts. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* dtls_session Pointer to DTLS session */ 49 /* protocol_version Version of TLS to use */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* status Completion status */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _nx_secure_tls_session_protocol_version_override */ 58 /* Override TLS protocol version */ 59 /* */ 60 /* CALLED BY */ 61 /* */ 62 /* Application Code */ 63 /* */ 64 /* RELEASE HISTORY */ 65 /* */ 66 /* DATE NAME DESCRIPTION */ 67 /* */ 68 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 69 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 70 /* resulting in version 6.1 */ 71 /* */ 72 /**************************************************************************/ _nx_secure_dtls_client_protocol_version_override(NX_SECURE_DTLS_SESSION * dtls_session,USHORT protocol_version)73UINT _nx_secure_dtls_client_protocol_version_override(NX_SECURE_DTLS_SESSION *dtls_session, 74 USHORT protocol_version) 75 { 76 #ifdef NX_SECURE_ENABLE_DTLS 77 UINT status; 78 79 status = _nx_secure_tls_session_protocol_version_override(&(dtls_session -> nx_secure_dtls_tls_session), protocol_version); 80 81 /* Return completion status. */ 82 return(status); 83 #else 84 NX_PARAMETER_NOT_USED(dtls_session); 85 NX_PARAMETER_NOT_USED(protocol_version); 86 87 return(NX_NOT_SUPPORTED); 88 #endif 89 } 90 91