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 /* _nxe_secure_dtls_server_protocol_version_override PORTABLE C */ 34 /* 6.1 */ 35 /* AUTHOR */ 36 /* */ 37 /* Timothy Stapko, Microsoft Corporation */ 38 /* */ 39 /* DESCRIPTION */ 40 /* */ 41 /* This function checks for errors in DTLS server protocol version */ 42 /* override call. */ 43 /* */ 44 /* INPUT */ 45 /* */ 46 /* dtls_server Pointer to DTLS server */ 47 /* protocol_version Version of DTLS to use */ 48 /* */ 49 /* OUTPUT */ 50 /* */ 51 /* status Completion status */ 52 /* */ 53 /* CALLS */ 54 /* */ 55 /* _nx_secure_dtls_server_protocol_version_override */ 56 /* Override DTLS protocol version*/ 57 /* */ 58 /* CALLED BY */ 59 /* */ 60 /* Application Code */ 61 /* */ 62 /* RELEASE HISTORY */ 63 /* */ 64 /* DATE NAME DESCRIPTION */ 65 /* */ 66 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 67 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 68 /* resulting in version 6.1 */ 69 /* */ 70 /**************************************************************************/ _nxe_secure_dtls_server_protocol_version_override(NX_SECURE_DTLS_SERVER * dtls_server,USHORT protocol_version)71UINT _nxe_secure_dtls_server_protocol_version_override(NX_SECURE_DTLS_SERVER *dtls_server, 72 USHORT protocol_version) 73 { 74 #ifdef NX_SECURE_ENABLE_DTLS 75 UINT status; 76 77 /* Check pointers. */ 78 if(dtls_server == NX_NULL) 79 { 80 return(NX_PTR_ERROR); 81 } 82 83 /* Make sure the version supplied is known and supported. */ 84 switch (protocol_version) 85 { 86 /* Supported DTLS versions. */ 87 case NX_SECURE_DTLS_VERSION_1_0: 88 case NX_SECURE_DTLS_VERSION_1_2: 89 break; 90 default: 91 return(NX_PTR_ERROR); 92 } 93 94 status = _nx_secure_dtls_server_protocol_version_override(dtls_server, protocol_version); 95 96 /* Return completion status. */ 97 return(status); 98 #else 99 NX_PARAMETER_NOT_USED(dtls_server); 100 NX_PARAMETER_NOT_USED(protocol_version); 101 102 return(NX_NOT_SUPPORTED); 103 #endif 104 } 105 106