1 /*******************************************************************************
2   Copyright (c) 2018-2020, Intel Corporation
3 
4   Redistribution and use in source and binary forms, with or without
5   modification, are permitted provided that the following conditions are met:
6 
7       * Redistributions of source code must retain the above copyright notice,
8         this list of conditions and the following disclaimer.
9       * Redistributions in binary form must reproduce the above copyright
10         notice, this list of conditions and the following disclaimer in the
11         documentation and/or other materials provided with the distribution.
12       * Neither the name of Intel Corporation nor the names of its contributors
13         may be used to endorse or promote products derived from this software
14         without specific prior written permission.
15 
16   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *******************************************************************************/
27 
28 #include <stdint.h>
29 #include "intel-ipsec-mb.h"
30 #include "gcm.h"
31 #include "noaesni.h"
32 
33 /**
34  * @brief Pre-processes GCM key data
35  *
36  * Prefills the gcm key data with key values for each round and
37  * the initial sub hash key for tag encoding
38  *
39  * @param key pointer to key data
40  * @param key_data GCM expanded key data
41  *
42  */
43 
aes_gcm_pre_128_sse(const void * key,struct gcm_key_data * key_data)44 void aes_gcm_pre_128_sse(const void *key, struct gcm_key_data *key_data)
45 {
46 #ifdef SAFE_PARAM
47         if (key == NULL || key_data == NULL)
48                 return;
49 #endif
50         aes_keyexp_128_enc_sse(key, key_data->expanded_keys);
51         aes_gcm_precomp_128_sse(key_data);
52 }
53 
aes_gcm_pre_128_sse_no_aesni(const void * key,struct gcm_key_data * key_data)54 void aes_gcm_pre_128_sse_no_aesni(const void *key,
55                                   struct gcm_key_data *key_data)
56 {
57 #ifdef SAFE_PARAM
58         if (key == NULL || key_data == NULL)
59                 return;
60 #endif
61         aes_keyexp_128_enc_sse_no_aesni(key, key_data->expanded_keys);
62         aes_gcm_precomp_128_sse_no_aesni(key_data);
63 }
64 
aes_gcm_pre_128_avx_gen2(const void * key,struct gcm_key_data * key_data)65 void aes_gcm_pre_128_avx_gen2(const void *key, struct gcm_key_data *key_data)
66 {
67 #ifdef SAFE_PARAM
68         if (key == NULL || key_data == NULL)
69                 return;
70 #endif
71         aes_keyexp_128_enc_avx(key, key_data->expanded_keys);
72         aes_gcm_precomp_128_avx_gen2(key_data);
73 }
74 
aes_gcm_pre_128_avx_gen4(const void * key,struct gcm_key_data * key_data)75 void aes_gcm_pre_128_avx_gen4(const void *key, struct gcm_key_data *key_data)
76 {
77 #ifdef SAFE_PARAM
78         if (key == NULL || key_data == NULL)
79                 return;
80 #endif
81         aes_keyexp_128_enc_avx2(key, key_data->expanded_keys);
82         aes_gcm_precomp_128_avx_gen4(key_data);
83 }
84 
aes_gcm_pre_128_avx512(const void * key,struct gcm_key_data * key_data)85 void aes_gcm_pre_128_avx512(const void *key, struct gcm_key_data *key_data)
86 {
87 #ifdef SAFE_PARAM
88         if (key == NULL || key_data == NULL)
89                 return;
90 #endif
91         aes_keyexp_128_enc_avx2(key, key_data->expanded_keys);
92         aes_gcm_precomp_128_avx512(key_data);
93 }
94 
aes_gcm_pre_128_vaes_avx512(const void * key,struct gcm_key_data * key_data)95 void aes_gcm_pre_128_vaes_avx512(const void *key, struct gcm_key_data *key_data)
96 {
97 #ifdef SAFE_PARAM
98         if (key == NULL || key_data == NULL)
99                 return;
100 #endif
101         aes_keyexp_128_enc_avx2(key, key_data->expanded_keys);
102         aes_gcm_precomp_128_vaes_avx512(key_data);
103 }
104 
aes_gcm_pre_192_sse(const void * key,struct gcm_key_data * key_data)105 void aes_gcm_pre_192_sse(const void *key, struct gcm_key_data *key_data)
106 {
107 #ifdef SAFE_PARAM
108         if (key == NULL || key_data == NULL)
109                 return;
110 #endif
111         aes_keyexp_192_enc_sse(key, key_data->expanded_keys);
112         aes_gcm_precomp_192_sse(key_data);
113 }
114 
aes_gcm_pre_192_sse_no_aesni(const void * key,struct gcm_key_data * key_data)115 void aes_gcm_pre_192_sse_no_aesni(const void *key,
116                                   struct gcm_key_data *key_data)
117 {
118 #ifdef SAFE_PARAM
119         if (key == NULL || key_data == NULL)
120                 return;
121 #endif
122         aes_keyexp_192_enc_sse_no_aesni(key, key_data->expanded_keys);
123         aes_gcm_precomp_192_sse_no_aesni(key_data);
124 }
125 
aes_gcm_pre_192_avx_gen2(const void * key,struct gcm_key_data * key_data)126 void aes_gcm_pre_192_avx_gen2(const void *key, struct gcm_key_data *key_data)
127 {
128 #ifdef SAFE_PARAM
129         if (key == NULL || key_data == NULL)
130                 return;
131 #endif
132         aes_keyexp_192_enc_avx(key, key_data->expanded_keys);
133         aes_gcm_precomp_192_avx_gen2(key_data);
134 }
135 
aes_gcm_pre_192_avx_gen4(const void * key,struct gcm_key_data * key_data)136 void aes_gcm_pre_192_avx_gen4(const void *key, struct gcm_key_data *key_data)
137 {
138 #ifdef SAFE_PARAM
139         if (key == NULL || key_data == NULL)
140                 return;
141 #endif
142         aes_keyexp_192_enc_avx2(key, key_data->expanded_keys);
143         aes_gcm_precomp_192_avx_gen4(key_data);
144 }
145 
aes_gcm_pre_192_avx512(const void * key,struct gcm_key_data * key_data)146 void aes_gcm_pre_192_avx512(const void *key, struct gcm_key_data *key_data)
147 {
148 #ifdef SAFE_PARAM
149         if (key == NULL || key_data == NULL)
150                 return;
151 #endif
152         aes_keyexp_192_enc_avx2(key, key_data->expanded_keys);
153         aes_gcm_precomp_192_avx512(key_data);
154 }
155 
aes_gcm_pre_192_vaes_avx512(const void * key,struct gcm_key_data * key_data)156 void aes_gcm_pre_192_vaes_avx512(const void *key, struct gcm_key_data *key_data)
157 {
158 #ifdef SAFE_PARAM
159         if (key == NULL || key_data == NULL)
160                 return;
161 #endif
162         aes_keyexp_192_enc_avx2(key, key_data->expanded_keys);
163         aes_gcm_precomp_192_vaes_avx512(key_data);
164 }
165 
aes_gcm_pre_256_sse(const void * key,struct gcm_key_data * key_data)166 void aes_gcm_pre_256_sse(const void *key, struct gcm_key_data *key_data)
167 {
168 #ifdef SAFE_PARAM
169         if (key == NULL || key_data == NULL)
170                 return;
171 #endif
172         aes_keyexp_256_enc_sse(key, key_data->expanded_keys);
173         aes_gcm_precomp_256_sse(key_data);
174 }
175 
aes_gcm_pre_256_sse_no_aesni(const void * key,struct gcm_key_data * key_data)176 void aes_gcm_pre_256_sse_no_aesni(const void *key,
177                                   struct gcm_key_data *key_data)
178 {
179 #ifdef SAFE_PARAM
180         if (key == NULL || key_data == NULL)
181                 return;
182 #endif
183         aes_keyexp_256_enc_sse_no_aesni(key, key_data->expanded_keys);
184         aes_gcm_precomp_256_sse_no_aesni(key_data);
185 }
186 
aes_gcm_pre_256_avx_gen2(const void * key,struct gcm_key_data * key_data)187 void aes_gcm_pre_256_avx_gen2(const void *key, struct gcm_key_data *key_data)
188 {
189 #ifdef SAFE_PARAM
190         if (key == NULL || key_data == NULL)
191                 return;
192 #endif
193         aes_keyexp_256_enc_avx(key, key_data->expanded_keys);
194         aes_gcm_precomp_256_avx_gen2(key_data);
195 }
196 
aes_gcm_pre_256_avx_gen4(const void * key,struct gcm_key_data * key_data)197 void aes_gcm_pre_256_avx_gen4(const void *key, struct gcm_key_data *key_data)
198 {
199 #ifdef SAFE_PARAM
200         if (key == NULL || key_data == NULL)
201                 return;
202 #endif
203         aes_keyexp_256_enc_avx2(key, key_data->expanded_keys);
204         aes_gcm_precomp_256_avx_gen4(key_data);
205 }
206 
aes_gcm_pre_256_avx512(const void * key,struct gcm_key_data * key_data)207 void aes_gcm_pre_256_avx512(const void *key, struct gcm_key_data *key_data)
208 {
209 #ifdef SAFE_PARAM
210         if (key == NULL || key_data == NULL)
211                 return;
212 #endif
213         aes_keyexp_256_enc_avx2(key, key_data->expanded_keys);
214         aes_gcm_precomp_256_avx512(key_data);
215 }
216 
aes_gcm_pre_256_vaes_avx512(const void * key,struct gcm_key_data * key_data)217 void aes_gcm_pre_256_vaes_avx512(const void *key, struct gcm_key_data *key_data)
218 {
219 #ifdef SAFE_PARAM
220         if (key == NULL || key_data == NULL)
221                 return;
222 #endif
223         aes_keyexp_256_enc_avx2(key, key_data->expanded_keys);
224         aes_gcm_precomp_256_vaes_avx512(key_data);
225 }
226 
227 void
imb_aes_gmac_init_128_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)228 imb_aes_gmac_init_128_sse(const struct gcm_key_data *key_data,
229                           struct gcm_context_data *context_data,
230                           const uint8_t *iv,
231                           const uint64_t iv_len)
232 {
233         aes_gcm_init_var_iv_128_sse(key_data, context_data, iv,
234                                     iv_len, NULL, 0);
235 }
236 
237 void
imb_aes_gmac_init_192_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)238 imb_aes_gmac_init_192_sse(const struct gcm_key_data *key_data,
239                           struct gcm_context_data *context_data,
240                           const uint8_t *iv,
241                           const uint64_t iv_len)
242 {
243         aes_gcm_init_var_iv_192_sse(key_data, context_data, iv,
244                                     iv_len, NULL, 0);
245 }
246 
247 void
imb_aes_gmac_init_256_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)248 imb_aes_gmac_init_256_sse(const struct gcm_key_data *key_data,
249                           struct gcm_context_data *context_data,
250                           const uint8_t *iv,
251                           const uint64_t iv_len)
252 {
253         aes_gcm_init_var_iv_256_sse(key_data, context_data, iv,
254                                     iv_len, NULL, 0);
255 }
256 
257 void
imb_aes_gmac_finalize_128_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)258 imb_aes_gmac_finalize_128_sse(const struct gcm_key_data *key_data,
259                               struct gcm_context_data *context_data,
260                               uint8_t *auth_tag,
261                               const uint64_t  auth_tag_len)
262 {
263         aes_gcm_enc_128_finalize_sse(key_data, context_data, auth_tag,
264                                      auth_tag_len);
265 }
266 
267 void
imb_aes_gmac_finalize_192_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)268 imb_aes_gmac_finalize_192_sse(const struct gcm_key_data *key_data,
269                               struct gcm_context_data *context_data,
270                               uint8_t *auth_tag,
271                               const uint64_t  auth_tag_len)
272 {
273         aes_gcm_enc_192_finalize_sse(key_data, context_data, auth_tag,
274                                      auth_tag_len);
275 }
276 
277 void
imb_aes_gmac_finalize_256_sse(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)278 imb_aes_gmac_finalize_256_sse(const struct gcm_key_data *key_data,
279                               struct gcm_context_data *context_data,
280                               uint8_t *auth_tag,
281                               const uint64_t  auth_tag_len)
282 {
283         aes_gcm_enc_256_finalize_sse(key_data, context_data, auth_tag,
284                                      auth_tag_len);
285 }
286 
287 void
imb_aes_gmac_init_128_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)288 imb_aes_gmac_init_128_avx_gen2(const struct gcm_key_data *key_data,
289                                struct gcm_context_data *context_data,
290                                const uint8_t *iv,
291                                const uint64_t iv_len)
292 {
293         aes_gcm_init_var_iv_128_avx_gen2(key_data, context_data, iv,
294                                          iv_len, NULL, 0);
295 }
296 
297 void
imb_aes_gmac_init_192_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)298 imb_aes_gmac_init_192_avx_gen2(const struct gcm_key_data *key_data,
299                                struct gcm_context_data *context_data,
300                                const uint8_t *iv,
301                                const uint64_t iv_len)
302 {
303         aes_gcm_init_var_iv_192_avx_gen2(key_data, context_data, iv,
304                                          iv_len, NULL, 0);
305 }
306 
307 void
imb_aes_gmac_init_256_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)308 imb_aes_gmac_init_256_avx_gen2(const struct gcm_key_data *key_data,
309                                struct gcm_context_data *context_data,
310                                const uint8_t *iv,
311                                const uint64_t iv_len)
312 {
313         aes_gcm_init_var_iv_256_avx_gen2(key_data, context_data, iv,
314                                          iv_len, NULL, 0);
315 }
316 
317 void
imb_aes_gmac_finalize_128_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)318 imb_aes_gmac_finalize_128_avx_gen2(const struct gcm_key_data *key_data,
319                                    struct gcm_context_data *context_data,
320                                    uint8_t *auth_tag,
321                                    const uint64_t  auth_tag_len)
322 {
323         aes_gcm_enc_128_finalize_avx_gen2(key_data, context_data, auth_tag,
324                                           auth_tag_len);
325 }
326 
327 void
imb_aes_gmac_finalize_192_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)328 imb_aes_gmac_finalize_192_avx_gen2(const struct gcm_key_data *key_data,
329                                    struct gcm_context_data *context_data,
330                                    uint8_t *auth_tag,
331                                    const uint64_t  auth_tag_len)
332 {
333         aes_gcm_enc_192_finalize_avx_gen2(key_data, context_data, auth_tag,
334                                           auth_tag_len);
335 }
336 
337 void
imb_aes_gmac_finalize_256_avx_gen2(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)338 imb_aes_gmac_finalize_256_avx_gen2(const struct gcm_key_data *key_data,
339                                    struct gcm_context_data *context_data,
340                                    uint8_t *auth_tag,
341                                    const uint64_t  auth_tag_len)
342 {
343         aes_gcm_enc_256_finalize_avx_gen2(key_data, context_data, auth_tag,
344                                           auth_tag_len);
345 }
346 
347 void
imb_aes_gmac_init_128_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)348 imb_aes_gmac_init_128_sse_no_aesni(const struct gcm_key_data *key_data,
349                                    struct gcm_context_data *context_data,
350                                    const uint8_t *iv,
351                                    const uint64_t iv_len)
352 {
353         aes_gcm_init_var_iv_128_sse_no_aesni(key_data, context_data, iv,
354                                              iv_len, NULL, 0);
355 }
356 
357 void
imb_aes_gmac_init_192_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)358 imb_aes_gmac_init_192_sse_no_aesni(const struct gcm_key_data *key_data,
359                                    struct gcm_context_data *context_data,
360                                    const uint8_t *iv,
361                                    const uint64_t iv_len)
362 {
363         aes_gcm_init_var_iv_192_sse_no_aesni(key_data, context_data, iv,
364                                              iv_len, NULL, 0);
365 }
366 
367 void
imb_aes_gmac_init_256_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)368 imb_aes_gmac_init_256_sse_no_aesni(const struct gcm_key_data *key_data,
369                                    struct gcm_context_data *context_data,
370                                    const uint8_t *iv,
371                                    const uint64_t iv_len)
372 {
373         aes_gcm_init_var_iv_256_sse_no_aesni(key_data, context_data, iv,
374                                              iv_len, NULL, 0);
375 }
376 
377 void
imb_aes_gmac_finalize_128_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)378 imb_aes_gmac_finalize_128_sse_no_aesni(const struct gcm_key_data *key_data,
379                                        struct gcm_context_data *context_data,
380                                        uint8_t *auth_tag,
381                                        const uint64_t auth_tag_len)
382 {
383         aes_gcm_enc_128_finalize_sse_no_aesni(key_data, context_data, auth_tag,
384                                               auth_tag_len);
385 }
386 
387 void
imb_aes_gmac_finalize_192_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)388 imb_aes_gmac_finalize_192_sse_no_aesni(const struct gcm_key_data *key_data,
389                                        struct gcm_context_data *context_data,
390                                        uint8_t *auth_tag,
391                                        const uint64_t auth_tag_len)
392 {
393         aes_gcm_enc_192_finalize_sse_no_aesni(key_data, context_data, auth_tag,
394                                               auth_tag_len);
395 }
396 
397 void
imb_aes_gmac_finalize_256_sse_no_aesni(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)398 imb_aes_gmac_finalize_256_sse_no_aesni(const struct gcm_key_data *key_data,
399                                        struct gcm_context_data *context_data,
400                                        uint8_t *auth_tag,
401                                        const uint64_t  auth_tag_len)
402 {
403         aes_gcm_enc_256_finalize_sse_no_aesni(key_data, context_data, auth_tag,
404                                               auth_tag_len);
405 }
406 
407 void
imb_aes_gmac_init_128_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)408 imb_aes_gmac_init_128_avx_gen4(const struct gcm_key_data *key_data,
409                                struct gcm_context_data *context_data,
410                                const uint8_t *iv,
411                                const uint64_t iv_len)
412 {
413         aes_gcm_init_var_iv_128_avx_gen4(key_data, context_data, iv,
414                                          iv_len, NULL, 0);
415 }
416 
417 void
imb_aes_gmac_init_192_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)418 imb_aes_gmac_init_192_avx_gen4(const struct gcm_key_data *key_data,
419                                struct gcm_context_data *context_data,
420                                const uint8_t *iv,
421                                const uint64_t iv_len)
422 {
423         aes_gcm_init_var_iv_192_avx_gen4(key_data, context_data, iv,
424                                          iv_len, NULL, 0);
425 }
426 
427 void
imb_aes_gmac_init_256_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)428 imb_aes_gmac_init_256_avx_gen4(const struct gcm_key_data *key_data,
429                                struct gcm_context_data *context_data,
430                                const uint8_t *iv,
431                                const uint64_t iv_len)
432 {
433         aes_gcm_init_var_iv_256_avx_gen4(key_data, context_data, iv,
434                                          iv_len, NULL, 0);
435 }
436 
437 void
imb_aes_gmac_finalize_128_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)438 imb_aes_gmac_finalize_128_avx_gen4(const struct gcm_key_data *key_data,
439                                    struct gcm_context_data *context_data,
440                                    uint8_t *auth_tag,
441                                    const uint64_t  auth_tag_len)
442 {
443         aes_gcm_enc_128_finalize_avx_gen4(key_data, context_data, auth_tag,
444                                           auth_tag_len);
445 }
446 
447 void
imb_aes_gmac_finalize_192_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)448 imb_aes_gmac_finalize_192_avx_gen4(const struct gcm_key_data *key_data,
449                                    struct gcm_context_data *context_data,
450                                    uint8_t *auth_tag,
451                                    const uint64_t  auth_tag_len)
452 {
453         aes_gcm_enc_192_finalize_avx_gen4(key_data, context_data, auth_tag,
454                                           auth_tag_len);
455 }
456 
457 void
imb_aes_gmac_finalize_256_avx_gen4(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)458 imb_aes_gmac_finalize_256_avx_gen4(const struct gcm_key_data *key_data,
459                                    struct gcm_context_data *context_data,
460                                    uint8_t *auth_tag,
461                                    const uint64_t  auth_tag_len)
462 {
463         aes_gcm_enc_256_finalize_avx_gen4(key_data, context_data, auth_tag,
464                                           auth_tag_len);
465 }
466 
467 void
imb_aes_gmac_init_128_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)468 imb_aes_gmac_init_128_avx512(const struct gcm_key_data *key_data,
469                              struct gcm_context_data *context_data,
470                              const uint8_t *iv,
471                              const uint64_t iv_len)
472 {
473         aes_gcm_init_var_iv_128_avx512(key_data, context_data, iv,
474                                        iv_len, NULL, 0);
475 }
476 
477 void
imb_aes_gmac_init_192_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)478 imb_aes_gmac_init_192_avx512(const struct gcm_key_data *key_data,
479                              struct gcm_context_data *context_data,
480                              const uint8_t *iv,
481                              const uint64_t iv_len)
482 {
483         aes_gcm_init_var_iv_192_avx512(key_data, context_data, iv,
484                                        iv_len, NULL, 0);
485 }
486 
487 void
imb_aes_gmac_init_256_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)488 imb_aes_gmac_init_256_avx512(const struct gcm_key_data *key_data,
489                              struct gcm_context_data *context_data,
490                              const uint8_t *iv,
491                              const uint64_t iv_len)
492 {
493         aes_gcm_init_var_iv_256_avx512(key_data, context_data, iv,
494                                        iv_len, NULL, 0);
495 }
496 
497 void
imb_aes_gmac_finalize_128_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)498 imb_aes_gmac_finalize_128_avx512(const struct gcm_key_data *key_data,
499                                  struct gcm_context_data *context_data,
500                                  uint8_t *auth_tag,
501                                  const uint64_t  auth_tag_len)
502 {
503         aes_gcm_enc_128_finalize_avx512(key_data, context_data, auth_tag,
504                                         auth_tag_len);
505 }
506 
507 void
imb_aes_gmac_finalize_192_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)508 imb_aes_gmac_finalize_192_avx512(const struct gcm_key_data *key_data,
509                                  struct gcm_context_data *context_data,
510                                  uint8_t *auth_tag,
511                                  const uint64_t  auth_tag_len)
512 {
513         aes_gcm_enc_192_finalize_avx512(key_data, context_data, auth_tag,
514                                         auth_tag_len);
515 }
516 
517 void
imb_aes_gmac_finalize_256_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)518 imb_aes_gmac_finalize_256_avx512(const struct gcm_key_data *key_data,
519                                  struct gcm_context_data *context_data,
520                                  uint8_t *auth_tag,
521                                  const uint64_t  auth_tag_len)
522 {
523         aes_gcm_enc_256_finalize_avx512(key_data, context_data, auth_tag,
524                                         auth_tag_len);
525 }
526 
527 void
imb_aes_gmac_init_128_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)528 imb_aes_gmac_init_128_vaes_avx512(const struct gcm_key_data *key_data,
529                                   struct gcm_context_data *context_data,
530                                   const uint8_t *iv,
531                                   const uint64_t iv_len)
532 {
533         aes_gcm_init_var_iv_128_vaes_avx512(key_data, context_data, iv,
534                                             iv_len, NULL, 0);
535 }
536 
537 void
imb_aes_gmac_init_192_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)538 imb_aes_gmac_init_192_vaes_avx512(const struct gcm_key_data *key_data,
539                                   struct gcm_context_data *context_data,
540                                   const uint8_t *iv,
541                                   const uint64_t iv_len)
542 {
543         aes_gcm_init_var_iv_192_vaes_avx512(key_data, context_data, iv,
544                                             iv_len, NULL, 0);
545 }
546 
547 void
imb_aes_gmac_init_256_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,const uint8_t * iv,const uint64_t iv_len)548 imb_aes_gmac_init_256_vaes_avx512(const struct gcm_key_data *key_data,
549                                   struct gcm_context_data *context_data,
550                                   const uint8_t *iv,
551                                   const uint64_t iv_len)
552 {
553         aes_gcm_init_var_iv_256_vaes_avx512(key_data, context_data, iv,
554                                             iv_len, NULL, 0);
555 }
556 
557 void
imb_aes_gmac_finalize_128_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)558 imb_aes_gmac_finalize_128_vaes_avx512(const struct gcm_key_data *key_data,
559                                       struct gcm_context_data *context_data,
560                                       uint8_t *auth_tag,
561                                       const uint64_t  auth_tag_len)
562 {
563         aes_gcm_enc_128_finalize_vaes_avx512(key_data, context_data, auth_tag,
564                                              auth_tag_len);
565 }
566 
567 void
imb_aes_gmac_finalize_192_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)568 imb_aes_gmac_finalize_192_vaes_avx512(const struct gcm_key_data *key_data,
569                                       struct gcm_context_data *context_data,
570                                       uint8_t *auth_tag,
571                                       const uint64_t  auth_tag_len)
572 {
573         aes_gcm_enc_192_finalize_vaes_avx512(key_data, context_data, auth_tag,
574                                              auth_tag_len);
575 }
576 
577 void
imb_aes_gmac_finalize_256_vaes_avx512(const struct gcm_key_data * key_data,struct gcm_context_data * context_data,uint8_t * auth_tag,const uint64_t auth_tag_len)578 imb_aes_gmac_finalize_256_vaes_avx512(const struct gcm_key_data *key_data,
579                                       struct gcm_context_data *context_data,
580                                       uint8_t *auth_tag,
581                                       const uint64_t  auth_tag_len)
582 {
583         aes_gcm_enc_256_finalize_vaes_avx512(key_data, context_data, auth_tag,
584                                              auth_tag_len);
585 }
586