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 /** Transport Layer Security (TLS) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SECURE_SOURCE_CODE
23
24 #include "nx_secure_tls.h"
25
26 #ifdef NX_SECURE_ENABLE_ECC_CIPHERSUITE
27
28 #ifndef NX_SECURE_DISABLE_X509
29 /* Supported named curves. */
30 extern const USHORT *_nx_secure_x509_ecc_supported_groups;
31
32 /* Number of supported named curves. */
33 extern USHORT _nx_secure_x509_ecc_supported_groups_count;
34
35 /* Corresponding crypto methods for the supported named curve. */
36 extern const NX_CRYPTO_METHOD **_nx_secure_x509_ecc_curves;
37 #endif
38
39 /**************************************************************************/
40 /* */
41 /* FUNCTION RELEASE */
42 /* */
43 /* _nx_secure_tls_ecc_initialize PORTABLE C */
44 /* 6.1.6 */
45 /* AUTHOR */
46 /* */
47 /* Timothy Stapko, Microsoft Corporation */
48 /* */
49 /* DESCRIPTION */
50 /* */
51 /* This function initializes supported curve lists for TLS. */
52 /* */
53 /* INPUT */
54 /* */
55 /* tls_session TLS control block */
56 /* supported_groups List of supported groups */
57 /* supported_group_count Number of supported groups */
58 /* curves List of curve methods */
59 /* */
60 /* OUTPUT */
61 /* */
62 /* status Completion status */
63 /* */
64 /* CALLS */
65 /* */
66 /* None */
67 /* */
68 /* CALLED BY */
69 /* */
70 /* Application Code */
71 /* */
72 /* RELEASE HISTORY */
73 /* */
74 /* DATE NAME DESCRIPTION */
75 /* */
76 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
77 /* 09-30-2020 Timothy Stapko Modified comment(s), */
78 /* resulting in version 6.1 */
79 /* 04-02-2021 Timothy Stapko Modified comment(s), added */
80 /* ECC curve table in X509, */
81 /* resulting in version 6.1.6 */
82 /* */
83 /**************************************************************************/
_nx_secure_tls_ecc_initialize(NX_SECURE_TLS_SESSION * tls_session,const USHORT * supported_groups,USHORT supported_group_count,const NX_CRYPTO_METHOD ** curves)84 UINT _nx_secure_tls_ecc_initialize(NX_SECURE_TLS_SESSION *tls_session,
85 const USHORT *supported_groups, USHORT supported_group_count,
86 const NX_CRYPTO_METHOD **curves)
87 {
88
89 tls_session -> nx_secure_tls_ecc.nx_secure_tls_ecc_supported_groups = supported_groups;
90 tls_session -> nx_secure_tls_ecc.nx_secure_tls_ecc_supported_groups_count = supported_group_count;
91 tls_session -> nx_secure_tls_ecc.nx_secure_tls_ecc_curves = curves;
92
93 #ifndef NX_SECURE_DISABLE_X509
94 _nx_secure_x509_ecc_supported_groups = supported_groups;
95 _nx_secure_x509_ecc_supported_groups_count = supported_group_count;
96 _nx_secure_x509_ecc_curves = curves;
97 #endif
98
99 return(NX_SUCCESS);
100 }
101 #endif /* NX_SECURE_ENABLE_ECC_CIPHERSUITE */
102
103
104