2 * Implement AES algorithm in Intel AES-NI instructions.
4 * The white paper of AES-NI instructions can be downloaded from:
5 * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf
7 * Copyright (C) 2008, Intel Corp.
8 * Author: Huang Ying <ying.huang@intel.com>
9 * Vinodh Gopal <vinodh.gopal@intel.com>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
18 #include <linux/linkage.h>
47 pshufd $0b11111111, %xmm1, %xmm1
48 shufps $0b00010000, %xmm0, %xmm4
50 shufps $0b10001100, %xmm0, %xmm4
58 pshufd $0b01010101, %xmm1, %xmm1
59 shufps $0b00010000, %xmm0, %xmm4
61 shufps $0b10001100, %xmm0, %xmm4
68 pshufd $0b11111111, %xmm0, %xmm3
73 shufps $0b01000100, %xmm0, %xmm6
75 shufps $0b01001110, %xmm2, %xmm1
76 movaps %xmm1, 16(%rcx)
81 pshufd $0b01010101, %xmm1, %xmm1
82 shufps $0b00010000, %xmm0, %xmm4
84 shufps $0b10001100, %xmm0, %xmm4
90 pshufd $0b11111111, %xmm0, %xmm3
99 pshufd $0b10101010, %xmm1, %xmm1
100 shufps $0b00010000, %xmm2, %xmm4
102 shufps $0b10001100, %xmm2, %xmm4
110 * int aesni_set_key(struct crypto_aes_ctx *ctx, const u8 *in_key,
111 * unsigned int key_len)
114 movups (%rsi), %xmm0 # user key (first 16 bytes)
116 lea 0x10(%rdi), %rcx # key addr
118 pxor %xmm4, %xmm4 # xmm4 is assumed 0 in _key_expansion_x
122 movups 0x10(%rsi), %xmm2 # other user key
125 # aeskeygenassist $0x1, %xmm2, %xmm1 # round 1
126 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01
127 call _key_expansion_256a
128 # aeskeygenassist $0x1, %xmm0, %xmm1
129 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01
130 call _key_expansion_256b
131 # aeskeygenassist $0x2, %xmm2, %xmm1 # round 2
132 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02
133 call _key_expansion_256a
134 # aeskeygenassist $0x2, %xmm0, %xmm1
135 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02
136 call _key_expansion_256b
137 # aeskeygenassist $0x4, %xmm2, %xmm1 # round 3
138 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04
139 call _key_expansion_256a
140 # aeskeygenassist $0x4, %xmm0, %xmm1
141 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04
142 call _key_expansion_256b
143 # aeskeygenassist $0x8, %xmm2, %xmm1 # round 4
144 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08
145 call _key_expansion_256a
146 # aeskeygenassist $0x8, %xmm0, %xmm1
147 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08
148 call _key_expansion_256b
149 # aeskeygenassist $0x10, %xmm2, %xmm1 # round 5
150 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10
151 call _key_expansion_256a
152 # aeskeygenassist $0x10, %xmm0, %xmm1
153 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10
154 call _key_expansion_256b
155 # aeskeygenassist $0x20, %xmm2, %xmm1 # round 6
156 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20
157 call _key_expansion_256a
158 # aeskeygenassist $0x20, %xmm0, %xmm1
159 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20
160 call _key_expansion_256b
161 # aeskeygenassist $0x40, %xmm2, %xmm1 # round 7
162 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40
163 call _key_expansion_256a
166 movq 0x10(%rsi), %xmm2 # other user key
167 # aeskeygenassist $0x1, %xmm2, %xmm1 # round 1
168 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x01
169 call _key_expansion_192a
170 # aeskeygenassist $0x2, %xmm2, %xmm1 # round 2
171 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x02
172 call _key_expansion_192b
173 # aeskeygenassist $0x4, %xmm2, %xmm1 # round 3
174 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x04
175 call _key_expansion_192a
176 # aeskeygenassist $0x8, %xmm2, %xmm1 # round 4
177 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x08
178 call _key_expansion_192b
179 # aeskeygenassist $0x10, %xmm2, %xmm1 # round 5
180 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x10
181 call _key_expansion_192a
182 # aeskeygenassist $0x20, %xmm2, %xmm1 # round 6
183 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x20
184 call _key_expansion_192b
185 # aeskeygenassist $0x40, %xmm2, %xmm1 # round 7
186 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x40
187 call _key_expansion_192a
188 # aeskeygenassist $0x80, %xmm2, %xmm1 # round 8
189 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xca, 0x80
190 call _key_expansion_192b
193 # aeskeygenassist $0x1, %xmm0, %xmm1 # round 1
194 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x01
195 call _key_expansion_128
196 # aeskeygenassist $0x2, %xmm0, %xmm1 # round 2
197 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x02
198 call _key_expansion_128
199 # aeskeygenassist $0x4, %xmm0, %xmm1 # round 3
200 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x04
201 call _key_expansion_128
202 # aeskeygenassist $0x8, %xmm0, %xmm1 # round 4
203 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x08
204 call _key_expansion_128
205 # aeskeygenassist $0x10, %xmm0, %xmm1 # round 5
206 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x10
207 call _key_expansion_128
208 # aeskeygenassist $0x20, %xmm0, %xmm1 # round 6
209 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x20
210 call _key_expansion_128
211 # aeskeygenassist $0x40, %xmm0, %xmm1 # round 7
212 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x40
213 call _key_expansion_128
214 # aeskeygenassist $0x80, %xmm0, %xmm1 # round 8
215 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x80
216 call _key_expansion_128
217 # aeskeygenassist $0x1b, %xmm0, %xmm1 # round 9
218 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x1b
219 call _key_expansion_128
220 # aeskeygenassist $0x36, %xmm0, %xmm1 # round 10
221 .byte 0x66, 0x0f, 0x3a, 0xdf, 0xc8, 0x36
222 call _key_expansion_128
227 movaps %xmm0, 240(%rcx)
228 movaps %xmm1, 240(%rdi)
230 lea 240-16(%rcx), %rsi
234 # aesimc %xmm0, %xmm1
235 .byte 0x66, 0x0f, 0x38, 0xdb, 0xc8
245 * void aesni_enc(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
248 movl 480(KEYP), KLEN # key length
249 movups (INP), STATE # input
251 movups STATE, (OUTP) # output
255 * _aesni_enc1: internal ABI
257 * KEYP: key struct pointer
259 * STATE: initial state (input)
261 * STATE: finial state (output)
267 movaps (KEYP), KEY # key
269 pxor KEY, STATE # round 0
273 lea 0x20(TKEYP), TKEYP
276 movaps -0x60(TKEYP), KEY
278 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
279 movaps -0x50(TKEYP), KEY
281 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
284 movaps -0x40(TKEYP), KEY
286 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
287 movaps -0x30(TKEYP), KEY
289 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
292 movaps -0x20(TKEYP), KEY
294 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
295 movaps -0x10(TKEYP), KEY
297 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
300 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
301 movaps 0x10(TKEYP), KEY
303 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
304 movaps 0x20(TKEYP), KEY
306 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
307 movaps 0x30(TKEYP), KEY
309 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
310 movaps 0x40(TKEYP), KEY
312 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
313 movaps 0x50(TKEYP), KEY
315 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
316 movaps 0x60(TKEYP), KEY
318 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
319 movaps 0x70(TKEYP), KEY
320 # aesenclast KEY, STATE # last round
321 .byte 0x66, 0x0f, 0x38, 0xdd, 0xc2
325 * _aesni_enc4: internal ABI
327 * KEYP: key struct pointer
329 * STATE1: initial state (input)
334 * STATE1: finial state (output)
343 movaps (KEYP), KEY # key
345 pxor KEY, STATE1 # round 0
352 lea 0x20(TKEYP), TKEYP
355 movaps -0x60(TKEYP), KEY
357 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
359 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
361 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
363 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
364 movaps -0x50(TKEYP), KEY
366 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
368 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
370 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
372 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
375 movaps -0x40(TKEYP), KEY
377 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
379 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
381 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
383 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
384 movaps -0x30(TKEYP), KEY
386 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
388 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
390 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
392 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
395 movaps -0x20(TKEYP), KEY
397 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
399 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
401 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
403 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
404 movaps -0x10(TKEYP), KEY
406 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
408 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
410 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
412 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
415 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
417 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
419 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
421 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
422 movaps 0x10(TKEYP), KEY
424 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
426 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
428 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
430 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
431 movaps 0x20(TKEYP), KEY
433 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
435 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
437 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
439 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
440 movaps 0x30(TKEYP), KEY
442 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
444 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
446 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
448 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
449 movaps 0x40(TKEYP), KEY
451 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
453 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
455 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
457 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
458 movaps 0x50(TKEYP), KEY
460 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
462 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
464 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
466 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
467 movaps 0x60(TKEYP), KEY
469 .byte 0x66, 0x0f, 0x38, 0xdc, 0xc2
471 .byte 0x66, 0x0f, 0x38, 0xdc, 0xe2
473 .byte 0x66, 0x0f, 0x38, 0xdc, 0xea
475 .byte 0x66, 0x0f, 0x38, 0xdc, 0xf2
476 movaps 0x70(TKEYP), KEY
477 # aesenclast KEY, STATE1 # last round
478 .byte 0x66, 0x0f, 0x38, 0xdd, 0xc2
479 # aesenclast KEY, STATE2
480 .byte 0x66, 0x0f, 0x38, 0xdd, 0xe2
481 # aesenclast KEY, STATE3
482 .byte 0x66, 0x0f, 0x38, 0xdd, 0xea
483 # aesenclast KEY, STATE4
484 .byte 0x66, 0x0f, 0x38, 0xdd, 0xf2
488 * void aesni_dec (struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
491 mov 480(KEYP), KLEN # key length
493 movups (INP), STATE # input
495 movups STATE, (OUTP) #output
499 * _aesni_dec1: internal ABI
501 * KEYP: key struct pointer
503 * STATE: initial state (input)
505 * STATE: finial state (output)
511 movaps (KEYP), KEY # key
513 pxor KEY, STATE # round 0
517 lea 0x20(TKEYP), TKEYP
520 movaps -0x60(TKEYP), KEY
522 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
523 movaps -0x50(TKEYP), KEY
525 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
528 movaps -0x40(TKEYP), KEY
530 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
531 movaps -0x30(TKEYP), KEY
533 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
536 movaps -0x20(TKEYP), KEY
538 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
539 movaps -0x10(TKEYP), KEY
541 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
544 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
545 movaps 0x10(TKEYP), KEY
547 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
548 movaps 0x20(TKEYP), KEY
550 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
551 movaps 0x30(TKEYP), KEY
553 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
554 movaps 0x40(TKEYP), KEY
556 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
557 movaps 0x50(TKEYP), KEY
559 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
560 movaps 0x60(TKEYP), KEY
562 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
563 movaps 0x70(TKEYP), KEY
564 # aesdeclast KEY, STATE # last round
565 .byte 0x66, 0x0f, 0x38, 0xdf, 0xc2
569 * _aesni_dec4: internal ABI
571 * KEYP: key struct pointer
573 * STATE1: initial state (input)
578 * STATE1: finial state (output)
587 movaps (KEYP), KEY # key
589 pxor KEY, STATE1 # round 0
596 lea 0x20(TKEYP), TKEYP
599 movaps -0x60(TKEYP), KEY
601 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
603 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
605 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
607 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
608 movaps -0x50(TKEYP), KEY
610 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
612 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
614 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
616 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
619 movaps -0x40(TKEYP), KEY
621 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
623 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
625 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
627 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
628 movaps -0x30(TKEYP), KEY
630 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
632 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
634 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
636 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
639 movaps -0x20(TKEYP), KEY
641 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
643 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
645 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
647 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
648 movaps -0x10(TKEYP), KEY
650 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
652 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
654 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
656 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
659 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
661 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
663 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
665 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
666 movaps 0x10(TKEYP), KEY
668 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
670 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
672 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
674 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
675 movaps 0x20(TKEYP), KEY
677 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
679 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
681 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
683 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
684 movaps 0x30(TKEYP), KEY
686 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
688 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
690 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
692 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
693 movaps 0x40(TKEYP), KEY
695 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
697 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
699 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
701 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
702 movaps 0x50(TKEYP), KEY
704 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
706 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
708 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
710 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
711 movaps 0x60(TKEYP), KEY
713 .byte 0x66, 0x0f, 0x38, 0xde, 0xc2
715 .byte 0x66, 0x0f, 0x38, 0xde, 0xe2
717 .byte 0x66, 0x0f, 0x38, 0xde, 0xea
719 .byte 0x66, 0x0f, 0x38, 0xde, 0xf2
720 movaps 0x70(TKEYP), KEY
721 # aesdeclast KEY, STATE1 # last round
722 .byte 0x66, 0x0f, 0x38, 0xdf, 0xc2
723 # aesdeclast KEY, STATE2
724 .byte 0x66, 0x0f, 0x38, 0xdf, 0xe2
725 # aesdeclast KEY, STATE3
726 .byte 0x66, 0x0f, 0x38, 0xdf, 0xea
727 # aesdeclast KEY, STATE4
728 .byte 0x66, 0x0f, 0x38, 0xdf, 0xf2
732 * void aesni_ecb_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
736 test LEN, LEN # check length
746 movups 0x10(INP), STATE2
747 movups 0x20(INP), STATE3
748 movups 0x30(INP), STATE4
750 movups STATE1, (OUTP)
751 movups STATE2, 0x10(OUTP)
752 movups STATE3, 0x20(OUTP)
753 movups STATE4, 0x30(OUTP)
765 movups STATE1, (OUTP)
775 * void aesni_ecb_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
790 movups 0x10(INP), STATE2
791 movups 0x20(INP), STATE3
792 movups 0x30(INP), STATE4
794 movups STATE1, (OUTP)
795 movups STATE2, 0x10(OUTP)
796 movups STATE3, 0x20(OUTP)
797 movups STATE4, 0x30(OUTP)
809 movups STATE1, (OUTP)
819 * void aesni_cbc_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
820 * size_t len, u8 *iv)
826 movups (IVP), STATE # load iv as initial state
829 movups (INP), IN # load input
832 movups STATE, (OUTP) # store output
843 * void aesni_cbc_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
844 * size_t len, u8 *iv)
858 movups 0x10(INP), IN2
860 movups 0x20(INP), IN3
862 movups 0x30(INP), IN4
870 movups STATE1, (OUTP)
871 movups STATE2, 0x10(OUTP)
872 movups STATE3, 0x20(OUTP)
873 movups STATE4, 0x30(OUTP)