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 Crypto Component */
17 /** */
18 /** NULL Cipher */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #include "nx_crypto_null.h"
24
25 /**************************************************************************/
26 /* */
27 /* FUNCTION RELEASE */
28 /* */
29 /* _nx_crypto_method_null_init PORTABLE C */
30 /* 6.1 */
31 /* AUTHOR */
32 /* */
33 /* Timothy Stapko, Microsoft Corporation */
34 /* */
35 /* DESCRIPTION */
36 /* */
37 /* This function acts as a placeholder for TLS ciphersuites that do */
38 /* not use a ciper for a particular operation. For example, the PSK */
39 /* ciphersuite TLS_PSK_WITH_AES_128_CBC_SHA uses AES and SHA-1 but */
40 /* no public cipher (e.g. RSA). */
41 /* */
42 /* INPUT */
43 /* */
44 /* method Crypto Method Object */
45 /* key Key */
46 /* key_size_in_bits Size of the key, in bits */
47 /* handle Handle, specified by user */
48 /* crypto_metadata Metadata area */
49 /* crypto_metadata_size Size of the metadata area */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* None */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* None */
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_crypto_method_null_init(struct NX_CRYPTO_METHOD_STRUCT * method,UCHAR * key,NX_CRYPTO_KEY_SIZE key_size_in_bits,VOID ** handle,VOID * crypto_metadata,ULONG crypto_metadata_size)72 NX_CRYPTO_KEEP UINT _nx_crypto_method_null_init(struct NX_CRYPTO_METHOD_STRUCT *method,
73 UCHAR *key, NX_CRYPTO_KEY_SIZE key_size_in_bits,
74 VOID **handle,
75 VOID *crypto_metadata,
76 ULONG crypto_metadata_size)
77 {
78 NX_CRYPTO_PARAMETER_NOT_USED(method);
79 NX_CRYPTO_PARAMETER_NOT_USED(key);
80 NX_CRYPTO_PARAMETER_NOT_USED(key_size_in_bits);
81 NX_CRYPTO_PARAMETER_NOT_USED(handle);
82 NX_CRYPTO_PARAMETER_NOT_USED(crypto_metadata);
83 NX_CRYPTO_PARAMETER_NOT_USED(crypto_metadata_size);
84
85 return(NX_CRYPTO_SUCCESS);
86 }
87
88
89 /**************************************************************************/
90 /* */
91 /* FUNCTION RELEASE */
92 /* */
93 /* _nx_crypto_method_null_cleanup PORTABLE C */
94 /* 6.1 */
95 /* AUTHOR */
96 /* */
97 /* Timothy Stapko, Microsoft Corporation */
98 /* */
99 /* DESCRIPTION */
100 /* */
101 /* This function cleans up the crypto metadata. */
102 /* */
103 /* INPUT */
104 /* */
105 /* crypto_metadata Crypto metadata */
106 /* */
107 /* OUTPUT */
108 /* */
109 /* status Completion status */
110 /* */
111 /* CALLS */
112 /* */
113 /* None */
114 /* */
115 /* CALLED BY */
116 /* */
117 /* Application Code */
118 /* */
119 /* RELEASE HISTORY */
120 /* */
121 /* DATE NAME DESCRIPTION */
122 /* */
123 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
124 /* 09-30-2020 Timothy Stapko Modified comment(s), */
125 /* resulting in version 6.1 */
126 /* */
127 /**************************************************************************/
_nx_crypto_method_null_cleanup(VOID * crypto_metadata)128 NX_CRYPTO_KEEP UINT _nx_crypto_method_null_cleanup(VOID *crypto_metadata)
129 {
130 NX_CRYPTO_PARAMETER_NOT_USED(crypto_metadata);
131
132 return(NX_CRYPTO_SUCCESS);
133 }
134
135
136 /**************************************************************************/
137 /* */
138 /* FUNCTION RELEASE */
139 /* */
140 /* _nx_crypto_method_aes_operation PORTABLE C */
141 /* 6.1 */
142 /* AUTHOR */
143 /* */
144 /* Timothy Stapko, Microsoft Corporation */
145 /* */
146 /* DESCRIPTION */
147 /* */
148 /* This function encrypts and decrypts a message using */
149 /* the AES algorithm. */
150 /* */
151 /* INPUT */
152 /* */
153 /* op AES operation */
154 /* handle Crypto handle */
155 /* method Cryption Method Object */
156 /* key Encryption Key */
157 /* key_size_in_bits Key size in bits */
158 /* input Input data */
159 /* input_length_in_byte Input data size */
160 /* iv_ptr Initial vector */
161 /* output Output buffer */
162 /* output_length_in_byte Output buffer size */
163 /* crypto_metadata Metadata area */
164 /* crypto_metadata_size Metadata area size */
165 /* packet_ptr Pointer to packet */
166 /* nx_crypto_hw_process_callback Callback function pointer */
167 /* */
168 /* OUTPUT */
169 /* */
170 /* status Completion status */
171 /* */
172 /* CALLS */
173 /* */
174 /* None */
175 /* */
176 /* CALLED BY */
177 /* */
178 /* Application Code */
179 /* */
180 /* RELEASE HISTORY */
181 /* */
182 /* DATE NAME DESCRIPTION */
183 /* */
184 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */
185 /* 09-30-2020 Timothy Stapko Modified comment(s), */
186 /* resulting in version 6.1 */
187 /* */
188 /**************************************************************************/
_nx_crypto_method_null_operation(UINT op,VOID * handle,struct NX_CRYPTO_METHOD_STRUCT * method,UCHAR * key,NX_CRYPTO_KEY_SIZE key_size_in_bits,UCHAR * input,ULONG input_length_in_byte,UCHAR * iv_ptr,UCHAR * output,ULONG output_length_in_byte,VOID * crypto_metadata,ULONG crypto_metadata_size,VOID * packet_ptr,VOID (* nx_crypto_hw_process_callback)(VOID * packet_ptr,UINT status))189 NX_CRYPTO_KEEP UINT _nx_crypto_method_null_operation(UINT op, /* Encrypt, Decrypt, Authenticate */
190 VOID *handle, /* Crypto handler */
191 struct NX_CRYPTO_METHOD_STRUCT *method,
192 UCHAR *key,
193 NX_CRYPTO_KEY_SIZE key_size_in_bits,
194 UCHAR *input,
195 ULONG input_length_in_byte,
196 UCHAR *iv_ptr,
197 UCHAR *output,
198 ULONG output_length_in_byte,
199 VOID *crypto_metadata,
200 ULONG crypto_metadata_size,
201 VOID *packet_ptr,
202 VOID (*nx_crypto_hw_process_callback)(VOID *packet_ptr, UINT status))
203 {
204 NX_CRYPTO_PARAMETER_NOT_USED(op);
205 NX_CRYPTO_PARAMETER_NOT_USED(handle);
206 NX_CRYPTO_PARAMETER_NOT_USED(method);
207 NX_CRYPTO_PARAMETER_NOT_USED(key);
208 NX_CRYPTO_PARAMETER_NOT_USED(key_size_in_bits);
209 NX_CRYPTO_PARAMETER_NOT_USED(input);
210 NX_CRYPTO_PARAMETER_NOT_USED(input_length_in_byte);
211 NX_CRYPTO_PARAMETER_NOT_USED(iv_ptr);
212 NX_CRYPTO_PARAMETER_NOT_USED(output);
213 NX_CRYPTO_PARAMETER_NOT_USED(output_length_in_byte);
214 NX_CRYPTO_PARAMETER_NOT_USED(crypto_metadata);
215 NX_CRYPTO_PARAMETER_NOT_USED(crypto_metadata_size);
216 NX_CRYPTO_PARAMETER_NOT_USED(packet_ptr);
217 NX_CRYPTO_PARAMETER_NOT_USED(nx_crypto_hw_process_callback);
218
219 return(NX_CRYPTO_SUCCESS);
220 }
221
222