1 | # This file is generated from a similarly-named Perl script in the BoringSSL |
2 | # source tree. Do not edit by hand. |
3 | |
4 | #if defined(__has_feature) |
5 | #if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM) |
6 | #define OPENSSL_NO_ASM |
7 | #endif |
8 | #endif |
9 | |
10 | #if defined(__x86_64__) && !defined(OPENSSL_NO_ASM) |
11 | #if defined(BORINGSSL_PREFIX) |
12 | #include <boringssl_prefix_symbols_asm.h> |
13 | #endif |
14 | .data |
15 | |
16 | .align 16 |
17 | one: |
18 | .quad 1,0 |
19 | two: |
20 | .quad 2,0 |
21 | three: |
22 | .quad 3,0 |
23 | four: |
24 | .quad 4,0 |
25 | five: |
26 | .quad 5,0 |
27 | six: |
28 | .quad 6,0 |
29 | seven: |
30 | .quad 7,0 |
31 | eight: |
32 | .quad 8,0 |
33 | |
34 | OR_MASK: |
35 | .long 0x00000000,0x00000000,0x00000000,0x80000000 |
36 | poly: |
37 | .quad 0x1, 0xc200000000000000 |
38 | mask: |
39 | .long 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d |
40 | con1: |
41 | .long 1,1,1,1 |
42 | con2: |
43 | .long 0x1b,0x1b,0x1b,0x1b |
44 | con3: |
45 | .byte -1,-1,-1,-1,-1,-1,-1,-1,4,5,6,7,4,5,6,7 |
46 | and_mask: |
47 | .long 0,0xffffffff, 0xffffffff, 0xffffffff |
48 | .text |
49 | .type GFMUL,@function |
50 | .align 16 |
51 | GFMUL: |
52 | .cfi_startproc |
53 | vpclmulqdq $0x00,%xmm1,%xmm0,%xmm2 |
54 | vpclmulqdq $0x11,%xmm1,%xmm0,%xmm5 |
55 | vpclmulqdq $0x10,%xmm1,%xmm0,%xmm3 |
56 | vpclmulqdq $0x01,%xmm1,%xmm0,%xmm4 |
57 | vpxor %xmm4,%xmm3,%xmm3 |
58 | vpslldq $8,%xmm3,%xmm4 |
59 | vpsrldq $8,%xmm3,%xmm3 |
60 | vpxor %xmm4,%xmm2,%xmm2 |
61 | vpxor %xmm3,%xmm5,%xmm5 |
62 | |
63 | vpclmulqdq $0x10,poly(%rip),%xmm2,%xmm3 |
64 | vpshufd $78,%xmm2,%xmm4 |
65 | vpxor %xmm4,%xmm3,%xmm2 |
66 | |
67 | vpclmulqdq $0x10,poly(%rip),%xmm2,%xmm3 |
68 | vpshufd $78,%xmm2,%xmm4 |
69 | vpxor %xmm4,%xmm3,%xmm2 |
70 | |
71 | vpxor %xmm5,%xmm2,%xmm0 |
72 | .byte 0xf3,0xc3 |
73 | .cfi_endproc |
74 | .size GFMUL, .-GFMUL |
75 | .globl aesgcmsiv_htable_init |
76 | .hidden aesgcmsiv_htable_init |
77 | .type aesgcmsiv_htable_init,@function |
78 | .align 16 |
79 | aesgcmsiv_htable_init: |
80 | .cfi_startproc |
81 | vmovdqa (%rsi),%xmm0 |
82 | vmovdqa %xmm0,%xmm1 |
83 | vmovdqa %xmm0,(%rdi) |
84 | call GFMUL |
85 | vmovdqa %xmm0,16(%rdi) |
86 | call GFMUL |
87 | vmovdqa %xmm0,32(%rdi) |
88 | call GFMUL |
89 | vmovdqa %xmm0,48(%rdi) |
90 | call GFMUL |
91 | vmovdqa %xmm0,64(%rdi) |
92 | call GFMUL |
93 | vmovdqa %xmm0,80(%rdi) |
94 | call GFMUL |
95 | vmovdqa %xmm0,96(%rdi) |
96 | call GFMUL |
97 | vmovdqa %xmm0,112(%rdi) |
98 | .byte 0xf3,0xc3 |
99 | .cfi_endproc |
100 | .size aesgcmsiv_htable_init, .-aesgcmsiv_htable_init |
101 | .globl aesgcmsiv_htable6_init |
102 | .hidden aesgcmsiv_htable6_init |
103 | .type aesgcmsiv_htable6_init,@function |
104 | .align 16 |
105 | aesgcmsiv_htable6_init: |
106 | .cfi_startproc |
107 | vmovdqa (%rsi),%xmm0 |
108 | vmovdqa %xmm0,%xmm1 |
109 | vmovdqa %xmm0,(%rdi) |
110 | call GFMUL |
111 | vmovdqa %xmm0,16(%rdi) |
112 | call GFMUL |
113 | vmovdqa %xmm0,32(%rdi) |
114 | call GFMUL |
115 | vmovdqa %xmm0,48(%rdi) |
116 | call GFMUL |
117 | vmovdqa %xmm0,64(%rdi) |
118 | call GFMUL |
119 | vmovdqa %xmm0,80(%rdi) |
120 | .byte 0xf3,0xc3 |
121 | .cfi_endproc |
122 | .size aesgcmsiv_htable6_init, .-aesgcmsiv_htable6_init |
123 | .globl aesgcmsiv_htable_polyval |
124 | .hidden aesgcmsiv_htable_polyval |
125 | .type aesgcmsiv_htable_polyval,@function |
126 | .align 16 |
127 | aesgcmsiv_htable_polyval: |
128 | .cfi_startproc |
129 | testq %rdx,%rdx |
130 | jnz .Lhtable_polyval_start |
131 | .byte 0xf3,0xc3 |
132 | |
133 | .Lhtable_polyval_start: |
134 | vzeroall |
135 | |
136 | |
137 | |
138 | movq %rdx,%r11 |
139 | andq $127,%r11 |
140 | |
141 | jz .Lhtable_polyval_no_prefix |
142 | |
143 | vpxor %xmm9,%xmm9,%xmm9 |
144 | vmovdqa (%rcx),%xmm1 |
145 | subq %r11,%rdx |
146 | |
147 | subq $16,%r11 |
148 | |
149 | |
150 | vmovdqu (%rsi),%xmm0 |
151 | vpxor %xmm1,%xmm0,%xmm0 |
152 | |
153 | vpclmulqdq $0x01,(%rdi,%r11,1),%xmm0,%xmm5 |
154 | vpclmulqdq $0x00,(%rdi,%r11,1),%xmm0,%xmm3 |
155 | vpclmulqdq $0x11,(%rdi,%r11,1),%xmm0,%xmm4 |
156 | vpclmulqdq $0x10,(%rdi,%r11,1),%xmm0,%xmm6 |
157 | vpxor %xmm6,%xmm5,%xmm5 |
158 | |
159 | leaq 16(%rsi),%rsi |
160 | testq %r11,%r11 |
161 | jnz .Lhtable_polyval_prefix_loop |
162 | jmp .Lhtable_polyval_prefix_complete |
163 | |
164 | |
165 | .align 64 |
166 | .Lhtable_polyval_prefix_loop: |
167 | subq $16,%r11 |
168 | |
169 | vmovdqu (%rsi),%xmm0 |
170 | |
171 | vpclmulqdq $0x00,(%rdi,%r11,1),%xmm0,%xmm6 |
172 | vpxor %xmm6,%xmm3,%xmm3 |
173 | vpclmulqdq $0x11,(%rdi,%r11,1),%xmm0,%xmm6 |
174 | vpxor %xmm6,%xmm4,%xmm4 |
175 | vpclmulqdq $0x01,(%rdi,%r11,1),%xmm0,%xmm6 |
176 | vpxor %xmm6,%xmm5,%xmm5 |
177 | vpclmulqdq $0x10,(%rdi,%r11,1),%xmm0,%xmm6 |
178 | vpxor %xmm6,%xmm5,%xmm5 |
179 | |
180 | testq %r11,%r11 |
181 | |
182 | leaq 16(%rsi),%rsi |
183 | |
184 | jnz .Lhtable_polyval_prefix_loop |
185 | |
186 | .Lhtable_polyval_prefix_complete: |
187 | vpsrldq $8,%xmm5,%xmm6 |
188 | vpslldq $8,%xmm5,%xmm5 |
189 | |
190 | vpxor %xmm6,%xmm4,%xmm9 |
191 | vpxor %xmm5,%xmm3,%xmm1 |
192 | |
193 | jmp .Lhtable_polyval_main_loop |
194 | |
195 | .Lhtable_polyval_no_prefix: |
196 | |
197 | |
198 | |
199 | |
200 | vpxor %xmm1,%xmm1,%xmm1 |
201 | vmovdqa (%rcx),%xmm9 |
202 | |
203 | .align 64 |
204 | .Lhtable_polyval_main_loop: |
205 | subq $0x80,%rdx |
206 | jb .Lhtable_polyval_out |
207 | |
208 | vmovdqu 112(%rsi),%xmm0 |
209 | |
210 | vpclmulqdq $0x01,(%rdi),%xmm0,%xmm5 |
211 | vpclmulqdq $0x00,(%rdi),%xmm0,%xmm3 |
212 | vpclmulqdq $0x11,(%rdi),%xmm0,%xmm4 |
213 | vpclmulqdq $0x10,(%rdi),%xmm0,%xmm6 |
214 | vpxor %xmm6,%xmm5,%xmm5 |
215 | |
216 | |
217 | vmovdqu 96(%rsi),%xmm0 |
218 | vpclmulqdq $0x01,16(%rdi),%xmm0,%xmm6 |
219 | vpxor %xmm6,%xmm5,%xmm5 |
220 | vpclmulqdq $0x00,16(%rdi),%xmm0,%xmm6 |
221 | vpxor %xmm6,%xmm3,%xmm3 |
222 | vpclmulqdq $0x11,16(%rdi),%xmm0,%xmm6 |
223 | vpxor %xmm6,%xmm4,%xmm4 |
224 | vpclmulqdq $0x10,16(%rdi),%xmm0,%xmm6 |
225 | vpxor %xmm6,%xmm5,%xmm5 |
226 | |
227 | |
228 | |
229 | vmovdqu 80(%rsi),%xmm0 |
230 | |
231 | vpclmulqdq $0x10,poly(%rip),%xmm1,%xmm7 |
232 | vpalignr $8,%xmm1,%xmm1,%xmm1 |
233 | |
234 | vpclmulqdq $0x01,32(%rdi),%xmm0,%xmm6 |
235 | vpxor %xmm6,%xmm5,%xmm5 |
236 | vpclmulqdq $0x00,32(%rdi),%xmm0,%xmm6 |
237 | vpxor %xmm6,%xmm3,%xmm3 |
238 | vpclmulqdq $0x11,32(%rdi),%xmm0,%xmm6 |
239 | vpxor %xmm6,%xmm4,%xmm4 |
240 | vpclmulqdq $0x10,32(%rdi),%xmm0,%xmm6 |
241 | vpxor %xmm6,%xmm5,%xmm5 |
242 | |
243 | |
244 | vpxor %xmm7,%xmm1,%xmm1 |
245 | |
246 | vmovdqu 64(%rsi),%xmm0 |
247 | |
248 | vpclmulqdq $0x01,48(%rdi),%xmm0,%xmm6 |
249 | vpxor %xmm6,%xmm5,%xmm5 |
250 | vpclmulqdq $0x00,48(%rdi),%xmm0,%xmm6 |
251 | vpxor %xmm6,%xmm3,%xmm3 |
252 | vpclmulqdq $0x11,48(%rdi),%xmm0,%xmm6 |
253 | vpxor %xmm6,%xmm4,%xmm4 |
254 | vpclmulqdq $0x10,48(%rdi),%xmm0,%xmm6 |
255 | vpxor %xmm6,%xmm5,%xmm5 |
256 | |
257 | |
258 | vmovdqu 48(%rsi),%xmm0 |
259 | |
260 | vpclmulqdq $0x10,poly(%rip),%xmm1,%xmm7 |
261 | vpalignr $8,%xmm1,%xmm1,%xmm1 |
262 | |
263 | vpclmulqdq $0x01,64(%rdi),%xmm0,%xmm6 |
264 | vpxor %xmm6,%xmm5,%xmm5 |
265 | vpclmulqdq $0x00,64(%rdi),%xmm0,%xmm6 |
266 | vpxor %xmm6,%xmm3,%xmm3 |
267 | vpclmulqdq $0x11,64(%rdi),%xmm0,%xmm6 |
268 | vpxor %xmm6,%xmm4,%xmm4 |
269 | vpclmulqdq $0x10,64(%rdi),%xmm0,%xmm6 |
270 | vpxor %xmm6,%xmm5,%xmm5 |
271 | |
272 | |
273 | vpxor %xmm7,%xmm1,%xmm1 |
274 | |
275 | vmovdqu 32(%rsi),%xmm0 |
276 | |
277 | vpclmulqdq $0x01,80(%rdi),%xmm0,%xmm6 |
278 | vpxor %xmm6,%xmm5,%xmm5 |
279 | vpclmulqdq $0x00,80(%rdi),%xmm0,%xmm6 |
280 | vpxor %xmm6,%xmm3,%xmm3 |
281 | vpclmulqdq $0x11,80(%rdi),%xmm0,%xmm6 |
282 | vpxor %xmm6,%xmm4,%xmm4 |
283 | vpclmulqdq $0x10,80(%rdi),%xmm0,%xmm6 |
284 | vpxor %xmm6,%xmm5,%xmm5 |
285 | |
286 | |
287 | vpxor %xmm9,%xmm1,%xmm1 |
288 | |
289 | vmovdqu 16(%rsi),%xmm0 |
290 | |
291 | vpclmulqdq $0x01,96(%rdi),%xmm0,%xmm6 |
292 | vpxor %xmm6,%xmm5,%xmm5 |
293 | vpclmulqdq $0x00,96(%rdi),%xmm0,%xmm6 |
294 | vpxor %xmm6,%xmm3,%xmm3 |
295 | vpclmulqdq $0x11,96(%rdi),%xmm0,%xmm6 |
296 | vpxor %xmm6,%xmm4,%xmm4 |
297 | vpclmulqdq $0x10,96(%rdi),%xmm0,%xmm6 |
298 | vpxor %xmm6,%xmm5,%xmm5 |
299 | |
300 | |
301 | vmovdqu 0(%rsi),%xmm0 |
302 | vpxor %xmm1,%xmm0,%xmm0 |
303 | |
304 | vpclmulqdq $0x01,112(%rdi),%xmm0,%xmm6 |
305 | vpxor %xmm6,%xmm5,%xmm5 |
306 | vpclmulqdq $0x00,112(%rdi),%xmm0,%xmm6 |
307 | vpxor %xmm6,%xmm3,%xmm3 |
308 | vpclmulqdq $0x11,112(%rdi),%xmm0,%xmm6 |
309 | vpxor %xmm6,%xmm4,%xmm4 |
310 | vpclmulqdq $0x10,112(%rdi),%xmm0,%xmm6 |
311 | vpxor %xmm6,%xmm5,%xmm5 |
312 | |
313 | |
314 | vpsrldq $8,%xmm5,%xmm6 |
315 | vpslldq $8,%xmm5,%xmm5 |
316 | |
317 | vpxor %xmm6,%xmm4,%xmm9 |
318 | vpxor %xmm5,%xmm3,%xmm1 |
319 | |
320 | leaq 128(%rsi),%rsi |
321 | jmp .Lhtable_polyval_main_loop |
322 | |
323 | |
324 | |
325 | .Lhtable_polyval_out: |
326 | vpclmulqdq $0x10,poly(%rip),%xmm1,%xmm6 |
327 | vpalignr $8,%xmm1,%xmm1,%xmm1 |
328 | vpxor %xmm6,%xmm1,%xmm1 |
329 | |
330 | vpclmulqdq $0x10,poly(%rip),%xmm1,%xmm6 |
331 | vpalignr $8,%xmm1,%xmm1,%xmm1 |
332 | vpxor %xmm6,%xmm1,%xmm1 |
333 | vpxor %xmm9,%xmm1,%xmm1 |
334 | |
335 | vmovdqu %xmm1,(%rcx) |
336 | vzeroupper |
337 | .byte 0xf3,0xc3 |
338 | .cfi_endproc |
339 | .size aesgcmsiv_htable_polyval,.-aesgcmsiv_htable_polyval |
340 | .globl aesgcmsiv_polyval_horner |
341 | .hidden aesgcmsiv_polyval_horner |
342 | .type aesgcmsiv_polyval_horner,@function |
343 | .align 16 |
344 | aesgcmsiv_polyval_horner: |
345 | .cfi_startproc |
346 | testq %rcx,%rcx |
347 | jnz .Lpolyval_horner_start |
348 | .byte 0xf3,0xc3 |
349 | |
350 | .Lpolyval_horner_start: |
351 | |
352 | |
353 | |
354 | xorq %r10,%r10 |
355 | shlq $4,%rcx |
356 | |
357 | vmovdqa (%rsi),%xmm1 |
358 | vmovdqa (%rdi),%xmm0 |
359 | |
360 | .Lpolyval_horner_loop: |
361 | vpxor (%rdx,%r10,1),%xmm0,%xmm0 |
362 | call GFMUL |
363 | |
364 | addq $16,%r10 |
365 | cmpq %r10,%rcx |
366 | jne .Lpolyval_horner_loop |
367 | |
368 | |
369 | vmovdqa %xmm0,(%rdi) |
370 | .byte 0xf3,0xc3 |
371 | .cfi_endproc |
372 | .size aesgcmsiv_polyval_horner,.-aesgcmsiv_polyval_horner |
373 | .globl aes128gcmsiv_aes_ks |
374 | .hidden aes128gcmsiv_aes_ks |
375 | .type aes128gcmsiv_aes_ks,@function |
376 | .align 16 |
377 | aes128gcmsiv_aes_ks: |
378 | .cfi_startproc |
379 | vmovdqu (%rdi),%xmm1 |
380 | vmovdqa %xmm1,(%rsi) |
381 | |
382 | vmovdqa con1(%rip),%xmm0 |
383 | vmovdqa mask(%rip),%xmm15 |
384 | |
385 | movq $8,%rax |
386 | |
387 | .Lks128_loop: |
388 | addq $16,%rsi |
389 | subq $1,%rax |
390 | vpshufb %xmm15,%xmm1,%xmm2 |
391 | vaesenclast %xmm0,%xmm2,%xmm2 |
392 | vpslld $1,%xmm0,%xmm0 |
393 | vpslldq $4,%xmm1,%xmm3 |
394 | vpxor %xmm3,%xmm1,%xmm1 |
395 | vpslldq $4,%xmm3,%xmm3 |
396 | vpxor %xmm3,%xmm1,%xmm1 |
397 | vpslldq $4,%xmm3,%xmm3 |
398 | vpxor %xmm3,%xmm1,%xmm1 |
399 | vpxor %xmm2,%xmm1,%xmm1 |
400 | vmovdqa %xmm1,(%rsi) |
401 | jne .Lks128_loop |
402 | |
403 | vmovdqa con2(%rip),%xmm0 |
404 | vpshufb %xmm15,%xmm1,%xmm2 |
405 | vaesenclast %xmm0,%xmm2,%xmm2 |
406 | vpslld $1,%xmm0,%xmm0 |
407 | vpslldq $4,%xmm1,%xmm3 |
408 | vpxor %xmm3,%xmm1,%xmm1 |
409 | vpslldq $4,%xmm3,%xmm3 |
410 | vpxor %xmm3,%xmm1,%xmm1 |
411 | vpslldq $4,%xmm3,%xmm3 |
412 | vpxor %xmm3,%xmm1,%xmm1 |
413 | vpxor %xmm2,%xmm1,%xmm1 |
414 | vmovdqa %xmm1,16(%rsi) |
415 | |
416 | vpshufb %xmm15,%xmm1,%xmm2 |
417 | vaesenclast %xmm0,%xmm2,%xmm2 |
418 | vpslldq $4,%xmm1,%xmm3 |
419 | vpxor %xmm3,%xmm1,%xmm1 |
420 | vpslldq $4,%xmm3,%xmm3 |
421 | vpxor %xmm3,%xmm1,%xmm1 |
422 | vpslldq $4,%xmm3,%xmm3 |
423 | vpxor %xmm3,%xmm1,%xmm1 |
424 | vpxor %xmm2,%xmm1,%xmm1 |
425 | vmovdqa %xmm1,32(%rsi) |
426 | .byte 0xf3,0xc3 |
427 | .cfi_endproc |
428 | .size aes128gcmsiv_aes_ks,.-aes128gcmsiv_aes_ks |
429 | .globl aes256gcmsiv_aes_ks |
430 | .hidden aes256gcmsiv_aes_ks |
431 | .type aes256gcmsiv_aes_ks,@function |
432 | .align 16 |
433 | aes256gcmsiv_aes_ks: |
434 | .cfi_startproc |
435 | vmovdqu (%rdi),%xmm1 |
436 | vmovdqu 16(%rdi),%xmm3 |
437 | vmovdqa %xmm1,(%rsi) |
438 | vmovdqa %xmm3,16(%rsi) |
439 | vmovdqa con1(%rip),%xmm0 |
440 | vmovdqa mask(%rip),%xmm15 |
441 | vpxor %xmm14,%xmm14,%xmm14 |
442 | movq $6,%rax |
443 | |
444 | .Lks256_loop: |
445 | addq $32,%rsi |
446 | subq $1,%rax |
447 | vpshufb %xmm15,%xmm3,%xmm2 |
448 | vaesenclast %xmm0,%xmm2,%xmm2 |
449 | vpslld $1,%xmm0,%xmm0 |
450 | vpsllq $32,%xmm1,%xmm4 |
451 | vpxor %xmm4,%xmm1,%xmm1 |
452 | vpshufb con3(%rip),%xmm1,%xmm4 |
453 | vpxor %xmm4,%xmm1,%xmm1 |
454 | vpxor %xmm2,%xmm1,%xmm1 |
455 | vmovdqa %xmm1,(%rsi) |
456 | vpshufd $0xff,%xmm1,%xmm2 |
457 | vaesenclast %xmm14,%xmm2,%xmm2 |
458 | vpsllq $32,%xmm3,%xmm4 |
459 | vpxor %xmm4,%xmm3,%xmm3 |
460 | vpshufb con3(%rip),%xmm3,%xmm4 |
461 | vpxor %xmm4,%xmm3,%xmm3 |
462 | vpxor %xmm2,%xmm3,%xmm3 |
463 | vmovdqa %xmm3,16(%rsi) |
464 | jne .Lks256_loop |
465 | |
466 | vpshufb %xmm15,%xmm3,%xmm2 |
467 | vaesenclast %xmm0,%xmm2,%xmm2 |
468 | vpsllq $32,%xmm1,%xmm4 |
469 | vpxor %xmm4,%xmm1,%xmm1 |
470 | vpshufb con3(%rip),%xmm1,%xmm4 |
471 | vpxor %xmm4,%xmm1,%xmm1 |
472 | vpxor %xmm2,%xmm1,%xmm1 |
473 | vmovdqa %xmm1,32(%rsi) |
474 | .byte 0xf3,0xc3 |
475 | .cfi_endproc |
476 | .globl aes128gcmsiv_aes_ks_enc_x1 |
477 | .hidden aes128gcmsiv_aes_ks_enc_x1 |
478 | .type aes128gcmsiv_aes_ks_enc_x1,@function |
479 | .align 16 |
480 | aes128gcmsiv_aes_ks_enc_x1: |
481 | .cfi_startproc |
482 | vmovdqa (%rcx),%xmm1 |
483 | vmovdqa 0(%rdi),%xmm4 |
484 | |
485 | vmovdqa %xmm1,(%rdx) |
486 | vpxor %xmm1,%xmm4,%xmm4 |
487 | |
488 | vmovdqa con1(%rip),%xmm0 |
489 | vmovdqa mask(%rip),%xmm15 |
490 | |
491 | vpshufb %xmm15,%xmm1,%xmm2 |
492 | vaesenclast %xmm0,%xmm2,%xmm2 |
493 | vpslld $1,%xmm0,%xmm0 |
494 | vpsllq $32,%xmm1,%xmm3 |
495 | vpxor %xmm3,%xmm1,%xmm1 |
496 | vpshufb con3(%rip),%xmm1,%xmm3 |
497 | vpxor %xmm3,%xmm1,%xmm1 |
498 | vpxor %xmm2,%xmm1,%xmm1 |
499 | |
500 | vaesenc %xmm1,%xmm4,%xmm4 |
501 | vmovdqa %xmm1,16(%rdx) |
502 | |
503 | vpshufb %xmm15,%xmm1,%xmm2 |
504 | vaesenclast %xmm0,%xmm2,%xmm2 |
505 | vpslld $1,%xmm0,%xmm0 |
506 | vpsllq $32,%xmm1,%xmm3 |
507 | vpxor %xmm3,%xmm1,%xmm1 |
508 | vpshufb con3(%rip),%xmm1,%xmm3 |
509 | vpxor %xmm3,%xmm1,%xmm1 |
510 | vpxor %xmm2,%xmm1,%xmm1 |
511 | |
512 | vaesenc %xmm1,%xmm4,%xmm4 |
513 | vmovdqa %xmm1,32(%rdx) |
514 | |
515 | vpshufb %xmm15,%xmm1,%xmm2 |
516 | vaesenclast %xmm0,%xmm2,%xmm2 |
517 | vpslld $1,%xmm0,%xmm0 |
518 | vpsllq $32,%xmm1,%xmm3 |
519 | vpxor %xmm3,%xmm1,%xmm1 |
520 | vpshufb con3(%rip),%xmm1,%xmm3 |
521 | vpxor %xmm3,%xmm1,%xmm1 |
522 | vpxor %xmm2,%xmm1,%xmm1 |
523 | |
524 | vaesenc %xmm1,%xmm4,%xmm4 |
525 | vmovdqa %xmm1,48(%rdx) |
526 | |
527 | vpshufb %xmm15,%xmm1,%xmm2 |
528 | vaesenclast %xmm0,%xmm2,%xmm2 |
529 | vpslld $1,%xmm0,%xmm0 |
530 | vpsllq $32,%xmm1,%xmm3 |
531 | vpxor %xmm3,%xmm1,%xmm1 |
532 | vpshufb con3(%rip),%xmm1,%xmm3 |
533 | vpxor %xmm3,%xmm1,%xmm1 |
534 | vpxor %xmm2,%xmm1,%xmm1 |
535 | |
536 | vaesenc %xmm1,%xmm4,%xmm4 |
537 | vmovdqa %xmm1,64(%rdx) |
538 | |
539 | vpshufb %xmm15,%xmm1,%xmm2 |
540 | vaesenclast %xmm0,%xmm2,%xmm2 |
541 | vpslld $1,%xmm0,%xmm0 |
542 | vpsllq $32,%xmm1,%xmm3 |
543 | vpxor %xmm3,%xmm1,%xmm1 |
544 | vpshufb con3(%rip),%xmm1,%xmm3 |
545 | vpxor %xmm3,%xmm1,%xmm1 |
546 | vpxor %xmm2,%xmm1,%xmm1 |
547 | |
548 | vaesenc %xmm1,%xmm4,%xmm4 |
549 | vmovdqa %xmm1,80(%rdx) |
550 | |
551 | vpshufb %xmm15,%xmm1,%xmm2 |
552 | vaesenclast %xmm0,%xmm2,%xmm2 |
553 | vpslld $1,%xmm0,%xmm0 |
554 | vpsllq $32,%xmm1,%xmm3 |
555 | vpxor %xmm3,%xmm1,%xmm1 |
556 | vpshufb con3(%rip),%xmm1,%xmm3 |
557 | vpxor %xmm3,%xmm1,%xmm1 |
558 | vpxor %xmm2,%xmm1,%xmm1 |
559 | |
560 | vaesenc %xmm1,%xmm4,%xmm4 |
561 | vmovdqa %xmm1,96(%rdx) |
562 | |
563 | vpshufb %xmm15,%xmm1,%xmm2 |
564 | vaesenclast %xmm0,%xmm2,%xmm2 |
565 | vpslld $1,%xmm0,%xmm0 |
566 | vpsllq $32,%xmm1,%xmm3 |
567 | vpxor %xmm3,%xmm1,%xmm1 |
568 | vpshufb con3(%rip),%xmm1,%xmm3 |
569 | vpxor %xmm3,%xmm1,%xmm1 |
570 | vpxor %xmm2,%xmm1,%xmm1 |
571 | |
572 | vaesenc %xmm1,%xmm4,%xmm4 |
573 | vmovdqa %xmm1,112(%rdx) |
574 | |
575 | vpshufb %xmm15,%xmm1,%xmm2 |
576 | vaesenclast %xmm0,%xmm2,%xmm2 |
577 | vpslld $1,%xmm0,%xmm0 |
578 | vpsllq $32,%xmm1,%xmm3 |
579 | vpxor %xmm3,%xmm1,%xmm1 |
580 | vpshufb con3(%rip),%xmm1,%xmm3 |
581 | vpxor %xmm3,%xmm1,%xmm1 |
582 | vpxor %xmm2,%xmm1,%xmm1 |
583 | |
584 | vaesenc %xmm1,%xmm4,%xmm4 |
585 | vmovdqa %xmm1,128(%rdx) |
586 | |
587 | |
588 | vmovdqa con2(%rip),%xmm0 |
589 | |
590 | vpshufb %xmm15,%xmm1,%xmm2 |
591 | vaesenclast %xmm0,%xmm2,%xmm2 |
592 | vpslld $1,%xmm0,%xmm0 |
593 | vpsllq $32,%xmm1,%xmm3 |
594 | vpxor %xmm3,%xmm1,%xmm1 |
595 | vpshufb con3(%rip),%xmm1,%xmm3 |
596 | vpxor %xmm3,%xmm1,%xmm1 |
597 | vpxor %xmm2,%xmm1,%xmm1 |
598 | |
599 | vaesenc %xmm1,%xmm4,%xmm4 |
600 | vmovdqa %xmm1,144(%rdx) |
601 | |
602 | vpshufb %xmm15,%xmm1,%xmm2 |
603 | vaesenclast %xmm0,%xmm2,%xmm2 |
604 | vpsllq $32,%xmm1,%xmm3 |
605 | vpxor %xmm3,%xmm1,%xmm1 |
606 | vpshufb con3(%rip),%xmm1,%xmm3 |
607 | vpxor %xmm3,%xmm1,%xmm1 |
608 | vpxor %xmm2,%xmm1,%xmm1 |
609 | |
610 | vaesenclast %xmm1,%xmm4,%xmm4 |
611 | vmovdqa %xmm1,160(%rdx) |
612 | |
613 | |
614 | vmovdqa %xmm4,0(%rsi) |
615 | .byte 0xf3,0xc3 |
616 | .cfi_endproc |
617 | .size aes128gcmsiv_aes_ks_enc_x1,.-aes128gcmsiv_aes_ks_enc_x1 |
618 | .globl aes128gcmsiv_kdf |
619 | .hidden aes128gcmsiv_kdf |
620 | .type aes128gcmsiv_kdf,@function |
621 | .align 16 |
622 | aes128gcmsiv_kdf: |
623 | .cfi_startproc |
624 | |
625 | |
626 | |
627 | |
628 | vmovdqa (%rdx),%xmm1 |
629 | vmovdqa 0(%rdi),%xmm9 |
630 | vmovdqa and_mask(%rip),%xmm12 |
631 | vmovdqa one(%rip),%xmm13 |
632 | vpshufd $0x90,%xmm9,%xmm9 |
633 | vpand %xmm12,%xmm9,%xmm9 |
634 | vpaddd %xmm13,%xmm9,%xmm10 |
635 | vpaddd %xmm13,%xmm10,%xmm11 |
636 | vpaddd %xmm13,%xmm11,%xmm12 |
637 | |
638 | vpxor %xmm1,%xmm9,%xmm9 |
639 | vpxor %xmm1,%xmm10,%xmm10 |
640 | vpxor %xmm1,%xmm11,%xmm11 |
641 | vpxor %xmm1,%xmm12,%xmm12 |
642 | |
643 | vmovdqa 16(%rdx),%xmm1 |
644 | vaesenc %xmm1,%xmm9,%xmm9 |
645 | vaesenc %xmm1,%xmm10,%xmm10 |
646 | vaesenc %xmm1,%xmm11,%xmm11 |
647 | vaesenc %xmm1,%xmm12,%xmm12 |
648 | |
649 | vmovdqa 32(%rdx),%xmm2 |
650 | vaesenc %xmm2,%xmm9,%xmm9 |
651 | vaesenc %xmm2,%xmm10,%xmm10 |
652 | vaesenc %xmm2,%xmm11,%xmm11 |
653 | vaesenc %xmm2,%xmm12,%xmm12 |
654 | |
655 | vmovdqa 48(%rdx),%xmm1 |
656 | vaesenc %xmm1,%xmm9,%xmm9 |
657 | vaesenc %xmm1,%xmm10,%xmm10 |
658 | vaesenc %xmm1,%xmm11,%xmm11 |
659 | vaesenc %xmm1,%xmm12,%xmm12 |
660 | |
661 | vmovdqa 64(%rdx),%xmm2 |
662 | vaesenc %xmm2,%xmm9,%xmm9 |
663 | vaesenc %xmm2,%xmm10,%xmm10 |
664 | vaesenc %xmm2,%xmm11,%xmm11 |
665 | vaesenc %xmm2,%xmm12,%xmm12 |
666 | |
667 | vmovdqa 80(%rdx),%xmm1 |
668 | vaesenc %xmm1,%xmm9,%xmm9 |
669 | vaesenc %xmm1,%xmm10,%xmm10 |
670 | vaesenc %xmm1,%xmm11,%xmm11 |
671 | vaesenc %xmm1,%xmm12,%xmm12 |
672 | |
673 | vmovdqa 96(%rdx),%xmm2 |
674 | vaesenc %xmm2,%xmm9,%xmm9 |
675 | vaesenc %xmm2,%xmm10,%xmm10 |
676 | vaesenc %xmm2,%xmm11,%xmm11 |
677 | vaesenc %xmm2,%xmm12,%xmm12 |
678 | |
679 | vmovdqa 112(%rdx),%xmm1 |
680 | vaesenc %xmm1,%xmm9,%xmm9 |
681 | vaesenc %xmm1,%xmm10,%xmm10 |
682 | vaesenc %xmm1,%xmm11,%xmm11 |
683 | vaesenc %xmm1,%xmm12,%xmm12 |
684 | |
685 | vmovdqa 128(%rdx),%xmm2 |
686 | vaesenc %xmm2,%xmm9,%xmm9 |
687 | vaesenc %xmm2,%xmm10,%xmm10 |
688 | vaesenc %xmm2,%xmm11,%xmm11 |
689 | vaesenc %xmm2,%xmm12,%xmm12 |
690 | |
691 | vmovdqa 144(%rdx),%xmm1 |
692 | vaesenc %xmm1,%xmm9,%xmm9 |
693 | vaesenc %xmm1,%xmm10,%xmm10 |
694 | vaesenc %xmm1,%xmm11,%xmm11 |
695 | vaesenc %xmm1,%xmm12,%xmm12 |
696 | |
697 | vmovdqa 160(%rdx),%xmm2 |
698 | vaesenclast %xmm2,%xmm9,%xmm9 |
699 | vaesenclast %xmm2,%xmm10,%xmm10 |
700 | vaesenclast %xmm2,%xmm11,%xmm11 |
701 | vaesenclast %xmm2,%xmm12,%xmm12 |
702 | |
703 | |
704 | vmovdqa %xmm9,0(%rsi) |
705 | vmovdqa %xmm10,16(%rsi) |
706 | vmovdqa %xmm11,32(%rsi) |
707 | vmovdqa %xmm12,48(%rsi) |
708 | .byte 0xf3,0xc3 |
709 | .cfi_endproc |
710 | .size aes128gcmsiv_kdf,.-aes128gcmsiv_kdf |
711 | .globl aes128gcmsiv_enc_msg_x4 |
712 | .hidden aes128gcmsiv_enc_msg_x4 |
713 | .type aes128gcmsiv_enc_msg_x4,@function |
714 | .align 16 |
715 | aes128gcmsiv_enc_msg_x4: |
716 | .cfi_startproc |
717 | testq %r8,%r8 |
718 | jnz .L128_enc_msg_x4_start |
719 | .byte 0xf3,0xc3 |
720 | |
721 | .L128_enc_msg_x4_start: |
722 | pushq %r12 |
723 | .cfi_adjust_cfa_offset 8 |
724 | .cfi_offset %r12,-16 |
725 | pushq %r13 |
726 | .cfi_adjust_cfa_offset 8 |
727 | .cfi_offset %r13,-24 |
728 | |
729 | shrq $4,%r8 |
730 | movq %r8,%r10 |
731 | shlq $62,%r10 |
732 | shrq $62,%r10 |
733 | |
734 | |
735 | vmovdqa (%rdx),%xmm15 |
736 | vpor OR_MASK(%rip),%xmm15,%xmm15 |
737 | |
738 | vmovdqu four(%rip),%xmm4 |
739 | vmovdqa %xmm15,%xmm0 |
740 | vpaddd one(%rip),%xmm15,%xmm1 |
741 | vpaddd two(%rip),%xmm15,%xmm2 |
742 | vpaddd three(%rip),%xmm15,%xmm3 |
743 | |
744 | shrq $2,%r8 |
745 | je .L128_enc_msg_x4_check_remainder |
746 | |
747 | subq $64,%rsi |
748 | subq $64,%rdi |
749 | |
750 | .L128_enc_msg_x4_loop1: |
751 | addq $64,%rsi |
752 | addq $64,%rdi |
753 | |
754 | vmovdqa %xmm0,%xmm5 |
755 | vmovdqa %xmm1,%xmm6 |
756 | vmovdqa %xmm2,%xmm7 |
757 | vmovdqa %xmm3,%xmm8 |
758 | |
759 | vpxor (%rcx),%xmm5,%xmm5 |
760 | vpxor (%rcx),%xmm6,%xmm6 |
761 | vpxor (%rcx),%xmm7,%xmm7 |
762 | vpxor (%rcx),%xmm8,%xmm8 |
763 | |
764 | vmovdqu 16(%rcx),%xmm12 |
765 | vaesenc %xmm12,%xmm5,%xmm5 |
766 | vaesenc %xmm12,%xmm6,%xmm6 |
767 | vaesenc %xmm12,%xmm7,%xmm7 |
768 | vaesenc %xmm12,%xmm8,%xmm8 |
769 | |
770 | vpaddd %xmm4,%xmm0,%xmm0 |
771 | vmovdqu 32(%rcx),%xmm12 |
772 | vaesenc %xmm12,%xmm5,%xmm5 |
773 | vaesenc %xmm12,%xmm6,%xmm6 |
774 | vaesenc %xmm12,%xmm7,%xmm7 |
775 | vaesenc %xmm12,%xmm8,%xmm8 |
776 | |
777 | vpaddd %xmm4,%xmm1,%xmm1 |
778 | vmovdqu 48(%rcx),%xmm12 |
779 | vaesenc %xmm12,%xmm5,%xmm5 |
780 | vaesenc %xmm12,%xmm6,%xmm6 |
781 | vaesenc %xmm12,%xmm7,%xmm7 |
782 | vaesenc %xmm12,%xmm8,%xmm8 |
783 | |
784 | vpaddd %xmm4,%xmm2,%xmm2 |
785 | vmovdqu 64(%rcx),%xmm12 |
786 | vaesenc %xmm12,%xmm5,%xmm5 |
787 | vaesenc %xmm12,%xmm6,%xmm6 |
788 | vaesenc %xmm12,%xmm7,%xmm7 |
789 | vaesenc %xmm12,%xmm8,%xmm8 |
790 | |
791 | vpaddd %xmm4,%xmm3,%xmm3 |
792 | |
793 | vmovdqu 80(%rcx),%xmm12 |
794 | vaesenc %xmm12,%xmm5,%xmm5 |
795 | vaesenc %xmm12,%xmm6,%xmm6 |
796 | vaesenc %xmm12,%xmm7,%xmm7 |
797 | vaesenc %xmm12,%xmm8,%xmm8 |
798 | |
799 | vmovdqu 96(%rcx),%xmm12 |
800 | vaesenc %xmm12,%xmm5,%xmm5 |
801 | vaesenc %xmm12,%xmm6,%xmm6 |
802 | vaesenc %xmm12,%xmm7,%xmm7 |
803 | vaesenc %xmm12,%xmm8,%xmm8 |
804 | |
805 | vmovdqu 112(%rcx),%xmm12 |
806 | vaesenc %xmm12,%xmm5,%xmm5 |
807 | vaesenc %xmm12,%xmm6,%xmm6 |
808 | vaesenc %xmm12,%xmm7,%xmm7 |
809 | vaesenc %xmm12,%xmm8,%xmm8 |
810 | |
811 | vmovdqu 128(%rcx),%xmm12 |
812 | vaesenc %xmm12,%xmm5,%xmm5 |
813 | vaesenc %xmm12,%xmm6,%xmm6 |
814 | vaesenc %xmm12,%xmm7,%xmm7 |
815 | vaesenc %xmm12,%xmm8,%xmm8 |
816 | |
817 | vmovdqu 144(%rcx),%xmm12 |
818 | vaesenc %xmm12,%xmm5,%xmm5 |
819 | vaesenc %xmm12,%xmm6,%xmm6 |
820 | vaesenc %xmm12,%xmm7,%xmm7 |
821 | vaesenc %xmm12,%xmm8,%xmm8 |
822 | |
823 | vmovdqu 160(%rcx),%xmm12 |
824 | vaesenclast %xmm12,%xmm5,%xmm5 |
825 | vaesenclast %xmm12,%xmm6,%xmm6 |
826 | vaesenclast %xmm12,%xmm7,%xmm7 |
827 | vaesenclast %xmm12,%xmm8,%xmm8 |
828 | |
829 | |
830 | |
831 | vpxor 0(%rdi),%xmm5,%xmm5 |
832 | vpxor 16(%rdi),%xmm6,%xmm6 |
833 | vpxor 32(%rdi),%xmm7,%xmm7 |
834 | vpxor 48(%rdi),%xmm8,%xmm8 |
835 | |
836 | subq $1,%r8 |
837 | |
838 | vmovdqu %xmm5,0(%rsi) |
839 | vmovdqu %xmm6,16(%rsi) |
840 | vmovdqu %xmm7,32(%rsi) |
841 | vmovdqu %xmm8,48(%rsi) |
842 | |
843 | jne .L128_enc_msg_x4_loop1 |
844 | |
845 | addq $64,%rsi |
846 | addq $64,%rdi |
847 | |
848 | .L128_enc_msg_x4_check_remainder: |
849 | cmpq $0,%r10 |
850 | je .L128_enc_msg_x4_out |
851 | |
852 | .L128_enc_msg_x4_loop2: |
853 | |
854 | |
855 | vmovdqa %xmm0,%xmm5 |
856 | vpaddd one(%rip),%xmm0,%xmm0 |
857 | |
858 | vpxor (%rcx),%xmm5,%xmm5 |
859 | vaesenc 16(%rcx),%xmm5,%xmm5 |
860 | vaesenc 32(%rcx),%xmm5,%xmm5 |
861 | vaesenc 48(%rcx),%xmm5,%xmm5 |
862 | vaesenc 64(%rcx),%xmm5,%xmm5 |
863 | vaesenc 80(%rcx),%xmm5,%xmm5 |
864 | vaesenc 96(%rcx),%xmm5,%xmm5 |
865 | vaesenc 112(%rcx),%xmm5,%xmm5 |
866 | vaesenc 128(%rcx),%xmm5,%xmm5 |
867 | vaesenc 144(%rcx),%xmm5,%xmm5 |
868 | vaesenclast 160(%rcx),%xmm5,%xmm5 |
869 | |
870 | |
871 | vpxor (%rdi),%xmm5,%xmm5 |
872 | vmovdqu %xmm5,(%rsi) |
873 | |
874 | addq $16,%rdi |
875 | addq $16,%rsi |
876 | |
877 | subq $1,%r10 |
878 | jne .L128_enc_msg_x4_loop2 |
879 | |
880 | .L128_enc_msg_x4_out: |
881 | popq %r13 |
882 | .cfi_adjust_cfa_offset -8 |
883 | .cfi_restore %r13 |
884 | popq %r12 |
885 | .cfi_adjust_cfa_offset -8 |
886 | .cfi_restore %r12 |
887 | .byte 0xf3,0xc3 |
888 | .cfi_endproc |
889 | .size aes128gcmsiv_enc_msg_x4,.-aes128gcmsiv_enc_msg_x4 |
890 | .globl aes128gcmsiv_enc_msg_x8 |
891 | .hidden aes128gcmsiv_enc_msg_x8 |
892 | .type aes128gcmsiv_enc_msg_x8,@function |
893 | .align 16 |
894 | aes128gcmsiv_enc_msg_x8: |
895 | .cfi_startproc |
896 | testq %r8,%r8 |
897 | jnz .L128_enc_msg_x8_start |
898 | .byte 0xf3,0xc3 |
899 | |
900 | .L128_enc_msg_x8_start: |
901 | pushq %r12 |
902 | .cfi_adjust_cfa_offset 8 |
903 | .cfi_offset %r12,-16 |
904 | pushq %r13 |
905 | .cfi_adjust_cfa_offset 8 |
906 | .cfi_offset %r13,-24 |
907 | pushq %rbp |
908 | .cfi_adjust_cfa_offset 8 |
909 | .cfi_offset %rbp,-32 |
910 | movq %rsp,%rbp |
911 | .cfi_def_cfa_register rbp |
912 | |
913 | |
914 | subq $128,%rsp |
915 | andq $-64,%rsp |
916 | |
917 | shrq $4,%r8 |
918 | movq %r8,%r10 |
919 | shlq $61,%r10 |
920 | shrq $61,%r10 |
921 | |
922 | |
923 | vmovdqu (%rdx),%xmm1 |
924 | vpor OR_MASK(%rip),%xmm1,%xmm1 |
925 | |
926 | |
927 | vpaddd seven(%rip),%xmm1,%xmm0 |
928 | vmovdqu %xmm0,(%rsp) |
929 | vpaddd one(%rip),%xmm1,%xmm9 |
930 | vpaddd two(%rip),%xmm1,%xmm10 |
931 | vpaddd three(%rip),%xmm1,%xmm11 |
932 | vpaddd four(%rip),%xmm1,%xmm12 |
933 | vpaddd five(%rip),%xmm1,%xmm13 |
934 | vpaddd six(%rip),%xmm1,%xmm14 |
935 | vmovdqa %xmm1,%xmm0 |
936 | |
937 | shrq $3,%r8 |
938 | je .L128_enc_msg_x8_check_remainder |
939 | |
940 | subq $128,%rsi |
941 | subq $128,%rdi |
942 | |
943 | .L128_enc_msg_x8_loop1: |
944 | addq $128,%rsi |
945 | addq $128,%rdi |
946 | |
947 | vmovdqa %xmm0,%xmm1 |
948 | vmovdqa %xmm9,%xmm2 |
949 | vmovdqa %xmm10,%xmm3 |
950 | vmovdqa %xmm11,%xmm4 |
951 | vmovdqa %xmm12,%xmm5 |
952 | vmovdqa %xmm13,%xmm6 |
953 | vmovdqa %xmm14,%xmm7 |
954 | |
955 | vmovdqu (%rsp),%xmm8 |
956 | |
957 | vpxor (%rcx),%xmm1,%xmm1 |
958 | vpxor (%rcx),%xmm2,%xmm2 |
959 | vpxor (%rcx),%xmm3,%xmm3 |
960 | vpxor (%rcx),%xmm4,%xmm4 |
961 | vpxor (%rcx),%xmm5,%xmm5 |
962 | vpxor (%rcx),%xmm6,%xmm6 |
963 | vpxor (%rcx),%xmm7,%xmm7 |
964 | vpxor (%rcx),%xmm8,%xmm8 |
965 | |
966 | vmovdqu 16(%rcx),%xmm15 |
967 | vaesenc %xmm15,%xmm1,%xmm1 |
968 | vaesenc %xmm15,%xmm2,%xmm2 |
969 | vaesenc %xmm15,%xmm3,%xmm3 |
970 | vaesenc %xmm15,%xmm4,%xmm4 |
971 | vaesenc %xmm15,%xmm5,%xmm5 |
972 | vaesenc %xmm15,%xmm6,%xmm6 |
973 | vaesenc %xmm15,%xmm7,%xmm7 |
974 | vaesenc %xmm15,%xmm8,%xmm8 |
975 | |
976 | vmovdqu (%rsp),%xmm14 |
977 | vpaddd eight(%rip),%xmm14,%xmm14 |
978 | vmovdqu %xmm14,(%rsp) |
979 | vmovdqu 32(%rcx),%xmm15 |
980 | vaesenc %xmm15,%xmm1,%xmm1 |
981 | vaesenc %xmm15,%xmm2,%xmm2 |
982 | vaesenc %xmm15,%xmm3,%xmm3 |
983 | vaesenc %xmm15,%xmm4,%xmm4 |
984 | vaesenc %xmm15,%xmm5,%xmm5 |
985 | vaesenc %xmm15,%xmm6,%xmm6 |
986 | vaesenc %xmm15,%xmm7,%xmm7 |
987 | vaesenc %xmm15,%xmm8,%xmm8 |
988 | |
989 | vpsubd one(%rip),%xmm14,%xmm14 |
990 | vmovdqu 48(%rcx),%xmm15 |
991 | vaesenc %xmm15,%xmm1,%xmm1 |
992 | vaesenc %xmm15,%xmm2,%xmm2 |
993 | vaesenc %xmm15,%xmm3,%xmm3 |
994 | vaesenc %xmm15,%xmm4,%xmm4 |
995 | vaesenc %xmm15,%xmm5,%xmm5 |
996 | vaesenc %xmm15,%xmm6,%xmm6 |
997 | vaesenc %xmm15,%xmm7,%xmm7 |
998 | vaesenc %xmm15,%xmm8,%xmm8 |
999 | |
1000 | vpaddd eight(%rip),%xmm0,%xmm0 |
1001 | vmovdqu 64(%rcx),%xmm15 |
1002 | vaesenc %xmm15,%xmm1,%xmm1 |
1003 | vaesenc %xmm15,%xmm2,%xmm2 |
1004 | vaesenc %xmm15,%xmm3,%xmm3 |
1005 | vaesenc %xmm15,%xmm4,%xmm4 |
1006 | vaesenc %xmm15,%xmm5,%xmm5 |
1007 | vaesenc %xmm15,%xmm6,%xmm6 |
1008 | vaesenc %xmm15,%xmm7,%xmm7 |
1009 | vaesenc %xmm15,%xmm8,%xmm8 |
1010 | |
1011 | vpaddd eight(%rip),%xmm9,%xmm9 |
1012 | vmovdqu 80(%rcx),%xmm15 |
1013 | vaesenc %xmm15,%xmm1,%xmm1 |
1014 | vaesenc %xmm15,%xmm2,%xmm2 |
1015 | vaesenc %xmm15,%xmm3,%xmm3 |
1016 | vaesenc %xmm15,%xmm4,%xmm4 |
1017 | vaesenc %xmm15,%xmm5,%xmm5 |
1018 | vaesenc %xmm15,%xmm6,%xmm6 |
1019 | vaesenc %xmm15,%xmm7,%xmm7 |
1020 | vaesenc %xmm15,%xmm8,%xmm8 |
1021 | |
1022 | vpaddd eight(%rip),%xmm10,%xmm10 |
1023 | vmovdqu 96(%rcx),%xmm15 |
1024 | vaesenc %xmm15,%xmm1,%xmm1 |
1025 | vaesenc %xmm15,%xmm2,%xmm2 |
1026 | vaesenc %xmm15,%xmm3,%xmm3 |
1027 | vaesenc %xmm15,%xmm4,%xmm4 |
1028 | vaesenc %xmm15,%xmm5,%xmm5 |
1029 | vaesenc %xmm15,%xmm6,%xmm6 |
1030 | vaesenc %xmm15,%xmm7,%xmm7 |
1031 | vaesenc %xmm15,%xmm8,%xmm8 |
1032 | |
1033 | vpaddd eight(%rip),%xmm11,%xmm11 |
1034 | vmovdqu 112(%rcx),%xmm15 |
1035 | vaesenc %xmm15,%xmm1,%xmm1 |
1036 | vaesenc %xmm15,%xmm2,%xmm2 |
1037 | vaesenc %xmm15,%xmm3,%xmm3 |
1038 | vaesenc %xmm15,%xmm4,%xmm4 |
1039 | vaesenc %xmm15,%xmm5,%xmm5 |
1040 | vaesenc %xmm15,%xmm6,%xmm6 |
1041 | vaesenc %xmm15,%xmm7,%xmm7 |
1042 | vaesenc %xmm15,%xmm8,%xmm8 |
1043 | |
1044 | vpaddd eight(%rip),%xmm12,%xmm12 |
1045 | vmovdqu 128(%rcx),%xmm15 |
1046 | vaesenc %xmm15,%xmm1,%xmm1 |
1047 | vaesenc %xmm15,%xmm2,%xmm2 |
1048 | vaesenc %xmm15,%xmm3,%xmm3 |
1049 | vaesenc %xmm15,%xmm4,%xmm4 |
1050 | vaesenc %xmm15,%xmm5,%xmm5 |
1051 | vaesenc %xmm15,%xmm6,%xmm6 |
1052 | vaesenc %xmm15,%xmm7,%xmm7 |
1053 | vaesenc %xmm15,%xmm8,%xmm8 |
1054 | |
1055 | vpaddd eight(%rip),%xmm13,%xmm13 |
1056 | vmovdqu 144(%rcx),%xmm15 |
1057 | vaesenc %xmm15,%xmm1,%xmm1 |
1058 | vaesenc %xmm15,%xmm2,%xmm2 |
1059 | vaesenc %xmm15,%xmm3,%xmm3 |
1060 | vaesenc %xmm15,%xmm4,%xmm4 |
1061 | vaesenc %xmm15,%xmm5,%xmm5 |
1062 | vaesenc %xmm15,%xmm6,%xmm6 |
1063 | vaesenc %xmm15,%xmm7,%xmm7 |
1064 | vaesenc %xmm15,%xmm8,%xmm8 |
1065 | |
1066 | vmovdqu 160(%rcx),%xmm15 |
1067 | vaesenclast %xmm15,%xmm1,%xmm1 |
1068 | vaesenclast %xmm15,%xmm2,%xmm2 |
1069 | vaesenclast %xmm15,%xmm3,%xmm3 |
1070 | vaesenclast %xmm15,%xmm4,%xmm4 |
1071 | vaesenclast %xmm15,%xmm5,%xmm5 |
1072 | vaesenclast %xmm15,%xmm6,%xmm6 |
1073 | vaesenclast %xmm15,%xmm7,%xmm7 |
1074 | vaesenclast %xmm15,%xmm8,%xmm8 |
1075 | |
1076 | |
1077 | |
1078 | vpxor 0(%rdi),%xmm1,%xmm1 |
1079 | vpxor 16(%rdi),%xmm2,%xmm2 |
1080 | vpxor 32(%rdi),%xmm3,%xmm3 |
1081 | vpxor 48(%rdi),%xmm4,%xmm4 |
1082 | vpxor 64(%rdi),%xmm5,%xmm5 |
1083 | vpxor 80(%rdi),%xmm6,%xmm6 |
1084 | vpxor 96(%rdi),%xmm7,%xmm7 |
1085 | vpxor 112(%rdi),%xmm8,%xmm8 |
1086 | |
1087 | decq %r8 |
1088 | |
1089 | vmovdqu %xmm1,0(%rsi) |
1090 | vmovdqu %xmm2,16(%rsi) |
1091 | vmovdqu %xmm3,32(%rsi) |
1092 | vmovdqu %xmm4,48(%rsi) |
1093 | vmovdqu %xmm5,64(%rsi) |
1094 | vmovdqu %xmm6,80(%rsi) |
1095 | vmovdqu %xmm7,96(%rsi) |
1096 | vmovdqu %xmm8,112(%rsi) |
1097 | |
1098 | jne .L128_enc_msg_x8_loop1 |
1099 | |
1100 | addq $128,%rsi |
1101 | addq $128,%rdi |
1102 | |
1103 | .L128_enc_msg_x8_check_remainder: |
1104 | cmpq $0,%r10 |
1105 | je .L128_enc_msg_x8_out |
1106 | |
1107 | .L128_enc_msg_x8_loop2: |
1108 | |
1109 | |
1110 | vmovdqa %xmm0,%xmm1 |
1111 | vpaddd one(%rip),%xmm0,%xmm0 |
1112 | |
1113 | vpxor (%rcx),%xmm1,%xmm1 |
1114 | vaesenc 16(%rcx),%xmm1,%xmm1 |
1115 | vaesenc 32(%rcx),%xmm1,%xmm1 |
1116 | vaesenc 48(%rcx),%xmm1,%xmm1 |
1117 | vaesenc 64(%rcx),%xmm1,%xmm1 |
1118 | vaesenc 80(%rcx),%xmm1,%xmm1 |
1119 | vaesenc 96(%rcx),%xmm1,%xmm1 |
1120 | vaesenc 112(%rcx),%xmm1,%xmm1 |
1121 | vaesenc 128(%rcx),%xmm1,%xmm1 |
1122 | vaesenc 144(%rcx),%xmm1,%xmm1 |
1123 | vaesenclast 160(%rcx),%xmm1,%xmm1 |
1124 | |
1125 | |
1126 | vpxor (%rdi),%xmm1,%xmm1 |
1127 | |
1128 | vmovdqu %xmm1,(%rsi) |
1129 | |
1130 | addq $16,%rdi |
1131 | addq $16,%rsi |
1132 | |
1133 | decq %r10 |
1134 | jne .L128_enc_msg_x8_loop2 |
1135 | |
1136 | .L128_enc_msg_x8_out: |
1137 | movq %rbp,%rsp |
1138 | .cfi_def_cfa_register %rsp |
1139 | popq %rbp |
1140 | .cfi_adjust_cfa_offset -8 |
1141 | .cfi_restore %rbp |
1142 | popq %r13 |
1143 | .cfi_adjust_cfa_offset -8 |
1144 | .cfi_restore %r13 |
1145 | popq %r12 |
1146 | .cfi_adjust_cfa_offset -8 |
1147 | .cfi_restore %r12 |
1148 | .byte 0xf3,0xc3 |
1149 | .cfi_endproc |
1150 | .size aes128gcmsiv_enc_msg_x8,.-aes128gcmsiv_enc_msg_x8 |
1151 | .globl aes128gcmsiv_dec |
1152 | .hidden aes128gcmsiv_dec |
1153 | .type aes128gcmsiv_dec,@function |
1154 | .align 16 |
1155 | aes128gcmsiv_dec: |
1156 | .cfi_startproc |
1157 | testq $~15,%r9 |
1158 | jnz .L128_dec_start |
1159 | .byte 0xf3,0xc3 |
1160 | |
1161 | .L128_dec_start: |
1162 | vzeroupper |
1163 | vmovdqa (%rdx),%xmm0 |
1164 | movq %rdx,%rax |
1165 | |
1166 | leaq 32(%rax),%rax |
1167 | leaq 32(%rcx),%rcx |
1168 | |
1169 | |
1170 | vmovdqu (%rdi,%r9,1),%xmm15 |
1171 | vpor OR_MASK(%rip),%xmm15,%xmm15 |
1172 | andq $~15,%r9 |
1173 | |
1174 | |
1175 | cmpq $96,%r9 |
1176 | jb .L128_dec_loop2 |
1177 | |
1178 | |
1179 | subq $96,%r9 |
1180 | vmovdqa %xmm15,%xmm7 |
1181 | vpaddd one(%rip),%xmm7,%xmm8 |
1182 | vpaddd two(%rip),%xmm7,%xmm9 |
1183 | vpaddd one(%rip),%xmm9,%xmm10 |
1184 | vpaddd two(%rip),%xmm9,%xmm11 |
1185 | vpaddd one(%rip),%xmm11,%xmm12 |
1186 | vpaddd two(%rip),%xmm11,%xmm15 |
1187 | |
1188 | vpxor (%r8),%xmm7,%xmm7 |
1189 | vpxor (%r8),%xmm8,%xmm8 |
1190 | vpxor (%r8),%xmm9,%xmm9 |
1191 | vpxor (%r8),%xmm10,%xmm10 |
1192 | vpxor (%r8),%xmm11,%xmm11 |
1193 | vpxor (%r8),%xmm12,%xmm12 |
1194 | |
1195 | vmovdqu 16(%r8),%xmm4 |
1196 | vaesenc %xmm4,%xmm7,%xmm7 |
1197 | vaesenc %xmm4,%xmm8,%xmm8 |
1198 | vaesenc %xmm4,%xmm9,%xmm9 |
1199 | vaesenc %xmm4,%xmm10,%xmm10 |
1200 | vaesenc %xmm4,%xmm11,%xmm11 |
1201 | vaesenc %xmm4,%xmm12,%xmm12 |
1202 | |
1203 | vmovdqu 32(%r8),%xmm4 |
1204 | vaesenc %xmm4,%xmm7,%xmm7 |
1205 | vaesenc %xmm4,%xmm8,%xmm8 |
1206 | vaesenc %xmm4,%xmm9,%xmm9 |
1207 | vaesenc %xmm4,%xmm10,%xmm10 |
1208 | vaesenc %xmm4,%xmm11,%xmm11 |
1209 | vaesenc %xmm4,%xmm12,%xmm12 |
1210 | |
1211 | vmovdqu 48(%r8),%xmm4 |
1212 | vaesenc %xmm4,%xmm7,%xmm7 |
1213 | vaesenc %xmm4,%xmm8,%xmm8 |
1214 | vaesenc %xmm4,%xmm9,%xmm9 |
1215 | vaesenc %xmm4,%xmm10,%xmm10 |
1216 | vaesenc %xmm4,%xmm11,%xmm11 |
1217 | vaesenc %xmm4,%xmm12,%xmm12 |
1218 | |
1219 | vmovdqu 64(%r8),%xmm4 |
1220 | vaesenc %xmm4,%xmm7,%xmm7 |
1221 | vaesenc %xmm4,%xmm8,%xmm8 |
1222 | vaesenc %xmm4,%xmm9,%xmm9 |
1223 | vaesenc %xmm4,%xmm10,%xmm10 |
1224 | vaesenc %xmm4,%xmm11,%xmm11 |
1225 | vaesenc %xmm4,%xmm12,%xmm12 |
1226 | |
1227 | vmovdqu 80(%r8),%xmm4 |
1228 | vaesenc %xmm4,%xmm7,%xmm7 |
1229 | vaesenc %xmm4,%xmm8,%xmm8 |
1230 | vaesenc %xmm4,%xmm9,%xmm9 |
1231 | vaesenc %xmm4,%xmm10,%xmm10 |
1232 | vaesenc %xmm4,%xmm11,%xmm11 |
1233 | vaesenc %xmm4,%xmm12,%xmm12 |
1234 | |
1235 | vmovdqu 96(%r8),%xmm4 |
1236 | vaesenc %xmm4,%xmm7,%xmm7 |
1237 | vaesenc %xmm4,%xmm8,%xmm8 |
1238 | vaesenc %xmm4,%xmm9,%xmm9 |
1239 | vaesenc %xmm4,%xmm10,%xmm10 |
1240 | vaesenc %xmm4,%xmm11,%xmm11 |
1241 | vaesenc %xmm4,%xmm12,%xmm12 |
1242 | |
1243 | vmovdqu 112(%r8),%xmm4 |
1244 | vaesenc %xmm4,%xmm7,%xmm7 |
1245 | vaesenc %xmm4,%xmm8,%xmm8 |
1246 | vaesenc %xmm4,%xmm9,%xmm9 |
1247 | vaesenc %xmm4,%xmm10,%xmm10 |
1248 | vaesenc %xmm4,%xmm11,%xmm11 |
1249 | vaesenc %xmm4,%xmm12,%xmm12 |
1250 | |
1251 | vmovdqu 128(%r8),%xmm4 |
1252 | vaesenc %xmm4,%xmm7,%xmm7 |
1253 | vaesenc %xmm4,%xmm8,%xmm8 |
1254 | vaesenc %xmm4,%xmm9,%xmm9 |
1255 | vaesenc %xmm4,%xmm10,%xmm10 |
1256 | vaesenc %xmm4,%xmm11,%xmm11 |
1257 | vaesenc %xmm4,%xmm12,%xmm12 |
1258 | |
1259 | vmovdqu 144(%r8),%xmm4 |
1260 | vaesenc %xmm4,%xmm7,%xmm7 |
1261 | vaesenc %xmm4,%xmm8,%xmm8 |
1262 | vaesenc %xmm4,%xmm9,%xmm9 |
1263 | vaesenc %xmm4,%xmm10,%xmm10 |
1264 | vaesenc %xmm4,%xmm11,%xmm11 |
1265 | vaesenc %xmm4,%xmm12,%xmm12 |
1266 | |
1267 | vmovdqu 160(%r8),%xmm4 |
1268 | vaesenclast %xmm4,%xmm7,%xmm7 |
1269 | vaesenclast %xmm4,%xmm8,%xmm8 |
1270 | vaesenclast %xmm4,%xmm9,%xmm9 |
1271 | vaesenclast %xmm4,%xmm10,%xmm10 |
1272 | vaesenclast %xmm4,%xmm11,%xmm11 |
1273 | vaesenclast %xmm4,%xmm12,%xmm12 |
1274 | |
1275 | |
1276 | vpxor 0(%rdi),%xmm7,%xmm7 |
1277 | vpxor 16(%rdi),%xmm8,%xmm8 |
1278 | vpxor 32(%rdi),%xmm9,%xmm9 |
1279 | vpxor 48(%rdi),%xmm10,%xmm10 |
1280 | vpxor 64(%rdi),%xmm11,%xmm11 |
1281 | vpxor 80(%rdi),%xmm12,%xmm12 |
1282 | |
1283 | vmovdqu %xmm7,0(%rsi) |
1284 | vmovdqu %xmm8,16(%rsi) |
1285 | vmovdqu %xmm9,32(%rsi) |
1286 | vmovdqu %xmm10,48(%rsi) |
1287 | vmovdqu %xmm11,64(%rsi) |
1288 | vmovdqu %xmm12,80(%rsi) |
1289 | |
1290 | addq $96,%rdi |
1291 | addq $96,%rsi |
1292 | jmp .L128_dec_loop1 |
1293 | |
1294 | |
1295 | .align 64 |
1296 | .L128_dec_loop1: |
1297 | cmpq $96,%r9 |
1298 | jb .L128_dec_finish_96 |
1299 | subq $96,%r9 |
1300 | |
1301 | vmovdqa %xmm12,%xmm6 |
1302 | vmovdqa %xmm11,16-32(%rax) |
1303 | vmovdqa %xmm10,32-32(%rax) |
1304 | vmovdqa %xmm9,48-32(%rax) |
1305 | vmovdqa %xmm8,64-32(%rax) |
1306 | vmovdqa %xmm7,80-32(%rax) |
1307 | |
1308 | vmovdqa %xmm15,%xmm7 |
1309 | vpaddd one(%rip),%xmm7,%xmm8 |
1310 | vpaddd two(%rip),%xmm7,%xmm9 |
1311 | vpaddd one(%rip),%xmm9,%xmm10 |
1312 | vpaddd two(%rip),%xmm9,%xmm11 |
1313 | vpaddd one(%rip),%xmm11,%xmm12 |
1314 | vpaddd two(%rip),%xmm11,%xmm15 |
1315 | |
1316 | vmovdqa (%r8),%xmm4 |
1317 | vpxor %xmm4,%xmm7,%xmm7 |
1318 | vpxor %xmm4,%xmm8,%xmm8 |
1319 | vpxor %xmm4,%xmm9,%xmm9 |
1320 | vpxor %xmm4,%xmm10,%xmm10 |
1321 | vpxor %xmm4,%xmm11,%xmm11 |
1322 | vpxor %xmm4,%xmm12,%xmm12 |
1323 | |
1324 | vmovdqu 0-32(%rcx),%xmm4 |
1325 | vpclmulqdq $0x11,%xmm4,%xmm6,%xmm2 |
1326 | vpclmulqdq $0x00,%xmm4,%xmm6,%xmm3 |
1327 | vpclmulqdq $0x01,%xmm4,%xmm6,%xmm1 |
1328 | vpclmulqdq $0x10,%xmm4,%xmm6,%xmm4 |
1329 | vpxor %xmm4,%xmm1,%xmm1 |
1330 | |
1331 | vmovdqu 16(%r8),%xmm4 |
1332 | vaesenc %xmm4,%xmm7,%xmm7 |
1333 | vaesenc %xmm4,%xmm8,%xmm8 |
1334 | vaesenc %xmm4,%xmm9,%xmm9 |
1335 | vaesenc %xmm4,%xmm10,%xmm10 |
1336 | vaesenc %xmm4,%xmm11,%xmm11 |
1337 | vaesenc %xmm4,%xmm12,%xmm12 |
1338 | |
1339 | vmovdqu -16(%rax),%xmm6 |
1340 | vmovdqu -16(%rcx),%xmm13 |
1341 | |
1342 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1343 | vpxor %xmm4,%xmm1,%xmm1 |
1344 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1345 | vpxor %xmm4,%xmm2,%xmm2 |
1346 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1347 | vpxor %xmm4,%xmm3,%xmm3 |
1348 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1349 | vpxor %xmm4,%xmm1,%xmm1 |
1350 | |
1351 | |
1352 | vmovdqu 32(%r8),%xmm4 |
1353 | vaesenc %xmm4,%xmm7,%xmm7 |
1354 | vaesenc %xmm4,%xmm8,%xmm8 |
1355 | vaesenc %xmm4,%xmm9,%xmm9 |
1356 | vaesenc %xmm4,%xmm10,%xmm10 |
1357 | vaesenc %xmm4,%xmm11,%xmm11 |
1358 | vaesenc %xmm4,%xmm12,%xmm12 |
1359 | |
1360 | vmovdqu 0(%rax),%xmm6 |
1361 | vmovdqu 0(%rcx),%xmm13 |
1362 | |
1363 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1364 | vpxor %xmm4,%xmm1,%xmm1 |
1365 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1366 | vpxor %xmm4,%xmm2,%xmm2 |
1367 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1368 | vpxor %xmm4,%xmm3,%xmm3 |
1369 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1370 | vpxor %xmm4,%xmm1,%xmm1 |
1371 | |
1372 | |
1373 | vmovdqu 48(%r8),%xmm4 |
1374 | vaesenc %xmm4,%xmm7,%xmm7 |
1375 | vaesenc %xmm4,%xmm8,%xmm8 |
1376 | vaesenc %xmm4,%xmm9,%xmm9 |
1377 | vaesenc %xmm4,%xmm10,%xmm10 |
1378 | vaesenc %xmm4,%xmm11,%xmm11 |
1379 | vaesenc %xmm4,%xmm12,%xmm12 |
1380 | |
1381 | vmovdqu 16(%rax),%xmm6 |
1382 | vmovdqu 16(%rcx),%xmm13 |
1383 | |
1384 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1385 | vpxor %xmm4,%xmm1,%xmm1 |
1386 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1387 | vpxor %xmm4,%xmm2,%xmm2 |
1388 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1389 | vpxor %xmm4,%xmm3,%xmm3 |
1390 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1391 | vpxor %xmm4,%xmm1,%xmm1 |
1392 | |
1393 | |
1394 | vmovdqu 64(%r8),%xmm4 |
1395 | vaesenc %xmm4,%xmm7,%xmm7 |
1396 | vaesenc %xmm4,%xmm8,%xmm8 |
1397 | vaesenc %xmm4,%xmm9,%xmm9 |
1398 | vaesenc %xmm4,%xmm10,%xmm10 |
1399 | vaesenc %xmm4,%xmm11,%xmm11 |
1400 | vaesenc %xmm4,%xmm12,%xmm12 |
1401 | |
1402 | vmovdqu 32(%rax),%xmm6 |
1403 | vmovdqu 32(%rcx),%xmm13 |
1404 | |
1405 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1406 | vpxor %xmm4,%xmm1,%xmm1 |
1407 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1408 | vpxor %xmm4,%xmm2,%xmm2 |
1409 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1410 | vpxor %xmm4,%xmm3,%xmm3 |
1411 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1412 | vpxor %xmm4,%xmm1,%xmm1 |
1413 | |
1414 | |
1415 | vmovdqu 80(%r8),%xmm4 |
1416 | vaesenc %xmm4,%xmm7,%xmm7 |
1417 | vaesenc %xmm4,%xmm8,%xmm8 |
1418 | vaesenc %xmm4,%xmm9,%xmm9 |
1419 | vaesenc %xmm4,%xmm10,%xmm10 |
1420 | vaesenc %xmm4,%xmm11,%xmm11 |
1421 | vaesenc %xmm4,%xmm12,%xmm12 |
1422 | |
1423 | vmovdqu 96(%r8),%xmm4 |
1424 | vaesenc %xmm4,%xmm7,%xmm7 |
1425 | vaesenc %xmm4,%xmm8,%xmm8 |
1426 | vaesenc %xmm4,%xmm9,%xmm9 |
1427 | vaesenc %xmm4,%xmm10,%xmm10 |
1428 | vaesenc %xmm4,%xmm11,%xmm11 |
1429 | vaesenc %xmm4,%xmm12,%xmm12 |
1430 | |
1431 | vmovdqu 112(%r8),%xmm4 |
1432 | vaesenc %xmm4,%xmm7,%xmm7 |
1433 | vaesenc %xmm4,%xmm8,%xmm8 |
1434 | vaesenc %xmm4,%xmm9,%xmm9 |
1435 | vaesenc %xmm4,%xmm10,%xmm10 |
1436 | vaesenc %xmm4,%xmm11,%xmm11 |
1437 | vaesenc %xmm4,%xmm12,%xmm12 |
1438 | |
1439 | |
1440 | vmovdqa 80-32(%rax),%xmm6 |
1441 | vpxor %xmm0,%xmm6,%xmm6 |
1442 | vmovdqu 80-32(%rcx),%xmm5 |
1443 | |
1444 | vpclmulqdq $0x01,%xmm5,%xmm6,%xmm4 |
1445 | vpxor %xmm4,%xmm1,%xmm1 |
1446 | vpclmulqdq $0x11,%xmm5,%xmm6,%xmm4 |
1447 | vpxor %xmm4,%xmm2,%xmm2 |
1448 | vpclmulqdq $0x00,%xmm5,%xmm6,%xmm4 |
1449 | vpxor %xmm4,%xmm3,%xmm3 |
1450 | vpclmulqdq $0x10,%xmm5,%xmm6,%xmm4 |
1451 | vpxor %xmm4,%xmm1,%xmm1 |
1452 | |
1453 | vmovdqu 128(%r8),%xmm4 |
1454 | vaesenc %xmm4,%xmm7,%xmm7 |
1455 | vaesenc %xmm4,%xmm8,%xmm8 |
1456 | vaesenc %xmm4,%xmm9,%xmm9 |
1457 | vaesenc %xmm4,%xmm10,%xmm10 |
1458 | vaesenc %xmm4,%xmm11,%xmm11 |
1459 | vaesenc %xmm4,%xmm12,%xmm12 |
1460 | |
1461 | |
1462 | vpsrldq $8,%xmm1,%xmm4 |
1463 | vpxor %xmm4,%xmm2,%xmm5 |
1464 | vpslldq $8,%xmm1,%xmm4 |
1465 | vpxor %xmm4,%xmm3,%xmm0 |
1466 | |
1467 | vmovdqa poly(%rip),%xmm3 |
1468 | |
1469 | vmovdqu 144(%r8),%xmm4 |
1470 | vaesenc %xmm4,%xmm7,%xmm7 |
1471 | vaesenc %xmm4,%xmm8,%xmm8 |
1472 | vaesenc %xmm4,%xmm9,%xmm9 |
1473 | vaesenc %xmm4,%xmm10,%xmm10 |
1474 | vaesenc %xmm4,%xmm11,%xmm11 |
1475 | vaesenc %xmm4,%xmm12,%xmm12 |
1476 | |
1477 | vmovdqu 160(%r8),%xmm6 |
1478 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
1479 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
1480 | vpxor %xmm0,%xmm2,%xmm0 |
1481 | |
1482 | vpxor 0(%rdi),%xmm6,%xmm4 |
1483 | vaesenclast %xmm4,%xmm7,%xmm7 |
1484 | vpxor 16(%rdi),%xmm6,%xmm4 |
1485 | vaesenclast %xmm4,%xmm8,%xmm8 |
1486 | vpxor 32(%rdi),%xmm6,%xmm4 |
1487 | vaesenclast %xmm4,%xmm9,%xmm9 |
1488 | vpxor 48(%rdi),%xmm6,%xmm4 |
1489 | vaesenclast %xmm4,%xmm10,%xmm10 |
1490 | vpxor 64(%rdi),%xmm6,%xmm4 |
1491 | vaesenclast %xmm4,%xmm11,%xmm11 |
1492 | vpxor 80(%rdi),%xmm6,%xmm4 |
1493 | vaesenclast %xmm4,%xmm12,%xmm12 |
1494 | |
1495 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
1496 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
1497 | vpxor %xmm0,%xmm2,%xmm0 |
1498 | |
1499 | vmovdqu %xmm7,0(%rsi) |
1500 | vmovdqu %xmm8,16(%rsi) |
1501 | vmovdqu %xmm9,32(%rsi) |
1502 | vmovdqu %xmm10,48(%rsi) |
1503 | vmovdqu %xmm11,64(%rsi) |
1504 | vmovdqu %xmm12,80(%rsi) |
1505 | |
1506 | vpxor %xmm5,%xmm0,%xmm0 |
1507 | |
1508 | leaq 96(%rdi),%rdi |
1509 | leaq 96(%rsi),%rsi |
1510 | jmp .L128_dec_loop1 |
1511 | |
1512 | .L128_dec_finish_96: |
1513 | vmovdqa %xmm12,%xmm6 |
1514 | vmovdqa %xmm11,16-32(%rax) |
1515 | vmovdqa %xmm10,32-32(%rax) |
1516 | vmovdqa %xmm9,48-32(%rax) |
1517 | vmovdqa %xmm8,64-32(%rax) |
1518 | vmovdqa %xmm7,80-32(%rax) |
1519 | |
1520 | vmovdqu 0-32(%rcx),%xmm4 |
1521 | vpclmulqdq $0x10,%xmm4,%xmm6,%xmm1 |
1522 | vpclmulqdq $0x11,%xmm4,%xmm6,%xmm2 |
1523 | vpclmulqdq $0x00,%xmm4,%xmm6,%xmm3 |
1524 | vpclmulqdq $0x01,%xmm4,%xmm6,%xmm4 |
1525 | vpxor %xmm4,%xmm1,%xmm1 |
1526 | |
1527 | vmovdqu -16(%rax),%xmm6 |
1528 | vmovdqu -16(%rcx),%xmm13 |
1529 | |
1530 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1531 | vpxor %xmm4,%xmm1,%xmm1 |
1532 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1533 | vpxor %xmm4,%xmm2,%xmm2 |
1534 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1535 | vpxor %xmm4,%xmm3,%xmm3 |
1536 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1537 | vpxor %xmm4,%xmm1,%xmm1 |
1538 | |
1539 | vmovdqu 0(%rax),%xmm6 |
1540 | vmovdqu 0(%rcx),%xmm13 |
1541 | |
1542 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1543 | vpxor %xmm4,%xmm1,%xmm1 |
1544 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1545 | vpxor %xmm4,%xmm2,%xmm2 |
1546 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1547 | vpxor %xmm4,%xmm3,%xmm3 |
1548 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1549 | vpxor %xmm4,%xmm1,%xmm1 |
1550 | |
1551 | vmovdqu 16(%rax),%xmm6 |
1552 | vmovdqu 16(%rcx),%xmm13 |
1553 | |
1554 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1555 | vpxor %xmm4,%xmm1,%xmm1 |
1556 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1557 | vpxor %xmm4,%xmm2,%xmm2 |
1558 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1559 | vpxor %xmm4,%xmm3,%xmm3 |
1560 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1561 | vpxor %xmm4,%xmm1,%xmm1 |
1562 | |
1563 | vmovdqu 32(%rax),%xmm6 |
1564 | vmovdqu 32(%rcx),%xmm13 |
1565 | |
1566 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
1567 | vpxor %xmm4,%xmm1,%xmm1 |
1568 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
1569 | vpxor %xmm4,%xmm2,%xmm2 |
1570 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
1571 | vpxor %xmm4,%xmm3,%xmm3 |
1572 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
1573 | vpxor %xmm4,%xmm1,%xmm1 |
1574 | |
1575 | |
1576 | vmovdqu 80-32(%rax),%xmm6 |
1577 | vpxor %xmm0,%xmm6,%xmm6 |
1578 | vmovdqu 80-32(%rcx),%xmm5 |
1579 | vpclmulqdq $0x11,%xmm5,%xmm6,%xmm4 |
1580 | vpxor %xmm4,%xmm2,%xmm2 |
1581 | vpclmulqdq $0x00,%xmm5,%xmm6,%xmm4 |
1582 | vpxor %xmm4,%xmm3,%xmm3 |
1583 | vpclmulqdq $0x10,%xmm5,%xmm6,%xmm4 |
1584 | vpxor %xmm4,%xmm1,%xmm1 |
1585 | vpclmulqdq $0x01,%xmm5,%xmm6,%xmm4 |
1586 | vpxor %xmm4,%xmm1,%xmm1 |
1587 | |
1588 | vpsrldq $8,%xmm1,%xmm4 |
1589 | vpxor %xmm4,%xmm2,%xmm5 |
1590 | vpslldq $8,%xmm1,%xmm4 |
1591 | vpxor %xmm4,%xmm3,%xmm0 |
1592 | |
1593 | vmovdqa poly(%rip),%xmm3 |
1594 | |
1595 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
1596 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
1597 | vpxor %xmm0,%xmm2,%xmm0 |
1598 | |
1599 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
1600 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
1601 | vpxor %xmm0,%xmm2,%xmm0 |
1602 | |
1603 | vpxor %xmm5,%xmm0,%xmm0 |
1604 | |
1605 | .L128_dec_loop2: |
1606 | |
1607 | |
1608 | |
1609 | cmpq $16,%r9 |
1610 | jb .L128_dec_out |
1611 | subq $16,%r9 |
1612 | |
1613 | vmovdqa %xmm15,%xmm2 |
1614 | vpaddd one(%rip),%xmm15,%xmm15 |
1615 | |
1616 | vpxor 0(%r8),%xmm2,%xmm2 |
1617 | vaesenc 16(%r8),%xmm2,%xmm2 |
1618 | vaesenc 32(%r8),%xmm2,%xmm2 |
1619 | vaesenc 48(%r8),%xmm2,%xmm2 |
1620 | vaesenc 64(%r8),%xmm2,%xmm2 |
1621 | vaesenc 80(%r8),%xmm2,%xmm2 |
1622 | vaesenc 96(%r8),%xmm2,%xmm2 |
1623 | vaesenc 112(%r8),%xmm2,%xmm2 |
1624 | vaesenc 128(%r8),%xmm2,%xmm2 |
1625 | vaesenc 144(%r8),%xmm2,%xmm2 |
1626 | vaesenclast 160(%r8),%xmm2,%xmm2 |
1627 | vpxor (%rdi),%xmm2,%xmm2 |
1628 | vmovdqu %xmm2,(%rsi) |
1629 | addq $16,%rdi |
1630 | addq $16,%rsi |
1631 | |
1632 | vpxor %xmm2,%xmm0,%xmm0 |
1633 | vmovdqa -32(%rcx),%xmm1 |
1634 | call GFMUL |
1635 | |
1636 | jmp .L128_dec_loop2 |
1637 | |
1638 | .L128_dec_out: |
1639 | vmovdqu %xmm0,(%rdx) |
1640 | .byte 0xf3,0xc3 |
1641 | .cfi_endproc |
1642 | .size aes128gcmsiv_dec, .-aes128gcmsiv_dec |
1643 | .globl aes128gcmsiv_ecb_enc_block |
1644 | .hidden aes128gcmsiv_ecb_enc_block |
1645 | .type aes128gcmsiv_ecb_enc_block,@function |
1646 | .align 16 |
1647 | aes128gcmsiv_ecb_enc_block: |
1648 | .cfi_startproc |
1649 | vmovdqa (%rdi),%xmm1 |
1650 | |
1651 | vpxor (%rdx),%xmm1,%xmm1 |
1652 | vaesenc 16(%rdx),%xmm1,%xmm1 |
1653 | vaesenc 32(%rdx),%xmm1,%xmm1 |
1654 | vaesenc 48(%rdx),%xmm1,%xmm1 |
1655 | vaesenc 64(%rdx),%xmm1,%xmm1 |
1656 | vaesenc 80(%rdx),%xmm1,%xmm1 |
1657 | vaesenc 96(%rdx),%xmm1,%xmm1 |
1658 | vaesenc 112(%rdx),%xmm1,%xmm1 |
1659 | vaesenc 128(%rdx),%xmm1,%xmm1 |
1660 | vaesenc 144(%rdx),%xmm1,%xmm1 |
1661 | vaesenclast 160(%rdx),%xmm1,%xmm1 |
1662 | |
1663 | vmovdqa %xmm1,(%rsi) |
1664 | |
1665 | .byte 0xf3,0xc3 |
1666 | .cfi_endproc |
1667 | .size aes128gcmsiv_ecb_enc_block,.-aes128gcmsiv_ecb_enc_block |
1668 | .globl aes256gcmsiv_aes_ks_enc_x1 |
1669 | .hidden aes256gcmsiv_aes_ks_enc_x1 |
1670 | .type aes256gcmsiv_aes_ks_enc_x1,@function |
1671 | .align 16 |
1672 | aes256gcmsiv_aes_ks_enc_x1: |
1673 | .cfi_startproc |
1674 | vmovdqa con1(%rip),%xmm0 |
1675 | vmovdqa mask(%rip),%xmm15 |
1676 | vmovdqa (%rdi),%xmm8 |
1677 | vmovdqa (%rcx),%xmm1 |
1678 | vmovdqa 16(%rcx),%xmm3 |
1679 | vpxor %xmm1,%xmm8,%xmm8 |
1680 | vaesenc %xmm3,%xmm8,%xmm8 |
1681 | vmovdqu %xmm1,(%rdx) |
1682 | vmovdqu %xmm3,16(%rdx) |
1683 | vpxor %xmm14,%xmm14,%xmm14 |
1684 | |
1685 | vpshufb %xmm15,%xmm3,%xmm2 |
1686 | vaesenclast %xmm0,%xmm2,%xmm2 |
1687 | vpslld $1,%xmm0,%xmm0 |
1688 | vpslldq $4,%xmm1,%xmm4 |
1689 | vpxor %xmm4,%xmm1,%xmm1 |
1690 | vpslldq $4,%xmm4,%xmm4 |
1691 | vpxor %xmm4,%xmm1,%xmm1 |
1692 | vpslldq $4,%xmm4,%xmm4 |
1693 | vpxor %xmm4,%xmm1,%xmm1 |
1694 | vpxor %xmm2,%xmm1,%xmm1 |
1695 | vaesenc %xmm1,%xmm8,%xmm8 |
1696 | vmovdqu %xmm1,32(%rdx) |
1697 | |
1698 | vpshufd $0xff,%xmm1,%xmm2 |
1699 | vaesenclast %xmm14,%xmm2,%xmm2 |
1700 | vpslldq $4,%xmm3,%xmm4 |
1701 | vpxor %xmm4,%xmm3,%xmm3 |
1702 | vpslldq $4,%xmm4,%xmm4 |
1703 | vpxor %xmm4,%xmm3,%xmm3 |
1704 | vpslldq $4,%xmm4,%xmm4 |
1705 | vpxor %xmm4,%xmm3,%xmm3 |
1706 | vpxor %xmm2,%xmm3,%xmm3 |
1707 | vaesenc %xmm3,%xmm8,%xmm8 |
1708 | vmovdqu %xmm3,48(%rdx) |
1709 | |
1710 | vpshufb %xmm15,%xmm3,%xmm2 |
1711 | vaesenclast %xmm0,%xmm2,%xmm2 |
1712 | vpslld $1,%xmm0,%xmm0 |
1713 | vpslldq $4,%xmm1,%xmm4 |
1714 | vpxor %xmm4,%xmm1,%xmm1 |
1715 | vpslldq $4,%xmm4,%xmm4 |
1716 | vpxor %xmm4,%xmm1,%xmm1 |
1717 | vpslldq $4,%xmm4,%xmm4 |
1718 | vpxor %xmm4,%xmm1,%xmm1 |
1719 | vpxor %xmm2,%xmm1,%xmm1 |
1720 | vaesenc %xmm1,%xmm8,%xmm8 |
1721 | vmovdqu %xmm1,64(%rdx) |
1722 | |
1723 | vpshufd $0xff,%xmm1,%xmm2 |
1724 | vaesenclast %xmm14,%xmm2,%xmm2 |
1725 | vpslldq $4,%xmm3,%xmm4 |
1726 | vpxor %xmm4,%xmm3,%xmm3 |
1727 | vpslldq $4,%xmm4,%xmm4 |
1728 | vpxor %xmm4,%xmm3,%xmm3 |
1729 | vpslldq $4,%xmm4,%xmm4 |
1730 | vpxor %xmm4,%xmm3,%xmm3 |
1731 | vpxor %xmm2,%xmm3,%xmm3 |
1732 | vaesenc %xmm3,%xmm8,%xmm8 |
1733 | vmovdqu %xmm3,80(%rdx) |
1734 | |
1735 | vpshufb %xmm15,%xmm3,%xmm2 |
1736 | vaesenclast %xmm0,%xmm2,%xmm2 |
1737 | vpslld $1,%xmm0,%xmm0 |
1738 | vpslldq $4,%xmm1,%xmm4 |
1739 | vpxor %xmm4,%xmm1,%xmm1 |
1740 | vpslldq $4,%xmm4,%xmm4 |
1741 | vpxor %xmm4,%xmm1,%xmm1 |
1742 | vpslldq $4,%xmm4,%xmm4 |
1743 | vpxor %xmm4,%xmm1,%xmm1 |
1744 | vpxor %xmm2,%xmm1,%xmm1 |
1745 | vaesenc %xmm1,%xmm8,%xmm8 |
1746 | vmovdqu %xmm1,96(%rdx) |
1747 | |
1748 | vpshufd $0xff,%xmm1,%xmm2 |
1749 | vaesenclast %xmm14,%xmm2,%xmm2 |
1750 | vpslldq $4,%xmm3,%xmm4 |
1751 | vpxor %xmm4,%xmm3,%xmm3 |
1752 | vpslldq $4,%xmm4,%xmm4 |
1753 | vpxor %xmm4,%xmm3,%xmm3 |
1754 | vpslldq $4,%xmm4,%xmm4 |
1755 | vpxor %xmm4,%xmm3,%xmm3 |
1756 | vpxor %xmm2,%xmm3,%xmm3 |
1757 | vaesenc %xmm3,%xmm8,%xmm8 |
1758 | vmovdqu %xmm3,112(%rdx) |
1759 | |
1760 | vpshufb %xmm15,%xmm3,%xmm2 |
1761 | vaesenclast %xmm0,%xmm2,%xmm2 |
1762 | vpslld $1,%xmm0,%xmm0 |
1763 | vpslldq $4,%xmm1,%xmm4 |
1764 | vpxor %xmm4,%xmm1,%xmm1 |
1765 | vpslldq $4,%xmm4,%xmm4 |
1766 | vpxor %xmm4,%xmm1,%xmm1 |
1767 | vpslldq $4,%xmm4,%xmm4 |
1768 | vpxor %xmm4,%xmm1,%xmm1 |
1769 | vpxor %xmm2,%xmm1,%xmm1 |
1770 | vaesenc %xmm1,%xmm8,%xmm8 |
1771 | vmovdqu %xmm1,128(%rdx) |
1772 | |
1773 | vpshufd $0xff,%xmm1,%xmm2 |
1774 | vaesenclast %xmm14,%xmm2,%xmm2 |
1775 | vpslldq $4,%xmm3,%xmm4 |
1776 | vpxor %xmm4,%xmm3,%xmm3 |
1777 | vpslldq $4,%xmm4,%xmm4 |
1778 | vpxor %xmm4,%xmm3,%xmm3 |
1779 | vpslldq $4,%xmm4,%xmm4 |
1780 | vpxor %xmm4,%xmm3,%xmm3 |
1781 | vpxor %xmm2,%xmm3,%xmm3 |
1782 | vaesenc %xmm3,%xmm8,%xmm8 |
1783 | vmovdqu %xmm3,144(%rdx) |
1784 | |
1785 | vpshufb %xmm15,%xmm3,%xmm2 |
1786 | vaesenclast %xmm0,%xmm2,%xmm2 |
1787 | vpslld $1,%xmm0,%xmm0 |
1788 | vpslldq $4,%xmm1,%xmm4 |
1789 | vpxor %xmm4,%xmm1,%xmm1 |
1790 | vpslldq $4,%xmm4,%xmm4 |
1791 | vpxor %xmm4,%xmm1,%xmm1 |
1792 | vpslldq $4,%xmm4,%xmm4 |
1793 | vpxor %xmm4,%xmm1,%xmm1 |
1794 | vpxor %xmm2,%xmm1,%xmm1 |
1795 | vaesenc %xmm1,%xmm8,%xmm8 |
1796 | vmovdqu %xmm1,160(%rdx) |
1797 | |
1798 | vpshufd $0xff,%xmm1,%xmm2 |
1799 | vaesenclast %xmm14,%xmm2,%xmm2 |
1800 | vpslldq $4,%xmm3,%xmm4 |
1801 | vpxor %xmm4,%xmm3,%xmm3 |
1802 | vpslldq $4,%xmm4,%xmm4 |
1803 | vpxor %xmm4,%xmm3,%xmm3 |
1804 | vpslldq $4,%xmm4,%xmm4 |
1805 | vpxor %xmm4,%xmm3,%xmm3 |
1806 | vpxor %xmm2,%xmm3,%xmm3 |
1807 | vaesenc %xmm3,%xmm8,%xmm8 |
1808 | vmovdqu %xmm3,176(%rdx) |
1809 | |
1810 | vpshufb %xmm15,%xmm3,%xmm2 |
1811 | vaesenclast %xmm0,%xmm2,%xmm2 |
1812 | vpslld $1,%xmm0,%xmm0 |
1813 | vpslldq $4,%xmm1,%xmm4 |
1814 | vpxor %xmm4,%xmm1,%xmm1 |
1815 | vpslldq $4,%xmm4,%xmm4 |
1816 | vpxor %xmm4,%xmm1,%xmm1 |
1817 | vpslldq $4,%xmm4,%xmm4 |
1818 | vpxor %xmm4,%xmm1,%xmm1 |
1819 | vpxor %xmm2,%xmm1,%xmm1 |
1820 | vaesenc %xmm1,%xmm8,%xmm8 |
1821 | vmovdqu %xmm1,192(%rdx) |
1822 | |
1823 | vpshufd $0xff,%xmm1,%xmm2 |
1824 | vaesenclast %xmm14,%xmm2,%xmm2 |
1825 | vpslldq $4,%xmm3,%xmm4 |
1826 | vpxor %xmm4,%xmm3,%xmm3 |
1827 | vpslldq $4,%xmm4,%xmm4 |
1828 | vpxor %xmm4,%xmm3,%xmm3 |
1829 | vpslldq $4,%xmm4,%xmm4 |
1830 | vpxor %xmm4,%xmm3,%xmm3 |
1831 | vpxor %xmm2,%xmm3,%xmm3 |
1832 | vaesenc %xmm3,%xmm8,%xmm8 |
1833 | vmovdqu %xmm3,208(%rdx) |
1834 | |
1835 | vpshufb %xmm15,%xmm3,%xmm2 |
1836 | vaesenclast %xmm0,%xmm2,%xmm2 |
1837 | vpslldq $4,%xmm1,%xmm4 |
1838 | vpxor %xmm4,%xmm1,%xmm1 |
1839 | vpslldq $4,%xmm4,%xmm4 |
1840 | vpxor %xmm4,%xmm1,%xmm1 |
1841 | vpslldq $4,%xmm4,%xmm4 |
1842 | vpxor %xmm4,%xmm1,%xmm1 |
1843 | vpxor %xmm2,%xmm1,%xmm1 |
1844 | vaesenclast %xmm1,%xmm8,%xmm8 |
1845 | vmovdqu %xmm1,224(%rdx) |
1846 | |
1847 | vmovdqa %xmm8,(%rsi) |
1848 | .byte 0xf3,0xc3 |
1849 | .cfi_endproc |
1850 | .size aes256gcmsiv_aes_ks_enc_x1,.-aes256gcmsiv_aes_ks_enc_x1 |
1851 | .globl aes256gcmsiv_ecb_enc_block |
1852 | .hidden aes256gcmsiv_ecb_enc_block |
1853 | .type aes256gcmsiv_ecb_enc_block,@function |
1854 | .align 16 |
1855 | aes256gcmsiv_ecb_enc_block: |
1856 | .cfi_startproc |
1857 | vmovdqa (%rdi),%xmm1 |
1858 | vpxor (%rdx),%xmm1,%xmm1 |
1859 | vaesenc 16(%rdx),%xmm1,%xmm1 |
1860 | vaesenc 32(%rdx),%xmm1,%xmm1 |
1861 | vaesenc 48(%rdx),%xmm1,%xmm1 |
1862 | vaesenc 64(%rdx),%xmm1,%xmm1 |
1863 | vaesenc 80(%rdx),%xmm1,%xmm1 |
1864 | vaesenc 96(%rdx),%xmm1,%xmm1 |
1865 | vaesenc 112(%rdx),%xmm1,%xmm1 |
1866 | vaesenc 128(%rdx),%xmm1,%xmm1 |
1867 | vaesenc 144(%rdx),%xmm1,%xmm1 |
1868 | vaesenc 160(%rdx),%xmm1,%xmm1 |
1869 | vaesenc 176(%rdx),%xmm1,%xmm1 |
1870 | vaesenc 192(%rdx),%xmm1,%xmm1 |
1871 | vaesenc 208(%rdx),%xmm1,%xmm1 |
1872 | vaesenclast 224(%rdx),%xmm1,%xmm1 |
1873 | vmovdqa %xmm1,(%rsi) |
1874 | .byte 0xf3,0xc3 |
1875 | .cfi_endproc |
1876 | .size aes256gcmsiv_ecb_enc_block,.-aes256gcmsiv_ecb_enc_block |
1877 | .globl aes256gcmsiv_enc_msg_x4 |
1878 | .hidden aes256gcmsiv_enc_msg_x4 |
1879 | .type aes256gcmsiv_enc_msg_x4,@function |
1880 | .align 16 |
1881 | aes256gcmsiv_enc_msg_x4: |
1882 | .cfi_startproc |
1883 | testq %r8,%r8 |
1884 | jnz .L256_enc_msg_x4_start |
1885 | .byte 0xf3,0xc3 |
1886 | |
1887 | .L256_enc_msg_x4_start: |
1888 | movq %r8,%r10 |
1889 | shrq $4,%r8 |
1890 | shlq $60,%r10 |
1891 | jz .L256_enc_msg_x4_start2 |
1892 | addq $1,%r8 |
1893 | |
1894 | .L256_enc_msg_x4_start2: |
1895 | movq %r8,%r10 |
1896 | shlq $62,%r10 |
1897 | shrq $62,%r10 |
1898 | |
1899 | |
1900 | vmovdqa (%rdx),%xmm15 |
1901 | vpor OR_MASK(%rip),%xmm15,%xmm15 |
1902 | |
1903 | vmovdqa four(%rip),%xmm4 |
1904 | vmovdqa %xmm15,%xmm0 |
1905 | vpaddd one(%rip),%xmm15,%xmm1 |
1906 | vpaddd two(%rip),%xmm15,%xmm2 |
1907 | vpaddd three(%rip),%xmm15,%xmm3 |
1908 | |
1909 | shrq $2,%r8 |
1910 | je .L256_enc_msg_x4_check_remainder |
1911 | |
1912 | subq $64,%rsi |
1913 | subq $64,%rdi |
1914 | |
1915 | .L256_enc_msg_x4_loop1: |
1916 | addq $64,%rsi |
1917 | addq $64,%rdi |
1918 | |
1919 | vmovdqa %xmm0,%xmm5 |
1920 | vmovdqa %xmm1,%xmm6 |
1921 | vmovdqa %xmm2,%xmm7 |
1922 | vmovdqa %xmm3,%xmm8 |
1923 | |
1924 | vpxor (%rcx),%xmm5,%xmm5 |
1925 | vpxor (%rcx),%xmm6,%xmm6 |
1926 | vpxor (%rcx),%xmm7,%xmm7 |
1927 | vpxor (%rcx),%xmm8,%xmm8 |
1928 | |
1929 | vmovdqu 16(%rcx),%xmm12 |
1930 | vaesenc %xmm12,%xmm5,%xmm5 |
1931 | vaesenc %xmm12,%xmm6,%xmm6 |
1932 | vaesenc %xmm12,%xmm7,%xmm7 |
1933 | vaesenc %xmm12,%xmm8,%xmm8 |
1934 | |
1935 | vpaddd %xmm4,%xmm0,%xmm0 |
1936 | vmovdqu 32(%rcx),%xmm12 |
1937 | vaesenc %xmm12,%xmm5,%xmm5 |
1938 | vaesenc %xmm12,%xmm6,%xmm6 |
1939 | vaesenc %xmm12,%xmm7,%xmm7 |
1940 | vaesenc %xmm12,%xmm8,%xmm8 |
1941 | |
1942 | vpaddd %xmm4,%xmm1,%xmm1 |
1943 | vmovdqu 48(%rcx),%xmm12 |
1944 | vaesenc %xmm12,%xmm5,%xmm5 |
1945 | vaesenc %xmm12,%xmm6,%xmm6 |
1946 | vaesenc %xmm12,%xmm7,%xmm7 |
1947 | vaesenc %xmm12,%xmm8,%xmm8 |
1948 | |
1949 | vpaddd %xmm4,%xmm2,%xmm2 |
1950 | vmovdqu 64(%rcx),%xmm12 |
1951 | vaesenc %xmm12,%xmm5,%xmm5 |
1952 | vaesenc %xmm12,%xmm6,%xmm6 |
1953 | vaesenc %xmm12,%xmm7,%xmm7 |
1954 | vaesenc %xmm12,%xmm8,%xmm8 |
1955 | |
1956 | vpaddd %xmm4,%xmm3,%xmm3 |
1957 | |
1958 | vmovdqu 80(%rcx),%xmm12 |
1959 | vaesenc %xmm12,%xmm5,%xmm5 |
1960 | vaesenc %xmm12,%xmm6,%xmm6 |
1961 | vaesenc %xmm12,%xmm7,%xmm7 |
1962 | vaesenc %xmm12,%xmm8,%xmm8 |
1963 | |
1964 | vmovdqu 96(%rcx),%xmm12 |
1965 | vaesenc %xmm12,%xmm5,%xmm5 |
1966 | vaesenc %xmm12,%xmm6,%xmm6 |
1967 | vaesenc %xmm12,%xmm7,%xmm7 |
1968 | vaesenc %xmm12,%xmm8,%xmm8 |
1969 | |
1970 | vmovdqu 112(%rcx),%xmm12 |
1971 | vaesenc %xmm12,%xmm5,%xmm5 |
1972 | vaesenc %xmm12,%xmm6,%xmm6 |
1973 | vaesenc %xmm12,%xmm7,%xmm7 |
1974 | vaesenc %xmm12,%xmm8,%xmm8 |
1975 | |
1976 | vmovdqu 128(%rcx),%xmm12 |
1977 | vaesenc %xmm12,%xmm5,%xmm5 |
1978 | vaesenc %xmm12,%xmm6,%xmm6 |
1979 | vaesenc %xmm12,%xmm7,%xmm7 |
1980 | vaesenc %xmm12,%xmm8,%xmm8 |
1981 | |
1982 | vmovdqu 144(%rcx),%xmm12 |
1983 | vaesenc %xmm12,%xmm5,%xmm5 |
1984 | vaesenc %xmm12,%xmm6,%xmm6 |
1985 | vaesenc %xmm12,%xmm7,%xmm7 |
1986 | vaesenc %xmm12,%xmm8,%xmm8 |
1987 | |
1988 | vmovdqu 160(%rcx),%xmm12 |
1989 | vaesenc %xmm12,%xmm5,%xmm5 |
1990 | vaesenc %xmm12,%xmm6,%xmm6 |
1991 | vaesenc %xmm12,%xmm7,%xmm7 |
1992 | vaesenc %xmm12,%xmm8,%xmm8 |
1993 | |
1994 | vmovdqu 176(%rcx),%xmm12 |
1995 | vaesenc %xmm12,%xmm5,%xmm5 |
1996 | vaesenc %xmm12,%xmm6,%xmm6 |
1997 | vaesenc %xmm12,%xmm7,%xmm7 |
1998 | vaesenc %xmm12,%xmm8,%xmm8 |
1999 | |
2000 | vmovdqu 192(%rcx),%xmm12 |
2001 | vaesenc %xmm12,%xmm5,%xmm5 |
2002 | vaesenc %xmm12,%xmm6,%xmm6 |
2003 | vaesenc %xmm12,%xmm7,%xmm7 |
2004 | vaesenc %xmm12,%xmm8,%xmm8 |
2005 | |
2006 | vmovdqu 208(%rcx),%xmm12 |
2007 | vaesenc %xmm12,%xmm5,%xmm5 |
2008 | vaesenc %xmm12,%xmm6,%xmm6 |
2009 | vaesenc %xmm12,%xmm7,%xmm7 |
2010 | vaesenc %xmm12,%xmm8,%xmm8 |
2011 | |
2012 | vmovdqu 224(%rcx),%xmm12 |
2013 | vaesenclast %xmm12,%xmm5,%xmm5 |
2014 | vaesenclast %xmm12,%xmm6,%xmm6 |
2015 | vaesenclast %xmm12,%xmm7,%xmm7 |
2016 | vaesenclast %xmm12,%xmm8,%xmm8 |
2017 | |
2018 | |
2019 | |
2020 | vpxor 0(%rdi),%xmm5,%xmm5 |
2021 | vpxor 16(%rdi),%xmm6,%xmm6 |
2022 | vpxor 32(%rdi),%xmm7,%xmm7 |
2023 | vpxor 48(%rdi),%xmm8,%xmm8 |
2024 | |
2025 | subq $1,%r8 |
2026 | |
2027 | vmovdqu %xmm5,0(%rsi) |
2028 | vmovdqu %xmm6,16(%rsi) |
2029 | vmovdqu %xmm7,32(%rsi) |
2030 | vmovdqu %xmm8,48(%rsi) |
2031 | |
2032 | jne .L256_enc_msg_x4_loop1 |
2033 | |
2034 | addq $64,%rsi |
2035 | addq $64,%rdi |
2036 | |
2037 | .L256_enc_msg_x4_check_remainder: |
2038 | cmpq $0,%r10 |
2039 | je .L256_enc_msg_x4_out |
2040 | |
2041 | .L256_enc_msg_x4_loop2: |
2042 | |
2043 | |
2044 | |
2045 | vmovdqa %xmm0,%xmm5 |
2046 | vpaddd one(%rip),%xmm0,%xmm0 |
2047 | vpxor (%rcx),%xmm5,%xmm5 |
2048 | vaesenc 16(%rcx),%xmm5,%xmm5 |
2049 | vaesenc 32(%rcx),%xmm5,%xmm5 |
2050 | vaesenc 48(%rcx),%xmm5,%xmm5 |
2051 | vaesenc 64(%rcx),%xmm5,%xmm5 |
2052 | vaesenc 80(%rcx),%xmm5,%xmm5 |
2053 | vaesenc 96(%rcx),%xmm5,%xmm5 |
2054 | vaesenc 112(%rcx),%xmm5,%xmm5 |
2055 | vaesenc 128(%rcx),%xmm5,%xmm5 |
2056 | vaesenc 144(%rcx),%xmm5,%xmm5 |
2057 | vaesenc 160(%rcx),%xmm5,%xmm5 |
2058 | vaesenc 176(%rcx),%xmm5,%xmm5 |
2059 | vaesenc 192(%rcx),%xmm5,%xmm5 |
2060 | vaesenc 208(%rcx),%xmm5,%xmm5 |
2061 | vaesenclast 224(%rcx),%xmm5,%xmm5 |
2062 | |
2063 | |
2064 | vpxor (%rdi),%xmm5,%xmm5 |
2065 | |
2066 | vmovdqu %xmm5,(%rsi) |
2067 | |
2068 | addq $16,%rdi |
2069 | addq $16,%rsi |
2070 | |
2071 | subq $1,%r10 |
2072 | jne .L256_enc_msg_x4_loop2 |
2073 | |
2074 | .L256_enc_msg_x4_out: |
2075 | .byte 0xf3,0xc3 |
2076 | .cfi_endproc |
2077 | .size aes256gcmsiv_enc_msg_x4,.-aes256gcmsiv_enc_msg_x4 |
2078 | .globl aes256gcmsiv_enc_msg_x8 |
2079 | .hidden aes256gcmsiv_enc_msg_x8 |
2080 | .type aes256gcmsiv_enc_msg_x8,@function |
2081 | .align 16 |
2082 | aes256gcmsiv_enc_msg_x8: |
2083 | .cfi_startproc |
2084 | testq %r8,%r8 |
2085 | jnz .L256_enc_msg_x8_start |
2086 | .byte 0xf3,0xc3 |
2087 | |
2088 | .L256_enc_msg_x8_start: |
2089 | |
2090 | movq %rsp,%r11 |
2091 | subq $16,%r11 |
2092 | andq $-64,%r11 |
2093 | |
2094 | movq %r8,%r10 |
2095 | shrq $4,%r8 |
2096 | shlq $60,%r10 |
2097 | jz .L256_enc_msg_x8_start2 |
2098 | addq $1,%r8 |
2099 | |
2100 | .L256_enc_msg_x8_start2: |
2101 | movq %r8,%r10 |
2102 | shlq $61,%r10 |
2103 | shrq $61,%r10 |
2104 | |
2105 | |
2106 | vmovdqa (%rdx),%xmm1 |
2107 | vpor OR_MASK(%rip),%xmm1,%xmm1 |
2108 | |
2109 | |
2110 | vpaddd seven(%rip),%xmm1,%xmm0 |
2111 | vmovdqa %xmm0,(%r11) |
2112 | vpaddd one(%rip),%xmm1,%xmm9 |
2113 | vpaddd two(%rip),%xmm1,%xmm10 |
2114 | vpaddd three(%rip),%xmm1,%xmm11 |
2115 | vpaddd four(%rip),%xmm1,%xmm12 |
2116 | vpaddd five(%rip),%xmm1,%xmm13 |
2117 | vpaddd six(%rip),%xmm1,%xmm14 |
2118 | vmovdqa %xmm1,%xmm0 |
2119 | |
2120 | shrq $3,%r8 |
2121 | jz .L256_enc_msg_x8_check_remainder |
2122 | |
2123 | subq $128,%rsi |
2124 | subq $128,%rdi |
2125 | |
2126 | .L256_enc_msg_x8_loop1: |
2127 | addq $128,%rsi |
2128 | addq $128,%rdi |
2129 | |
2130 | vmovdqa %xmm0,%xmm1 |
2131 | vmovdqa %xmm9,%xmm2 |
2132 | vmovdqa %xmm10,%xmm3 |
2133 | vmovdqa %xmm11,%xmm4 |
2134 | vmovdqa %xmm12,%xmm5 |
2135 | vmovdqa %xmm13,%xmm6 |
2136 | vmovdqa %xmm14,%xmm7 |
2137 | |
2138 | vmovdqa (%r11),%xmm8 |
2139 | |
2140 | vpxor (%rcx),%xmm1,%xmm1 |
2141 | vpxor (%rcx),%xmm2,%xmm2 |
2142 | vpxor (%rcx),%xmm3,%xmm3 |
2143 | vpxor (%rcx),%xmm4,%xmm4 |
2144 | vpxor (%rcx),%xmm5,%xmm5 |
2145 | vpxor (%rcx),%xmm6,%xmm6 |
2146 | vpxor (%rcx),%xmm7,%xmm7 |
2147 | vpxor (%rcx),%xmm8,%xmm8 |
2148 | |
2149 | vmovdqu 16(%rcx),%xmm15 |
2150 | vaesenc %xmm15,%xmm1,%xmm1 |
2151 | vaesenc %xmm15,%xmm2,%xmm2 |
2152 | vaesenc %xmm15,%xmm3,%xmm3 |
2153 | vaesenc %xmm15,%xmm4,%xmm4 |
2154 | vaesenc %xmm15,%xmm5,%xmm5 |
2155 | vaesenc %xmm15,%xmm6,%xmm6 |
2156 | vaesenc %xmm15,%xmm7,%xmm7 |
2157 | vaesenc %xmm15,%xmm8,%xmm8 |
2158 | |
2159 | vmovdqa (%r11),%xmm14 |
2160 | vpaddd eight(%rip),%xmm14,%xmm14 |
2161 | vmovdqa %xmm14,(%r11) |
2162 | vmovdqu 32(%rcx),%xmm15 |
2163 | vaesenc %xmm15,%xmm1,%xmm1 |
2164 | vaesenc %xmm15,%xmm2,%xmm2 |
2165 | vaesenc %xmm15,%xmm3,%xmm3 |
2166 | vaesenc %xmm15,%xmm4,%xmm4 |
2167 | vaesenc %xmm15,%xmm5,%xmm5 |
2168 | vaesenc %xmm15,%xmm6,%xmm6 |
2169 | vaesenc %xmm15,%xmm7,%xmm7 |
2170 | vaesenc %xmm15,%xmm8,%xmm8 |
2171 | |
2172 | vpsubd one(%rip),%xmm14,%xmm14 |
2173 | vmovdqu 48(%rcx),%xmm15 |
2174 | vaesenc %xmm15,%xmm1,%xmm1 |
2175 | vaesenc %xmm15,%xmm2,%xmm2 |
2176 | vaesenc %xmm15,%xmm3,%xmm3 |
2177 | vaesenc %xmm15,%xmm4,%xmm4 |
2178 | vaesenc %xmm15,%xmm5,%xmm5 |
2179 | vaesenc %xmm15,%xmm6,%xmm6 |
2180 | vaesenc %xmm15,%xmm7,%xmm7 |
2181 | vaesenc %xmm15,%xmm8,%xmm8 |
2182 | |
2183 | vpaddd eight(%rip),%xmm0,%xmm0 |
2184 | vmovdqu 64(%rcx),%xmm15 |
2185 | vaesenc %xmm15,%xmm1,%xmm1 |
2186 | vaesenc %xmm15,%xmm2,%xmm2 |
2187 | vaesenc %xmm15,%xmm3,%xmm3 |
2188 | vaesenc %xmm15,%xmm4,%xmm4 |
2189 | vaesenc %xmm15,%xmm5,%xmm5 |
2190 | vaesenc %xmm15,%xmm6,%xmm6 |
2191 | vaesenc %xmm15,%xmm7,%xmm7 |
2192 | vaesenc %xmm15,%xmm8,%xmm8 |
2193 | |
2194 | vpaddd eight(%rip),%xmm9,%xmm9 |
2195 | vmovdqu 80(%rcx),%xmm15 |
2196 | vaesenc %xmm15,%xmm1,%xmm1 |
2197 | vaesenc %xmm15,%xmm2,%xmm2 |
2198 | vaesenc %xmm15,%xmm3,%xmm3 |
2199 | vaesenc %xmm15,%xmm4,%xmm4 |
2200 | vaesenc %xmm15,%xmm5,%xmm5 |
2201 | vaesenc %xmm15,%xmm6,%xmm6 |
2202 | vaesenc %xmm15,%xmm7,%xmm7 |
2203 | vaesenc %xmm15,%xmm8,%xmm8 |
2204 | |
2205 | vpaddd eight(%rip),%xmm10,%xmm10 |
2206 | vmovdqu 96(%rcx),%xmm15 |
2207 | vaesenc %xmm15,%xmm1,%xmm1 |
2208 | vaesenc %xmm15,%xmm2,%xmm2 |
2209 | vaesenc %xmm15,%xmm3,%xmm3 |
2210 | vaesenc %xmm15,%xmm4,%xmm4 |
2211 | vaesenc %xmm15,%xmm5,%xmm5 |
2212 | vaesenc %xmm15,%xmm6,%xmm6 |
2213 | vaesenc %xmm15,%xmm7,%xmm7 |
2214 | vaesenc %xmm15,%xmm8,%xmm8 |
2215 | |
2216 | vpaddd eight(%rip),%xmm11,%xmm11 |
2217 | vmovdqu 112(%rcx),%xmm15 |
2218 | vaesenc %xmm15,%xmm1,%xmm1 |
2219 | vaesenc %xmm15,%xmm2,%xmm2 |
2220 | vaesenc %xmm15,%xmm3,%xmm3 |
2221 | vaesenc %xmm15,%xmm4,%xmm4 |
2222 | vaesenc %xmm15,%xmm5,%xmm5 |
2223 | vaesenc %xmm15,%xmm6,%xmm6 |
2224 | vaesenc %xmm15,%xmm7,%xmm7 |
2225 | vaesenc %xmm15,%xmm8,%xmm8 |
2226 | |
2227 | vpaddd eight(%rip),%xmm12,%xmm12 |
2228 | vmovdqu 128(%rcx),%xmm15 |
2229 | vaesenc %xmm15,%xmm1,%xmm1 |
2230 | vaesenc %xmm15,%xmm2,%xmm2 |
2231 | vaesenc %xmm15,%xmm3,%xmm3 |
2232 | vaesenc %xmm15,%xmm4,%xmm4 |
2233 | vaesenc %xmm15,%xmm5,%xmm5 |
2234 | vaesenc %xmm15,%xmm6,%xmm6 |
2235 | vaesenc %xmm15,%xmm7,%xmm7 |
2236 | vaesenc %xmm15,%xmm8,%xmm8 |
2237 | |
2238 | vpaddd eight(%rip),%xmm13,%xmm13 |
2239 | vmovdqu 144(%rcx),%xmm15 |
2240 | vaesenc %xmm15,%xmm1,%xmm1 |
2241 | vaesenc %xmm15,%xmm2,%xmm2 |
2242 | vaesenc %xmm15,%xmm3,%xmm3 |
2243 | vaesenc %xmm15,%xmm4,%xmm4 |
2244 | vaesenc %xmm15,%xmm5,%xmm5 |
2245 | vaesenc %xmm15,%xmm6,%xmm6 |
2246 | vaesenc %xmm15,%xmm7,%xmm7 |
2247 | vaesenc %xmm15,%xmm8,%xmm8 |
2248 | |
2249 | vmovdqu 160(%rcx),%xmm15 |
2250 | vaesenc %xmm15,%xmm1,%xmm1 |
2251 | vaesenc %xmm15,%xmm2,%xmm2 |
2252 | vaesenc %xmm15,%xmm3,%xmm3 |
2253 | vaesenc %xmm15,%xmm4,%xmm4 |
2254 | vaesenc %xmm15,%xmm5,%xmm5 |
2255 | vaesenc %xmm15,%xmm6,%xmm6 |
2256 | vaesenc %xmm15,%xmm7,%xmm7 |
2257 | vaesenc %xmm15,%xmm8,%xmm8 |
2258 | |
2259 | vmovdqu 176(%rcx),%xmm15 |
2260 | vaesenc %xmm15,%xmm1,%xmm1 |
2261 | vaesenc %xmm15,%xmm2,%xmm2 |
2262 | vaesenc %xmm15,%xmm3,%xmm3 |
2263 | vaesenc %xmm15,%xmm4,%xmm4 |
2264 | vaesenc %xmm15,%xmm5,%xmm5 |
2265 | vaesenc %xmm15,%xmm6,%xmm6 |
2266 | vaesenc %xmm15,%xmm7,%xmm7 |
2267 | vaesenc %xmm15,%xmm8,%xmm8 |
2268 | |
2269 | vmovdqu 192(%rcx),%xmm15 |
2270 | vaesenc %xmm15,%xmm1,%xmm1 |
2271 | vaesenc %xmm15,%xmm2,%xmm2 |
2272 | vaesenc %xmm15,%xmm3,%xmm3 |
2273 | vaesenc %xmm15,%xmm4,%xmm4 |
2274 | vaesenc %xmm15,%xmm5,%xmm5 |
2275 | vaesenc %xmm15,%xmm6,%xmm6 |
2276 | vaesenc %xmm15,%xmm7,%xmm7 |
2277 | vaesenc %xmm15,%xmm8,%xmm8 |
2278 | |
2279 | vmovdqu 208(%rcx),%xmm15 |
2280 | vaesenc %xmm15,%xmm1,%xmm1 |
2281 | vaesenc %xmm15,%xmm2,%xmm2 |
2282 | vaesenc %xmm15,%xmm3,%xmm3 |
2283 | vaesenc %xmm15,%xmm4,%xmm4 |
2284 | vaesenc %xmm15,%xmm5,%xmm5 |
2285 | vaesenc %xmm15,%xmm6,%xmm6 |
2286 | vaesenc %xmm15,%xmm7,%xmm7 |
2287 | vaesenc %xmm15,%xmm8,%xmm8 |
2288 | |
2289 | vmovdqu 224(%rcx),%xmm15 |
2290 | vaesenclast %xmm15,%xmm1,%xmm1 |
2291 | vaesenclast %xmm15,%xmm2,%xmm2 |
2292 | vaesenclast %xmm15,%xmm3,%xmm3 |
2293 | vaesenclast %xmm15,%xmm4,%xmm4 |
2294 | vaesenclast %xmm15,%xmm5,%xmm5 |
2295 | vaesenclast %xmm15,%xmm6,%xmm6 |
2296 | vaesenclast %xmm15,%xmm7,%xmm7 |
2297 | vaesenclast %xmm15,%xmm8,%xmm8 |
2298 | |
2299 | |
2300 | |
2301 | vpxor 0(%rdi),%xmm1,%xmm1 |
2302 | vpxor 16(%rdi),%xmm2,%xmm2 |
2303 | vpxor 32(%rdi),%xmm3,%xmm3 |
2304 | vpxor 48(%rdi),%xmm4,%xmm4 |
2305 | vpxor 64(%rdi),%xmm5,%xmm5 |
2306 | vpxor 80(%rdi),%xmm6,%xmm6 |
2307 | vpxor 96(%rdi),%xmm7,%xmm7 |
2308 | vpxor 112(%rdi),%xmm8,%xmm8 |
2309 | |
2310 | subq $1,%r8 |
2311 | |
2312 | vmovdqu %xmm1,0(%rsi) |
2313 | vmovdqu %xmm2,16(%rsi) |
2314 | vmovdqu %xmm3,32(%rsi) |
2315 | vmovdqu %xmm4,48(%rsi) |
2316 | vmovdqu %xmm5,64(%rsi) |
2317 | vmovdqu %xmm6,80(%rsi) |
2318 | vmovdqu %xmm7,96(%rsi) |
2319 | vmovdqu %xmm8,112(%rsi) |
2320 | |
2321 | jne .L256_enc_msg_x8_loop1 |
2322 | |
2323 | addq $128,%rsi |
2324 | addq $128,%rdi |
2325 | |
2326 | .L256_enc_msg_x8_check_remainder: |
2327 | cmpq $0,%r10 |
2328 | je .L256_enc_msg_x8_out |
2329 | |
2330 | .L256_enc_msg_x8_loop2: |
2331 | |
2332 | |
2333 | vmovdqa %xmm0,%xmm1 |
2334 | vpaddd one(%rip),%xmm0,%xmm0 |
2335 | |
2336 | vpxor (%rcx),%xmm1,%xmm1 |
2337 | vaesenc 16(%rcx),%xmm1,%xmm1 |
2338 | vaesenc 32(%rcx),%xmm1,%xmm1 |
2339 | vaesenc 48(%rcx),%xmm1,%xmm1 |
2340 | vaesenc 64(%rcx),%xmm1,%xmm1 |
2341 | vaesenc 80(%rcx),%xmm1,%xmm1 |
2342 | vaesenc 96(%rcx),%xmm1,%xmm1 |
2343 | vaesenc 112(%rcx),%xmm1,%xmm1 |
2344 | vaesenc 128(%rcx),%xmm1,%xmm1 |
2345 | vaesenc 144(%rcx),%xmm1,%xmm1 |
2346 | vaesenc 160(%rcx),%xmm1,%xmm1 |
2347 | vaesenc 176(%rcx),%xmm1,%xmm1 |
2348 | vaesenc 192(%rcx),%xmm1,%xmm1 |
2349 | vaesenc 208(%rcx),%xmm1,%xmm1 |
2350 | vaesenclast 224(%rcx),%xmm1,%xmm1 |
2351 | |
2352 | |
2353 | vpxor (%rdi),%xmm1,%xmm1 |
2354 | |
2355 | vmovdqu %xmm1,(%rsi) |
2356 | |
2357 | addq $16,%rdi |
2358 | addq $16,%rsi |
2359 | subq $1,%r10 |
2360 | jnz .L256_enc_msg_x8_loop2 |
2361 | |
2362 | .L256_enc_msg_x8_out: |
2363 | .byte 0xf3,0xc3 |
2364 | |
2365 | .cfi_endproc |
2366 | .size aes256gcmsiv_enc_msg_x8,.-aes256gcmsiv_enc_msg_x8 |
2367 | .globl aes256gcmsiv_dec |
2368 | .hidden aes256gcmsiv_dec |
2369 | .type aes256gcmsiv_dec,@function |
2370 | .align 16 |
2371 | aes256gcmsiv_dec: |
2372 | .cfi_startproc |
2373 | testq $~15,%r9 |
2374 | jnz .L256_dec_start |
2375 | .byte 0xf3,0xc3 |
2376 | |
2377 | .L256_dec_start: |
2378 | vzeroupper |
2379 | vmovdqa (%rdx),%xmm0 |
2380 | movq %rdx,%rax |
2381 | |
2382 | leaq 32(%rax),%rax |
2383 | leaq 32(%rcx),%rcx |
2384 | |
2385 | |
2386 | vmovdqu (%rdi,%r9,1),%xmm15 |
2387 | vpor OR_MASK(%rip),%xmm15,%xmm15 |
2388 | andq $~15,%r9 |
2389 | |
2390 | |
2391 | cmpq $96,%r9 |
2392 | jb .L256_dec_loop2 |
2393 | |
2394 | |
2395 | subq $96,%r9 |
2396 | vmovdqa %xmm15,%xmm7 |
2397 | vpaddd one(%rip),%xmm7,%xmm8 |
2398 | vpaddd two(%rip),%xmm7,%xmm9 |
2399 | vpaddd one(%rip),%xmm9,%xmm10 |
2400 | vpaddd two(%rip),%xmm9,%xmm11 |
2401 | vpaddd one(%rip),%xmm11,%xmm12 |
2402 | vpaddd two(%rip),%xmm11,%xmm15 |
2403 | |
2404 | vpxor (%r8),%xmm7,%xmm7 |
2405 | vpxor (%r8),%xmm8,%xmm8 |
2406 | vpxor (%r8),%xmm9,%xmm9 |
2407 | vpxor (%r8),%xmm10,%xmm10 |
2408 | vpxor (%r8),%xmm11,%xmm11 |
2409 | vpxor (%r8),%xmm12,%xmm12 |
2410 | |
2411 | vmovdqu 16(%r8),%xmm4 |
2412 | vaesenc %xmm4,%xmm7,%xmm7 |
2413 | vaesenc %xmm4,%xmm8,%xmm8 |
2414 | vaesenc %xmm4,%xmm9,%xmm9 |
2415 | vaesenc %xmm4,%xmm10,%xmm10 |
2416 | vaesenc %xmm4,%xmm11,%xmm11 |
2417 | vaesenc %xmm4,%xmm12,%xmm12 |
2418 | |
2419 | vmovdqu 32(%r8),%xmm4 |
2420 | vaesenc %xmm4,%xmm7,%xmm7 |
2421 | vaesenc %xmm4,%xmm8,%xmm8 |
2422 | vaesenc %xmm4,%xmm9,%xmm9 |
2423 | vaesenc %xmm4,%xmm10,%xmm10 |
2424 | vaesenc %xmm4,%xmm11,%xmm11 |
2425 | vaesenc %xmm4,%xmm12,%xmm12 |
2426 | |
2427 | vmovdqu 48(%r8),%xmm4 |
2428 | vaesenc %xmm4,%xmm7,%xmm7 |
2429 | vaesenc %xmm4,%xmm8,%xmm8 |
2430 | vaesenc %xmm4,%xmm9,%xmm9 |
2431 | vaesenc %xmm4,%xmm10,%xmm10 |
2432 | vaesenc %xmm4,%xmm11,%xmm11 |
2433 | vaesenc %xmm4,%xmm12,%xmm12 |
2434 | |
2435 | vmovdqu 64(%r8),%xmm4 |
2436 | vaesenc %xmm4,%xmm7,%xmm7 |
2437 | vaesenc %xmm4,%xmm8,%xmm8 |
2438 | vaesenc %xmm4,%xmm9,%xmm9 |
2439 | vaesenc %xmm4,%xmm10,%xmm10 |
2440 | vaesenc %xmm4,%xmm11,%xmm11 |
2441 | vaesenc %xmm4,%xmm12,%xmm12 |
2442 | |
2443 | vmovdqu 80(%r8),%xmm4 |
2444 | vaesenc %xmm4,%xmm7,%xmm7 |
2445 | vaesenc %xmm4,%xmm8,%xmm8 |
2446 | vaesenc %xmm4,%xmm9,%xmm9 |
2447 | vaesenc %xmm4,%xmm10,%xmm10 |
2448 | vaesenc %xmm4,%xmm11,%xmm11 |
2449 | vaesenc %xmm4,%xmm12,%xmm12 |
2450 | |
2451 | vmovdqu 96(%r8),%xmm4 |
2452 | vaesenc %xmm4,%xmm7,%xmm7 |
2453 | vaesenc %xmm4,%xmm8,%xmm8 |
2454 | vaesenc %xmm4,%xmm9,%xmm9 |
2455 | vaesenc %xmm4,%xmm10,%xmm10 |
2456 | vaesenc %xmm4,%xmm11,%xmm11 |
2457 | vaesenc %xmm4,%xmm12,%xmm12 |
2458 | |
2459 | vmovdqu 112(%r8),%xmm4 |
2460 | vaesenc %xmm4,%xmm7,%xmm7 |
2461 | vaesenc %xmm4,%xmm8,%xmm8 |
2462 | vaesenc %xmm4,%xmm9,%xmm9 |
2463 | vaesenc %xmm4,%xmm10,%xmm10 |
2464 | vaesenc %xmm4,%xmm11,%xmm11 |
2465 | vaesenc %xmm4,%xmm12,%xmm12 |
2466 | |
2467 | vmovdqu 128(%r8),%xmm4 |
2468 | vaesenc %xmm4,%xmm7,%xmm7 |
2469 | vaesenc %xmm4,%xmm8,%xmm8 |
2470 | vaesenc %xmm4,%xmm9,%xmm9 |
2471 | vaesenc %xmm4,%xmm10,%xmm10 |
2472 | vaesenc %xmm4,%xmm11,%xmm11 |
2473 | vaesenc %xmm4,%xmm12,%xmm12 |
2474 | |
2475 | vmovdqu 144(%r8),%xmm4 |
2476 | vaesenc %xmm4,%xmm7,%xmm7 |
2477 | vaesenc %xmm4,%xmm8,%xmm8 |
2478 | vaesenc %xmm4,%xmm9,%xmm9 |
2479 | vaesenc %xmm4,%xmm10,%xmm10 |
2480 | vaesenc %xmm4,%xmm11,%xmm11 |
2481 | vaesenc %xmm4,%xmm12,%xmm12 |
2482 | |
2483 | vmovdqu 160(%r8),%xmm4 |
2484 | vaesenc %xmm4,%xmm7,%xmm7 |
2485 | vaesenc %xmm4,%xmm8,%xmm8 |
2486 | vaesenc %xmm4,%xmm9,%xmm9 |
2487 | vaesenc %xmm4,%xmm10,%xmm10 |
2488 | vaesenc %xmm4,%xmm11,%xmm11 |
2489 | vaesenc %xmm4,%xmm12,%xmm12 |
2490 | |
2491 | vmovdqu 176(%r8),%xmm4 |
2492 | vaesenc %xmm4,%xmm7,%xmm7 |
2493 | vaesenc %xmm4,%xmm8,%xmm8 |
2494 | vaesenc %xmm4,%xmm9,%xmm9 |
2495 | vaesenc %xmm4,%xmm10,%xmm10 |
2496 | vaesenc %xmm4,%xmm11,%xmm11 |
2497 | vaesenc %xmm4,%xmm12,%xmm12 |
2498 | |
2499 | vmovdqu 192(%r8),%xmm4 |
2500 | vaesenc %xmm4,%xmm7,%xmm7 |
2501 | vaesenc %xmm4,%xmm8,%xmm8 |
2502 | vaesenc %xmm4,%xmm9,%xmm9 |
2503 | vaesenc %xmm4,%xmm10,%xmm10 |
2504 | vaesenc %xmm4,%xmm11,%xmm11 |
2505 | vaesenc %xmm4,%xmm12,%xmm12 |
2506 | |
2507 | vmovdqu 208(%r8),%xmm4 |
2508 | vaesenc %xmm4,%xmm7,%xmm7 |
2509 | vaesenc %xmm4,%xmm8,%xmm8 |
2510 | vaesenc %xmm4,%xmm9,%xmm9 |
2511 | vaesenc %xmm4,%xmm10,%xmm10 |
2512 | vaesenc %xmm4,%xmm11,%xmm11 |
2513 | vaesenc %xmm4,%xmm12,%xmm12 |
2514 | |
2515 | vmovdqu 224(%r8),%xmm4 |
2516 | vaesenclast %xmm4,%xmm7,%xmm7 |
2517 | vaesenclast %xmm4,%xmm8,%xmm8 |
2518 | vaesenclast %xmm4,%xmm9,%xmm9 |
2519 | vaesenclast %xmm4,%xmm10,%xmm10 |
2520 | vaesenclast %xmm4,%xmm11,%xmm11 |
2521 | vaesenclast %xmm4,%xmm12,%xmm12 |
2522 | |
2523 | |
2524 | vpxor 0(%rdi),%xmm7,%xmm7 |
2525 | vpxor 16(%rdi),%xmm8,%xmm8 |
2526 | vpxor 32(%rdi),%xmm9,%xmm9 |
2527 | vpxor 48(%rdi),%xmm10,%xmm10 |
2528 | vpxor 64(%rdi),%xmm11,%xmm11 |
2529 | vpxor 80(%rdi),%xmm12,%xmm12 |
2530 | |
2531 | vmovdqu %xmm7,0(%rsi) |
2532 | vmovdqu %xmm8,16(%rsi) |
2533 | vmovdqu %xmm9,32(%rsi) |
2534 | vmovdqu %xmm10,48(%rsi) |
2535 | vmovdqu %xmm11,64(%rsi) |
2536 | vmovdqu %xmm12,80(%rsi) |
2537 | |
2538 | addq $96,%rdi |
2539 | addq $96,%rsi |
2540 | jmp .L256_dec_loop1 |
2541 | |
2542 | |
2543 | .align 64 |
2544 | .L256_dec_loop1: |
2545 | cmpq $96,%r9 |
2546 | jb .L256_dec_finish_96 |
2547 | subq $96,%r9 |
2548 | |
2549 | vmovdqa %xmm12,%xmm6 |
2550 | vmovdqa %xmm11,16-32(%rax) |
2551 | vmovdqa %xmm10,32-32(%rax) |
2552 | vmovdqa %xmm9,48-32(%rax) |
2553 | vmovdqa %xmm8,64-32(%rax) |
2554 | vmovdqa %xmm7,80-32(%rax) |
2555 | |
2556 | vmovdqa %xmm15,%xmm7 |
2557 | vpaddd one(%rip),%xmm7,%xmm8 |
2558 | vpaddd two(%rip),%xmm7,%xmm9 |
2559 | vpaddd one(%rip),%xmm9,%xmm10 |
2560 | vpaddd two(%rip),%xmm9,%xmm11 |
2561 | vpaddd one(%rip),%xmm11,%xmm12 |
2562 | vpaddd two(%rip),%xmm11,%xmm15 |
2563 | |
2564 | vmovdqa (%r8),%xmm4 |
2565 | vpxor %xmm4,%xmm7,%xmm7 |
2566 | vpxor %xmm4,%xmm8,%xmm8 |
2567 | vpxor %xmm4,%xmm9,%xmm9 |
2568 | vpxor %xmm4,%xmm10,%xmm10 |
2569 | vpxor %xmm4,%xmm11,%xmm11 |
2570 | vpxor %xmm4,%xmm12,%xmm12 |
2571 | |
2572 | vmovdqu 0-32(%rcx),%xmm4 |
2573 | vpclmulqdq $0x11,%xmm4,%xmm6,%xmm2 |
2574 | vpclmulqdq $0x00,%xmm4,%xmm6,%xmm3 |
2575 | vpclmulqdq $0x01,%xmm4,%xmm6,%xmm1 |
2576 | vpclmulqdq $0x10,%xmm4,%xmm6,%xmm4 |
2577 | vpxor %xmm4,%xmm1,%xmm1 |
2578 | |
2579 | vmovdqu 16(%r8),%xmm4 |
2580 | vaesenc %xmm4,%xmm7,%xmm7 |
2581 | vaesenc %xmm4,%xmm8,%xmm8 |
2582 | vaesenc %xmm4,%xmm9,%xmm9 |
2583 | vaesenc %xmm4,%xmm10,%xmm10 |
2584 | vaesenc %xmm4,%xmm11,%xmm11 |
2585 | vaesenc %xmm4,%xmm12,%xmm12 |
2586 | |
2587 | vmovdqu -16(%rax),%xmm6 |
2588 | vmovdqu -16(%rcx),%xmm13 |
2589 | |
2590 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2591 | vpxor %xmm4,%xmm1,%xmm1 |
2592 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2593 | vpxor %xmm4,%xmm2,%xmm2 |
2594 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2595 | vpxor %xmm4,%xmm3,%xmm3 |
2596 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2597 | vpxor %xmm4,%xmm1,%xmm1 |
2598 | |
2599 | |
2600 | vmovdqu 32(%r8),%xmm4 |
2601 | vaesenc %xmm4,%xmm7,%xmm7 |
2602 | vaesenc %xmm4,%xmm8,%xmm8 |
2603 | vaesenc %xmm4,%xmm9,%xmm9 |
2604 | vaesenc %xmm4,%xmm10,%xmm10 |
2605 | vaesenc %xmm4,%xmm11,%xmm11 |
2606 | vaesenc %xmm4,%xmm12,%xmm12 |
2607 | |
2608 | vmovdqu 0(%rax),%xmm6 |
2609 | vmovdqu 0(%rcx),%xmm13 |
2610 | |
2611 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2612 | vpxor %xmm4,%xmm1,%xmm1 |
2613 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2614 | vpxor %xmm4,%xmm2,%xmm2 |
2615 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2616 | vpxor %xmm4,%xmm3,%xmm3 |
2617 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2618 | vpxor %xmm4,%xmm1,%xmm1 |
2619 | |
2620 | |
2621 | vmovdqu 48(%r8),%xmm4 |
2622 | vaesenc %xmm4,%xmm7,%xmm7 |
2623 | vaesenc %xmm4,%xmm8,%xmm8 |
2624 | vaesenc %xmm4,%xmm9,%xmm9 |
2625 | vaesenc %xmm4,%xmm10,%xmm10 |
2626 | vaesenc %xmm4,%xmm11,%xmm11 |
2627 | vaesenc %xmm4,%xmm12,%xmm12 |
2628 | |
2629 | vmovdqu 16(%rax),%xmm6 |
2630 | vmovdqu 16(%rcx),%xmm13 |
2631 | |
2632 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2633 | vpxor %xmm4,%xmm1,%xmm1 |
2634 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2635 | vpxor %xmm4,%xmm2,%xmm2 |
2636 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2637 | vpxor %xmm4,%xmm3,%xmm3 |
2638 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2639 | vpxor %xmm4,%xmm1,%xmm1 |
2640 | |
2641 | |
2642 | vmovdqu 64(%r8),%xmm4 |
2643 | vaesenc %xmm4,%xmm7,%xmm7 |
2644 | vaesenc %xmm4,%xmm8,%xmm8 |
2645 | vaesenc %xmm4,%xmm9,%xmm9 |
2646 | vaesenc %xmm4,%xmm10,%xmm10 |
2647 | vaesenc %xmm4,%xmm11,%xmm11 |
2648 | vaesenc %xmm4,%xmm12,%xmm12 |
2649 | |
2650 | vmovdqu 32(%rax),%xmm6 |
2651 | vmovdqu 32(%rcx),%xmm13 |
2652 | |
2653 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2654 | vpxor %xmm4,%xmm1,%xmm1 |
2655 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2656 | vpxor %xmm4,%xmm2,%xmm2 |
2657 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2658 | vpxor %xmm4,%xmm3,%xmm3 |
2659 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2660 | vpxor %xmm4,%xmm1,%xmm1 |
2661 | |
2662 | |
2663 | vmovdqu 80(%r8),%xmm4 |
2664 | vaesenc %xmm4,%xmm7,%xmm7 |
2665 | vaesenc %xmm4,%xmm8,%xmm8 |
2666 | vaesenc %xmm4,%xmm9,%xmm9 |
2667 | vaesenc %xmm4,%xmm10,%xmm10 |
2668 | vaesenc %xmm4,%xmm11,%xmm11 |
2669 | vaesenc %xmm4,%xmm12,%xmm12 |
2670 | |
2671 | vmovdqu 96(%r8),%xmm4 |
2672 | vaesenc %xmm4,%xmm7,%xmm7 |
2673 | vaesenc %xmm4,%xmm8,%xmm8 |
2674 | vaesenc %xmm4,%xmm9,%xmm9 |
2675 | vaesenc %xmm4,%xmm10,%xmm10 |
2676 | vaesenc %xmm4,%xmm11,%xmm11 |
2677 | vaesenc %xmm4,%xmm12,%xmm12 |
2678 | |
2679 | vmovdqu 112(%r8),%xmm4 |
2680 | vaesenc %xmm4,%xmm7,%xmm7 |
2681 | vaesenc %xmm4,%xmm8,%xmm8 |
2682 | vaesenc %xmm4,%xmm9,%xmm9 |
2683 | vaesenc %xmm4,%xmm10,%xmm10 |
2684 | vaesenc %xmm4,%xmm11,%xmm11 |
2685 | vaesenc %xmm4,%xmm12,%xmm12 |
2686 | |
2687 | |
2688 | vmovdqa 80-32(%rax),%xmm6 |
2689 | vpxor %xmm0,%xmm6,%xmm6 |
2690 | vmovdqu 80-32(%rcx),%xmm5 |
2691 | |
2692 | vpclmulqdq $0x01,%xmm5,%xmm6,%xmm4 |
2693 | vpxor %xmm4,%xmm1,%xmm1 |
2694 | vpclmulqdq $0x11,%xmm5,%xmm6,%xmm4 |
2695 | vpxor %xmm4,%xmm2,%xmm2 |
2696 | vpclmulqdq $0x00,%xmm5,%xmm6,%xmm4 |
2697 | vpxor %xmm4,%xmm3,%xmm3 |
2698 | vpclmulqdq $0x10,%xmm5,%xmm6,%xmm4 |
2699 | vpxor %xmm4,%xmm1,%xmm1 |
2700 | |
2701 | vmovdqu 128(%r8),%xmm4 |
2702 | vaesenc %xmm4,%xmm7,%xmm7 |
2703 | vaesenc %xmm4,%xmm8,%xmm8 |
2704 | vaesenc %xmm4,%xmm9,%xmm9 |
2705 | vaesenc %xmm4,%xmm10,%xmm10 |
2706 | vaesenc %xmm4,%xmm11,%xmm11 |
2707 | vaesenc %xmm4,%xmm12,%xmm12 |
2708 | |
2709 | |
2710 | vpsrldq $8,%xmm1,%xmm4 |
2711 | vpxor %xmm4,%xmm2,%xmm5 |
2712 | vpslldq $8,%xmm1,%xmm4 |
2713 | vpxor %xmm4,%xmm3,%xmm0 |
2714 | |
2715 | vmovdqa poly(%rip),%xmm3 |
2716 | |
2717 | vmovdqu 144(%r8),%xmm4 |
2718 | vaesenc %xmm4,%xmm7,%xmm7 |
2719 | vaesenc %xmm4,%xmm8,%xmm8 |
2720 | vaesenc %xmm4,%xmm9,%xmm9 |
2721 | vaesenc %xmm4,%xmm10,%xmm10 |
2722 | vaesenc %xmm4,%xmm11,%xmm11 |
2723 | vaesenc %xmm4,%xmm12,%xmm12 |
2724 | |
2725 | vmovdqu 160(%r8),%xmm4 |
2726 | vaesenc %xmm4,%xmm7,%xmm7 |
2727 | vaesenc %xmm4,%xmm8,%xmm8 |
2728 | vaesenc %xmm4,%xmm9,%xmm9 |
2729 | vaesenc %xmm4,%xmm10,%xmm10 |
2730 | vaesenc %xmm4,%xmm11,%xmm11 |
2731 | vaesenc %xmm4,%xmm12,%xmm12 |
2732 | |
2733 | vmovdqu 176(%r8),%xmm4 |
2734 | vaesenc %xmm4,%xmm7,%xmm7 |
2735 | vaesenc %xmm4,%xmm8,%xmm8 |
2736 | vaesenc %xmm4,%xmm9,%xmm9 |
2737 | vaesenc %xmm4,%xmm10,%xmm10 |
2738 | vaesenc %xmm4,%xmm11,%xmm11 |
2739 | vaesenc %xmm4,%xmm12,%xmm12 |
2740 | |
2741 | vmovdqu 192(%r8),%xmm4 |
2742 | vaesenc %xmm4,%xmm7,%xmm7 |
2743 | vaesenc %xmm4,%xmm8,%xmm8 |
2744 | vaesenc %xmm4,%xmm9,%xmm9 |
2745 | vaesenc %xmm4,%xmm10,%xmm10 |
2746 | vaesenc %xmm4,%xmm11,%xmm11 |
2747 | vaesenc %xmm4,%xmm12,%xmm12 |
2748 | |
2749 | vmovdqu 208(%r8),%xmm4 |
2750 | vaesenc %xmm4,%xmm7,%xmm7 |
2751 | vaesenc %xmm4,%xmm8,%xmm8 |
2752 | vaesenc %xmm4,%xmm9,%xmm9 |
2753 | vaesenc %xmm4,%xmm10,%xmm10 |
2754 | vaesenc %xmm4,%xmm11,%xmm11 |
2755 | vaesenc %xmm4,%xmm12,%xmm12 |
2756 | |
2757 | vmovdqu 224(%r8),%xmm6 |
2758 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
2759 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
2760 | vpxor %xmm0,%xmm2,%xmm0 |
2761 | |
2762 | vpxor 0(%rdi),%xmm6,%xmm4 |
2763 | vaesenclast %xmm4,%xmm7,%xmm7 |
2764 | vpxor 16(%rdi),%xmm6,%xmm4 |
2765 | vaesenclast %xmm4,%xmm8,%xmm8 |
2766 | vpxor 32(%rdi),%xmm6,%xmm4 |
2767 | vaesenclast %xmm4,%xmm9,%xmm9 |
2768 | vpxor 48(%rdi),%xmm6,%xmm4 |
2769 | vaesenclast %xmm4,%xmm10,%xmm10 |
2770 | vpxor 64(%rdi),%xmm6,%xmm4 |
2771 | vaesenclast %xmm4,%xmm11,%xmm11 |
2772 | vpxor 80(%rdi),%xmm6,%xmm4 |
2773 | vaesenclast %xmm4,%xmm12,%xmm12 |
2774 | |
2775 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
2776 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
2777 | vpxor %xmm0,%xmm2,%xmm0 |
2778 | |
2779 | vmovdqu %xmm7,0(%rsi) |
2780 | vmovdqu %xmm8,16(%rsi) |
2781 | vmovdqu %xmm9,32(%rsi) |
2782 | vmovdqu %xmm10,48(%rsi) |
2783 | vmovdqu %xmm11,64(%rsi) |
2784 | vmovdqu %xmm12,80(%rsi) |
2785 | |
2786 | vpxor %xmm5,%xmm0,%xmm0 |
2787 | |
2788 | leaq 96(%rdi),%rdi |
2789 | leaq 96(%rsi),%rsi |
2790 | jmp .L256_dec_loop1 |
2791 | |
2792 | .L256_dec_finish_96: |
2793 | vmovdqa %xmm12,%xmm6 |
2794 | vmovdqa %xmm11,16-32(%rax) |
2795 | vmovdqa %xmm10,32-32(%rax) |
2796 | vmovdqa %xmm9,48-32(%rax) |
2797 | vmovdqa %xmm8,64-32(%rax) |
2798 | vmovdqa %xmm7,80-32(%rax) |
2799 | |
2800 | vmovdqu 0-32(%rcx),%xmm4 |
2801 | vpclmulqdq $0x10,%xmm4,%xmm6,%xmm1 |
2802 | vpclmulqdq $0x11,%xmm4,%xmm6,%xmm2 |
2803 | vpclmulqdq $0x00,%xmm4,%xmm6,%xmm3 |
2804 | vpclmulqdq $0x01,%xmm4,%xmm6,%xmm4 |
2805 | vpxor %xmm4,%xmm1,%xmm1 |
2806 | |
2807 | vmovdqu -16(%rax),%xmm6 |
2808 | vmovdqu -16(%rcx),%xmm13 |
2809 | |
2810 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2811 | vpxor %xmm4,%xmm1,%xmm1 |
2812 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2813 | vpxor %xmm4,%xmm2,%xmm2 |
2814 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2815 | vpxor %xmm4,%xmm3,%xmm3 |
2816 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2817 | vpxor %xmm4,%xmm1,%xmm1 |
2818 | |
2819 | vmovdqu 0(%rax),%xmm6 |
2820 | vmovdqu 0(%rcx),%xmm13 |
2821 | |
2822 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2823 | vpxor %xmm4,%xmm1,%xmm1 |
2824 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2825 | vpxor %xmm4,%xmm2,%xmm2 |
2826 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2827 | vpxor %xmm4,%xmm3,%xmm3 |
2828 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2829 | vpxor %xmm4,%xmm1,%xmm1 |
2830 | |
2831 | vmovdqu 16(%rax),%xmm6 |
2832 | vmovdqu 16(%rcx),%xmm13 |
2833 | |
2834 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2835 | vpxor %xmm4,%xmm1,%xmm1 |
2836 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2837 | vpxor %xmm4,%xmm2,%xmm2 |
2838 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2839 | vpxor %xmm4,%xmm3,%xmm3 |
2840 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2841 | vpxor %xmm4,%xmm1,%xmm1 |
2842 | |
2843 | vmovdqu 32(%rax),%xmm6 |
2844 | vmovdqu 32(%rcx),%xmm13 |
2845 | |
2846 | vpclmulqdq $0x10,%xmm13,%xmm6,%xmm4 |
2847 | vpxor %xmm4,%xmm1,%xmm1 |
2848 | vpclmulqdq $0x11,%xmm13,%xmm6,%xmm4 |
2849 | vpxor %xmm4,%xmm2,%xmm2 |
2850 | vpclmulqdq $0x00,%xmm13,%xmm6,%xmm4 |
2851 | vpxor %xmm4,%xmm3,%xmm3 |
2852 | vpclmulqdq $0x01,%xmm13,%xmm6,%xmm4 |
2853 | vpxor %xmm4,%xmm1,%xmm1 |
2854 | |
2855 | |
2856 | vmovdqu 80-32(%rax),%xmm6 |
2857 | vpxor %xmm0,%xmm6,%xmm6 |
2858 | vmovdqu 80-32(%rcx),%xmm5 |
2859 | vpclmulqdq $0x11,%xmm5,%xmm6,%xmm4 |
2860 | vpxor %xmm4,%xmm2,%xmm2 |
2861 | vpclmulqdq $0x00,%xmm5,%xmm6,%xmm4 |
2862 | vpxor %xmm4,%xmm3,%xmm3 |
2863 | vpclmulqdq $0x10,%xmm5,%xmm6,%xmm4 |
2864 | vpxor %xmm4,%xmm1,%xmm1 |
2865 | vpclmulqdq $0x01,%xmm5,%xmm6,%xmm4 |
2866 | vpxor %xmm4,%xmm1,%xmm1 |
2867 | |
2868 | vpsrldq $8,%xmm1,%xmm4 |
2869 | vpxor %xmm4,%xmm2,%xmm5 |
2870 | vpslldq $8,%xmm1,%xmm4 |
2871 | vpxor %xmm4,%xmm3,%xmm0 |
2872 | |
2873 | vmovdqa poly(%rip),%xmm3 |
2874 | |
2875 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
2876 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
2877 | vpxor %xmm0,%xmm2,%xmm0 |
2878 | |
2879 | vpalignr $8,%xmm0,%xmm0,%xmm2 |
2880 | vpclmulqdq $0x10,%xmm3,%xmm0,%xmm0 |
2881 | vpxor %xmm0,%xmm2,%xmm0 |
2882 | |
2883 | vpxor %xmm5,%xmm0,%xmm0 |
2884 | |
2885 | .L256_dec_loop2: |
2886 | |
2887 | |
2888 | |
2889 | cmpq $16,%r9 |
2890 | jb .L256_dec_out |
2891 | subq $16,%r9 |
2892 | |
2893 | vmovdqa %xmm15,%xmm2 |
2894 | vpaddd one(%rip),%xmm15,%xmm15 |
2895 | |
2896 | vpxor 0(%r8),%xmm2,%xmm2 |
2897 | vaesenc 16(%r8),%xmm2,%xmm2 |
2898 | vaesenc 32(%r8),%xmm2,%xmm2 |
2899 | vaesenc 48(%r8),%xmm2,%xmm2 |
2900 | vaesenc 64(%r8),%xmm2,%xmm2 |
2901 | vaesenc 80(%r8),%xmm2,%xmm2 |
2902 | vaesenc 96(%r8),%xmm2,%xmm2 |
2903 | vaesenc 112(%r8),%xmm2,%xmm2 |
2904 | vaesenc 128(%r8),%xmm2,%xmm2 |
2905 | vaesenc 144(%r8),%xmm2,%xmm2 |
2906 | vaesenc 160(%r8),%xmm2,%xmm2 |
2907 | vaesenc 176(%r8),%xmm2,%xmm2 |
2908 | vaesenc 192(%r8),%xmm2,%xmm2 |
2909 | vaesenc 208(%r8),%xmm2,%xmm2 |
2910 | vaesenclast 224(%r8),%xmm2,%xmm2 |
2911 | vpxor (%rdi),%xmm2,%xmm2 |
2912 | vmovdqu %xmm2,(%rsi) |
2913 | addq $16,%rdi |
2914 | addq $16,%rsi |
2915 | |
2916 | vpxor %xmm2,%xmm0,%xmm0 |
2917 | vmovdqa -32(%rcx),%xmm1 |
2918 | call GFMUL |
2919 | |
2920 | jmp .L256_dec_loop2 |
2921 | |
2922 | .L256_dec_out: |
2923 | vmovdqu %xmm0,(%rdx) |
2924 | .byte 0xf3,0xc3 |
2925 | .cfi_endproc |
2926 | .size aes256gcmsiv_dec, .-aes256gcmsiv_dec |
2927 | .globl aes256gcmsiv_kdf |
2928 | .hidden aes256gcmsiv_kdf |
2929 | .type aes256gcmsiv_kdf,@function |
2930 | .align 16 |
2931 | aes256gcmsiv_kdf: |
2932 | .cfi_startproc |
2933 | |
2934 | |
2935 | |
2936 | |
2937 | vmovdqa (%rdx),%xmm1 |
2938 | vmovdqa 0(%rdi),%xmm4 |
2939 | vmovdqa and_mask(%rip),%xmm11 |
2940 | vmovdqa one(%rip),%xmm8 |
2941 | vpshufd $0x90,%xmm4,%xmm4 |
2942 | vpand %xmm11,%xmm4,%xmm4 |
2943 | vpaddd %xmm8,%xmm4,%xmm6 |
2944 | vpaddd %xmm8,%xmm6,%xmm7 |
2945 | vpaddd %xmm8,%xmm7,%xmm11 |
2946 | vpaddd %xmm8,%xmm11,%xmm12 |
2947 | vpaddd %xmm8,%xmm12,%xmm13 |
2948 | |
2949 | vpxor %xmm1,%xmm4,%xmm4 |
2950 | vpxor %xmm1,%xmm6,%xmm6 |
2951 | vpxor %xmm1,%xmm7,%xmm7 |
2952 | vpxor %xmm1,%xmm11,%xmm11 |
2953 | vpxor %xmm1,%xmm12,%xmm12 |
2954 | vpxor %xmm1,%xmm13,%xmm13 |
2955 | |
2956 | vmovdqa 16(%rdx),%xmm1 |
2957 | vaesenc %xmm1,%xmm4,%xmm4 |
2958 | vaesenc %xmm1,%xmm6,%xmm6 |
2959 | vaesenc %xmm1,%xmm7,%xmm7 |
2960 | vaesenc %xmm1,%xmm11,%xmm11 |
2961 | vaesenc %xmm1,%xmm12,%xmm12 |
2962 | vaesenc %xmm1,%xmm13,%xmm13 |
2963 | |
2964 | vmovdqa 32(%rdx),%xmm2 |
2965 | vaesenc %xmm2,%xmm4,%xmm4 |
2966 | vaesenc %xmm2,%xmm6,%xmm6 |
2967 | vaesenc %xmm2,%xmm7,%xmm7 |
2968 | vaesenc %xmm2,%xmm11,%xmm11 |
2969 | vaesenc %xmm2,%xmm12,%xmm12 |
2970 | vaesenc %xmm2,%xmm13,%xmm13 |
2971 | |
2972 | vmovdqa 48(%rdx),%xmm1 |
2973 | vaesenc %xmm1,%xmm4,%xmm4 |
2974 | vaesenc %xmm1,%xmm6,%xmm6 |
2975 | vaesenc %xmm1,%xmm7,%xmm7 |
2976 | vaesenc %xmm1,%xmm11,%xmm11 |
2977 | vaesenc %xmm1,%xmm12,%xmm12 |
2978 | vaesenc %xmm1,%xmm13,%xmm13 |
2979 | |
2980 | vmovdqa 64(%rdx),%xmm2 |
2981 | vaesenc %xmm2,%xmm4,%xmm4 |
2982 | vaesenc %xmm2,%xmm6,%xmm6 |
2983 | vaesenc %xmm2,%xmm7,%xmm7 |
2984 | vaesenc %xmm2,%xmm11,%xmm11 |
2985 | vaesenc %xmm2,%xmm12,%xmm12 |
2986 | vaesenc %xmm2,%xmm13,%xmm13 |
2987 | |
2988 | vmovdqa 80(%rdx),%xmm1 |
2989 | vaesenc %xmm1,%xmm4,%xmm4 |
2990 | vaesenc %xmm1,%xmm6,%xmm6 |
2991 | vaesenc %xmm1,%xmm7,%xmm7 |
2992 | vaesenc %xmm1,%xmm11,%xmm11 |
2993 | vaesenc %xmm1,%xmm12,%xmm12 |
2994 | vaesenc %xmm1,%xmm13,%xmm13 |
2995 | |
2996 | vmovdqa 96(%rdx),%xmm2 |
2997 | vaesenc %xmm2,%xmm4,%xmm4 |
2998 | vaesenc %xmm2,%xmm6,%xmm6 |
2999 | vaesenc %xmm2,%xmm7,%xmm7 |
3000 | vaesenc %xmm2,%xmm11,%xmm11 |
3001 | vaesenc %xmm2,%xmm12,%xmm12 |
3002 | vaesenc %xmm2,%xmm13,%xmm13 |
3003 | |
3004 | vmovdqa 112(%rdx),%xmm1 |
3005 | vaesenc %xmm1,%xmm4,%xmm4 |
3006 | vaesenc %xmm1,%xmm6,%xmm6 |
3007 | vaesenc %xmm1,%xmm7,%xmm7 |
3008 | vaesenc %xmm1,%xmm11,%xmm11 |
3009 | vaesenc %xmm1,%xmm12,%xmm12 |
3010 | vaesenc %xmm1,%xmm13,%xmm13 |
3011 | |
3012 | vmovdqa 128(%rdx),%xmm2 |
3013 | vaesenc %xmm2,%xmm4,%xmm4 |
3014 | vaesenc %xmm2,%xmm6,%xmm6 |
3015 | vaesenc %xmm2,%xmm7,%xmm7 |
3016 | vaesenc %xmm2,%xmm11,%xmm11 |
3017 | vaesenc %xmm2,%xmm12,%xmm12 |
3018 | vaesenc %xmm2,%xmm13,%xmm13 |
3019 | |
3020 | vmovdqa 144(%rdx),%xmm1 |
3021 | vaesenc %xmm1,%xmm4,%xmm4 |
3022 | vaesenc %xmm1,%xmm6,%xmm6 |
3023 | vaesenc %xmm1,%xmm7,%xmm7 |
3024 | vaesenc %xmm1,%xmm11,%xmm11 |
3025 | vaesenc %xmm1,%xmm12,%xmm12 |
3026 | vaesenc %xmm1,%xmm13,%xmm13 |
3027 | |
3028 | vmovdqa 160(%rdx),%xmm2 |
3029 | vaesenc %xmm2,%xmm4,%xmm4 |
3030 | vaesenc %xmm2,%xmm6,%xmm6 |
3031 | vaesenc %xmm2,%xmm7,%xmm7 |
3032 | vaesenc %xmm2,%xmm11,%xmm11 |
3033 | vaesenc %xmm2,%xmm12,%xmm12 |
3034 | vaesenc %xmm2,%xmm13,%xmm13 |
3035 | |
3036 | vmovdqa 176(%rdx),%xmm1 |
3037 | vaesenc %xmm1,%xmm4,%xmm4 |
3038 | vaesenc %xmm1,%xmm6,%xmm6 |
3039 | vaesenc %xmm1,%xmm7,%xmm7 |
3040 | vaesenc %xmm1,%xmm11,%xmm11 |
3041 | vaesenc %xmm1,%xmm12,%xmm12 |
3042 | vaesenc %xmm1,%xmm13,%xmm13 |
3043 | |
3044 | vmovdqa 192(%rdx),%xmm2 |
3045 | vaesenc %xmm2,%xmm4,%xmm4 |
3046 | vaesenc %xmm2,%xmm6,%xmm6 |
3047 | vaesenc %xmm2,%xmm7,%xmm7 |
3048 | vaesenc %xmm2,%xmm11,%xmm11 |
3049 | vaesenc %xmm2,%xmm12,%xmm12 |
3050 | vaesenc %xmm2,%xmm13,%xmm13 |
3051 | |
3052 | vmovdqa 208(%rdx),%xmm1 |
3053 | vaesenc %xmm1,%xmm4,%xmm4 |
3054 | vaesenc %xmm1,%xmm6,%xmm6 |
3055 | vaesenc %xmm1,%xmm7,%xmm7 |
3056 | vaesenc %xmm1,%xmm11,%xmm11 |
3057 | vaesenc %xmm1,%xmm12,%xmm12 |
3058 | vaesenc %xmm1,%xmm13,%xmm13 |
3059 | |
3060 | vmovdqa 224(%rdx),%xmm2 |
3061 | vaesenclast %xmm2,%xmm4,%xmm4 |
3062 | vaesenclast %xmm2,%xmm6,%xmm6 |
3063 | vaesenclast %xmm2,%xmm7,%xmm7 |
3064 | vaesenclast %xmm2,%xmm11,%xmm11 |
3065 | vaesenclast %xmm2,%xmm12,%xmm12 |
3066 | vaesenclast %xmm2,%xmm13,%xmm13 |
3067 | |
3068 | |
3069 | vmovdqa %xmm4,0(%rsi) |
3070 | vmovdqa %xmm6,16(%rsi) |
3071 | vmovdqa %xmm7,32(%rsi) |
3072 | vmovdqa %xmm11,48(%rsi) |
3073 | vmovdqa %xmm12,64(%rsi) |
3074 | vmovdqa %xmm13,80(%rsi) |
3075 | .byte 0xf3,0xc3 |
3076 | .cfi_endproc |
3077 | .size aes256gcmsiv_kdf, .-aes256gcmsiv_kdf |
3078 | #endif |
3079 | |