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 #include "nx_secure_dtls.h"
25
26 /**************************************************************************/
27 /* */
28 /* FUNCTION RELEASE */
29 /* */
30 /* _nxe_secure_dtls_server_ecc_initialize PORTABLE C */
31 /* 6.1 */
32 /* AUTHOR */
33 /* */
34 /* Timothy Stapko, Microsoft Corporation */
35 /* */
36 /* DESCRIPTION */
37 /* */
38 /* This function checks for errors when initializing ECC for DTLS */
39 /* server instance. */
40 /* */
41 /* INPUT */
42 /* */
43 /* server_ptr DTLS server control block */
44 /* supported_groups List of supported groups */
45 /* supported_group_count Number of supported groups */
46 /* curves List of curve methods */
47 /* */
48 /* OUTPUT */
49 /* */
50 /* status Completion status */
51 /* */
52 /* CALLS */
53 /* */
54 /* _nx_secure_dtls_server_ecc_initialize Actual function call */
55 /* */
56 /* CALLED BY */
57 /* */
58 /* Application Code */
59 /* */
60 /* RELEASE HISTORY */
61 /* */
62 /* DATE NAME DESCRIPTION */
63 /* */
64 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
65 /* 09-30-2020 Timothy Stapko Modified comment(s), */
66 /* resulting in version 6.1 */
67 /* */
68 /**************************************************************************/
_nxe_secure_dtls_server_ecc_initialize(NX_SECURE_DTLS_SERVER * server_ptr,const USHORT * supported_groups,USHORT supported_group_count,const NX_CRYPTO_METHOD ** curves)69 UINT _nxe_secure_dtls_server_ecc_initialize(NX_SECURE_DTLS_SERVER *server_ptr,
70 const USHORT *supported_groups, USHORT supported_group_count,
71 const NX_CRYPTO_METHOD **curves)
72 {
73 #if defined(NX_SECURE_ENABLE_DTLS) && defined(NX_SECURE_ENABLE_ECC_CIPHERSUITE)
74 UINT status;
75
76 /* Check pointers. */
77 if (server_ptr == NX_NULL)
78 {
79 return(NX_PTR_ERROR);
80 }
81
82 if (supported_group_count > 0 &&
83 (supported_groups == NX_NULL || curves == NX_NULL))
84 {
85 return(NX_PTR_ERROR);
86 }
87
88 /* Call actual function. */
89 status = _nx_secure_dtls_server_ecc_initialize(server_ptr, supported_groups, supported_group_count, curves);
90
91 return(status);
92 #else
93 NX_PARAMETER_NOT_USED(server_ptr);
94 NX_PARAMETER_NOT_USED(supported_groups);
95 NX_PARAMETER_NOT_USED(supported_group_count);
96 NX_PARAMETER_NOT_USED(curves);
97
98 return(NX_NOT_SUPPORTED);
99 #endif /* NX_SECURE_ENABLE_DTLS && NX_SECURE_ENABLE_ECC_CIPHERSUITE */
100 }
101
102