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_server_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 server. 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_server Pointer to DTLS server */
49 /* protocol_version Version of DTLS to use */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* None */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* Application Code */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
68 /* 09-30-2020 Timothy Stapko Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_nx_secure_dtls_server_protocol_version_override(NX_SECURE_DTLS_SERVER * dtls_server,USHORT protocol_version)72 UINT _nx_secure_dtls_server_protocol_version_override(NX_SECURE_DTLS_SERVER *dtls_server,
73 USHORT protocol_version)
74 {
75 #ifdef NX_SECURE_ENABLE_DTLS
76
77 dtls_server -> nx_dtls_server_protocol_version_override = protocol_version;
78
79 /* Return completion status. */
80 return(NX_SUCCESS);
81 #else
82 NX_PARAMETER_NOT_USED(dtls_server);
83 NX_PARAMETER_NOT_USED(protocol_version);
84
85 return(NX_NOT_SUPPORTED);
86 #endif
87 }
88
89