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