Debian Codegraph @

cipher/sha1-ssse3-amd64.S

raw
1 /* sha1-ssse3-amd64.S - Intel SSSE3 accelerated SHA-1 transform function
2 * Copyright (C) 2013 Jussi Kivilinna <[email protected]>
3 *
4 * Based on sha1.c:
5 * Copyright (C) 1998, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
6 *
7 * This file is part of Libgcrypt.
8 *
9 * Libgcrypt is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
13 *
14 * Libgcrypt is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
21 */
22
23 /*
24 * Intel SSSE3 accelerated SHA-1 implementation based on white paper:
25 * "Improving the Performance of the Secure Hash Algorithm (SHA-1)"
26 * http://software.intel.com/en-us/articles/improving-the-performance-of-the-secure-hash-algorithm-1
27 */
28
29 #ifdef __x86_64__
30 #include <config.h>
31
32 #if (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
33 defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS)) && \
34 defined(HAVE_GCC_INLINE_ASM_SSSE3) && defined(USE_SHA1)
35
36 #include "asm-common-amd64.h"
37
38
39 /* Context structure */
40
41 #define state_h0 0
42 #define state_h1 4
43 #define state_h2 8
44 #define state_h3 12
45 #define state_h4 16
46
47
48 /* Constants */
49
50 SECTION_RODATA
51
52 ELF(.type _sha1_ssse3_consts,@object)
53 _sha1_ssse3_consts:
54
55 #define K1 0x5A827999
56 #define K2 0x6ED9EBA1
57 #define K3 0x8F1BBCDC
58 #define K4 0xCA62C1D6
59 .align 16
60 .LK_XMM:
61 .LK1: .long K1, K1, K1, K1
62 .LK2: .long K2, K2, K2, K2
63 .LK3: .long K3, K3, K3, K3
64 .LK4: .long K4, K4, K4, K4
65
66 .Lbswap_shufb_ctl:
67 .long 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f
68
69
70 /* Register macros */
71
72 #define RSTATE %r8
73 #define RDATA %r9
74 #define ROLDSTACK %r10
75 #define RNBLKS %r11
76
77 #define a %eax
78 #define b %ebx
79 #define c %ecx
80 #define d %edx
81 #define e %edi
82
83 #define RT0 %esi
84 #define RT1 %ebp
85
86 #define Wtmp0 %xmm0
87 #define Wtmp1 %xmm1
88
89 #define W0 %xmm2
90 #define W1 %xmm3
91 #define W2 %xmm4
92 #define W3 %xmm5
93 #define W4 %xmm6
94 #define W5 %xmm7
95 #define W6 %xmm8
96 #define W7 %xmm9
97
98 #define BSWAP_REG %xmm10
99
100
101 /* Round function macros. */
102
103 #define WK(i) (((i) & 15) * 4)(%rsp)
104
105 #define R_F1(a,b,c,d,e,i) \
106 movl c, RT0; \
107 addl WK(i), e; \
108 xorl d, RT0; \
109 movl a, RT1; \
110 andl b, RT0; \
111 roll $30, b; \
112 xorl d, RT0; \
113 leal (RT0,e), e; \
114 roll $5, RT1; \
115 addl RT1, e;
116
117 #define R_F2(a,b,c,d,e,i) \
118 movl c, RT0; \
119 addl WK(i), e; \
120 xorl b, RT0; \
121 roll $30, b; \
122 xorl d, RT0; \
123 movl a, RT1; \
124 leal (RT0,e), e; \
125 roll $5, RT1; \
126 addl RT1, e;
127
128 #define R_F3(a,b,c,d,e,i) \
129 movl c, RT0; \
130 movl b, RT1; \
131 xorl b, RT0; \
132 andl c, RT1; \
133 andl d, RT0; \
134 addl RT1, e; \
135 addl WK(i), e; \
136 roll $30, b; \
137 movl a, RT1; \
138 leal (RT0,e), e; \
139 roll $5, RT1; \
140 addl RT1, e;
141
142 #define R_F4(a,b,c,d,e,i) R_F2(a,b,c,d,e,i)
143
144 #define R(a,b,c,d,e,f,i) \
145 R_##f(a,b,c,d,e,i)
146
147
148 /* Input expansion macros. */
149
150 #define W_PRECALC_00_15_0(i, W, tmp0) \
151 movdqu (4*(i))(RDATA), tmp0;
152
153 #define W_PRECALC_00_15_1(i, W, tmp0) \
154 pshufb BSWAP_REG, tmp0; \
155 movdqa tmp0, W;
156
157 #define W_PRECALC_00_15_2(i, W, tmp0) \
158 paddd (.LK_XMM + ((i)/20)*16) rRIP, tmp0;
159
160 #define W_PRECALC_00_15_3(i, W, tmp0) \
161 movdqa tmp0, WK(i&~3);
162
163 #define W_PRECALC_16_31_0(i, W, W_m04, W_m08, W_m12, W_m16, tmp0, tmp1) \
164 movdqa W_m12, W; \
165 palignr $8, W_m16, W; \
166 movdqa W_m04, tmp0; \
167 psrldq $4, tmp0; \
168 pxor W_m08, W;
169
170 #define W_PRECALC_16_31_1(i, W, W_m04, W_m08, W_m12, W_m16, tmp0, tmp1) \
171 pxor W_m16, tmp0; \
172 pxor tmp0, W; \
173 movdqa W, tmp1; \
174 movdqa W, tmp0; \
175 pslldq $12, tmp1;
176
177 #define W_PRECALC_16_31_2(i, W, W_m04, W_m08, W_m12, W_m16, tmp0, tmp1) \
178 psrld $31, W; \
179 pslld $1, tmp0; \
180 por W, tmp0; \
181 movdqa tmp1, W; \
182 psrld $30, tmp1; \
183 pslld $2, W;
184
185 #define W_PRECALC_16_31_3(i, W, W_m04, W_m08, W_m12, W_m16, tmp0, tmp1) \
186 pxor W, tmp0; \
187 pxor tmp1, tmp0; \
188 movdqa tmp0, W; \
189 paddd (.LK_XMM + ((i)/20)*16) rRIP, tmp0; \
190 movdqa tmp0, WK((i)&~3);
191
192 #define W_PRECALC_32_79_0(i, W, W_m04, W_m08, W_m12, W_m16, W_m20, W_m24, W_m28, tmp0) \
193 movdqa W_m04, tmp0; \
194 pxor W_m28, W; \
195 palignr $8, W_m08, tmp0;
196
197 #define W_PRECALC_32_79_1(i, W, W_m04, W_m08, W_m12, W_m16, W_m20, W_m24, W_m28, tmp0) \
198 pxor W_m16, W; \
199 pxor tmp0, W; \
200 movdqa W, tmp0;
201
202 #define W_PRECALC_32_79_2(i, W, W_m04, W_m08, W_m12, W_m16, W_m20, W_m24, W_m28, tmp0) \
203 psrld $30, W; \
204 pslld $2, tmp0; \
205 por W, tmp0;
206
207 #define W_PRECALC_32_79_3(i, W, W_m04, W_m08, W_m12, W_m16, W_m20, W_m24, W_m28, tmp0) \
208 movdqa tmp0, W; \
209 paddd (.LK_XMM + ((i)/20)*16) rRIP, tmp0; \
210 movdqa tmp0, WK((i)&~3);
211
212 #define CLEAR_REG(reg) pxor reg, reg;
213
214 .text
215
216 /*
217 * Transform nblks*64 bytes (nblks*16 32-bit words) at DATA.
218 *
219 * unsigned int
220 * _gcry_sha1_transform_amd64_ssse3 (void *ctx, const unsigned char *data,
221 * size_t nblks)
222 */
223 .globl _gcry_sha1_transform_amd64_ssse3
224 ELF(.type _gcry_sha1_transform_amd64_ssse3,@function)
225 .align 16
226 _gcry_sha1_transform_amd64_ssse3:
227 /* input:
228 * %rdi: ctx, CTX
229 * %rsi: data (64*nblks bytes)
230 * %rdx: nblks
231 */
232 CFI_STARTPROC();
233
234 xorl %eax, %eax;
235 cmpq $0, %rdx;
236 jz .Lret;
237
238 movq %rdx, RNBLKS;
239 movq %rdi, RSTATE;
240 movq %rsi, RDATA;
241 pushq %rbx;
242 CFI_PUSH(%rbx);
243 pushq %rbp;
244 CFI_PUSH(%rbp);
245
246 movq %rsp, ROLDSTACK;
247 CFI_DEF_CFA_REGISTER(ROLDSTACK);
248
249 subq $(16*4), %rsp;
250 andq $(~31), %rsp;
251
252 /* Get the values of the chaining variables. */
253 movl state_h0(RSTATE), a;
254 movl state_h1(RSTATE), b;
255 movl state_h2(RSTATE), c;
256 movl state_h3(RSTATE), d;
257 movl state_h4(RSTATE), e;
258
259 movdqa .Lbswap_shufb_ctl rRIP, BSWAP_REG;
260
261 /* Precalc 0-15. */
262 W_PRECALC_00_15_0(0, W0, Wtmp0);
263 W_PRECALC_00_15_1(1, W0, Wtmp0);
264 W_PRECALC_00_15_2(2, W0, Wtmp0);
265 W_PRECALC_00_15_3(3, W0, Wtmp0);
266 W_PRECALC_00_15_0(4, W7, Wtmp0);
267 W_PRECALC_00_15_1(5, W7, Wtmp0);
268 W_PRECALC_00_15_2(6, W7, Wtmp0);
269 W_PRECALC_00_15_3(7, W7, Wtmp0);
270 W_PRECALC_00_15_0(8, W6, Wtmp0);
271 W_PRECALC_00_15_1(9, W6, Wtmp0);
272 W_PRECALC_00_15_2(10, W6, Wtmp0);
273 W_PRECALC_00_15_3(11, W6, Wtmp0);
274 W_PRECALC_00_15_0(12, W5, Wtmp0);
275 W_PRECALC_00_15_1(13, W5, Wtmp0);
276 W_PRECALC_00_15_2(14, W5, Wtmp0);
277 W_PRECALC_00_15_3(15, W5, Wtmp0);
278
279 .align 8
280 .Loop:
281 addq $64, RDATA;
282
283 /* Transform 0-15 + Precalc 16-31. */
284 R( a, b, c, d, e, F1, 0 ); W_PRECALC_16_31_0(16, W4, W5, W6, W7, W0, Wtmp0, Wtmp1);
285 R( e, a, b, c, d, F1, 1 ); W_PRECALC_16_31_1(17, W4, W5, W6, W7, W0, Wtmp0, Wtmp1);
286 R( d, e, a, b, c, F1, 2 ); W_PRECALC_16_31_2(18, W4, W5, W6, W7, W0, Wtmp0, Wtmp1);
287 R( c, d, e, a, b, F1, 3 ); W_PRECALC_16_31_3(19, W4, W5, W6, W7, W0, Wtmp0, Wtmp1);
288 R( b, c, d, e, a, F1, 4 ); W_PRECALC_16_31_0(20, W3, W4, W5, W6, W7, Wtmp0, Wtmp1);
289 R( a, b, c, d, e, F1, 5 ); W_PRECALC_16_31_1(21, W3, W4, W5, W6, W7, Wtmp0, Wtmp1);
290 R( e, a, b, c, d, F1, 6 ); W_PRECALC_16_31_2(22, W3, W4, W5, W6, W7, Wtmp0, Wtmp1);
291 R( d, e, a, b, c, F1, 7 ); W_PRECALC_16_31_3(23, W3, W4, W5, W6, W7, Wtmp0, Wtmp1);
292 R( c, d, e, a, b, F1, 8 ); W_PRECALC_16_31_0(24, W2, W3, W4, W5, W6, Wtmp0, Wtmp1);
293 R( b, c, d, e, a, F1, 9 ); W_PRECALC_16_31_1(25, W2, W3, W4, W5, W6, Wtmp0, Wtmp1);
294 R( a, b, c, d, e, F1, 10 ); W_PRECALC_16_31_2(26, W2, W3, W4, W5, W6, Wtmp0, Wtmp1);
295 R( e, a, b, c, d, F1, 11 ); W_PRECALC_16_31_3(27, W2, W3, W4, W5, W6, Wtmp0, Wtmp1);
296 R( d, e, a, b, c, F1, 12 ); W_PRECALC_16_31_0(28, W1, W2, W3, W4, W5, Wtmp0, Wtmp1);
297 R( c, d, e, a, b, F1, 13 ); W_PRECALC_16_31_1(29, W1, W2, W3, W4, W5, Wtmp0, Wtmp1);
298 R( b, c, d, e, a, F1, 14 ); W_PRECALC_16_31_2(30, W1, W2, W3, W4, W5, Wtmp0, Wtmp1);
299 R( a, b, c, d, e, F1, 15 ); W_PRECALC_16_31_3(31, W1, W2, W3, W4, W5, Wtmp0, Wtmp1);
300
301 /* Transform 16-63 + Precalc 32-79. */
302 R( e, a, b, c, d, F1, 16 ); W_PRECALC_32_79_0(32, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
303 R( d, e, a, b, c, F1, 17 ); W_PRECALC_32_79_1(33, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
304 R( c, d, e, a, b, F1, 18 ); W_PRECALC_32_79_2(34, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
305 R( b, c, d, e, a, F1, 19 ); W_PRECALC_32_79_3(35, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
306 R( a, b, c, d, e, F2, 20 ); W_PRECALC_32_79_0(36, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
307 R( e, a, b, c, d, F2, 21 ); W_PRECALC_32_79_1(37, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
308 R( d, e, a, b, c, F2, 22 ); W_PRECALC_32_79_2(38, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
309 R( c, d, e, a, b, F2, 23 ); W_PRECALC_32_79_3(39, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
310 R( b, c, d, e, a, F2, 24 ); W_PRECALC_32_79_0(40, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
311 R( a, b, c, d, e, F2, 25 ); W_PRECALC_32_79_1(41, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
312 R( e, a, b, c, d, F2, 26 ); W_PRECALC_32_79_2(42, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
313 R( d, e, a, b, c, F2, 27 ); W_PRECALC_32_79_3(43, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
314 R( c, d, e, a, b, F2, 28 ); W_PRECALC_32_79_0(44, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
315 R( b, c, d, e, a, F2, 29 ); W_PRECALC_32_79_1(45, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
316 R( a, b, c, d, e, F2, 30 ); W_PRECALC_32_79_2(46, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
317 R( e, a, b, c, d, F2, 31 ); W_PRECALC_32_79_3(47, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
318 R( d, e, a, b, c, F2, 32 ); W_PRECALC_32_79_0(48, W4, W5, W6, W7, W0, W1, W2, W3, Wtmp0);
319 R( c, d, e, a, b, F2, 33 ); W_PRECALC_32_79_1(49, W4, W5, W6, W7, W0, W1, W2, W3, Wtmp0);
320 R( b, c, d, e, a, F2, 34 ); W_PRECALC_32_79_2(50, W4, W5, W6, W7, W0, W1, W2, W3, Wtmp0);
321 R( a, b, c, d, e, F2, 35 ); W_PRECALC_32_79_3(51, W4, W5, W6, W7, W0, W1, W2, W3, Wtmp0);
322 R( e, a, b, c, d, F2, 36 ); W_PRECALC_32_79_0(52, W3, W4, W5, W6, W7, W0, W1, W2, Wtmp0);
323 R( d, e, a, b, c, F2, 37 ); W_PRECALC_32_79_1(53, W3, W4, W5, W6, W7, W0, W1, W2, Wtmp0);
324 R( c, d, e, a, b, F2, 38 ); W_PRECALC_32_79_2(54, W3, W4, W5, W6, W7, W0, W1, W2, Wtmp0);
325 R( b, c, d, e, a, F2, 39 ); W_PRECALC_32_79_3(55, W3, W4, W5, W6, W7, W0, W1, W2, Wtmp0);
326 R( a, b, c, d, e, F3, 40 ); W_PRECALC_32_79_0(56, W2, W3, W4, W5, W6, W7, W0, W1, Wtmp0);
327 R( e, a, b, c, d, F3, 41 ); W_PRECALC_32_79_1(57, W2, W3, W4, W5, W6, W7, W0, W1, Wtmp0);
328 R( d, e, a, b, c, F3, 42 ); W_PRECALC_32_79_2(58, W2, W3, W4, W5, W6, W7, W0, W1, Wtmp0);
329 R( c, d, e, a, b, F3, 43 ); W_PRECALC_32_79_3(59, W2, W3, W4, W5, W6, W7, W0, W1, Wtmp0);
330 R( b, c, d, e, a, F3, 44 ); W_PRECALC_32_79_0(60, W1, W2, W3, W4, W5, W6, W7, W0, Wtmp0);
331 R( a, b, c, d, e, F3, 45 ); W_PRECALC_32_79_1(61, W1, W2, W3, W4, W5, W6, W7, W0, Wtmp0);
332 R( e, a, b, c, d, F3, 46 ); W_PRECALC_32_79_2(62, W1, W2, W3, W4, W5, W6, W7, W0, Wtmp0);
333 R( d, e, a, b, c, F3, 47 ); W_PRECALC_32_79_3(63, W1, W2, W3, W4, W5, W6, W7, W0, Wtmp0);
334 R( c, d, e, a, b, F3, 48 ); W_PRECALC_32_79_0(64, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
335 R( b, c, d, e, a, F3, 49 ); W_PRECALC_32_79_1(65, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
336 R( a, b, c, d, e, F3, 50 ); W_PRECALC_32_79_2(66, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
337 R( e, a, b, c, d, F3, 51 ); W_PRECALC_32_79_3(67, W0, W1, W2, W3, W4, W5, W6, W7, Wtmp0);
338 R( d, e, a, b, c, F3, 52 ); W_PRECALC_32_79_0(68, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
339 R( c, d, e, a, b, F3, 53 ); W_PRECALC_32_79_1(69, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
340 R( b, c, d, e, a, F3, 54 ); W_PRECALC_32_79_2(70, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
341 R( a, b, c, d, e, F3, 55 ); W_PRECALC_32_79_3(71, W7, W0, W1, W2, W3, W4, W5, W6, Wtmp0);
342 R( e, a, b, c, d, F3, 56 ); W_PRECALC_32_79_0(72, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
343 R( d, e, a, b, c, F3, 57 ); W_PRECALC_32_79_1(73, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
344 R( c, d, e, a, b, F3, 58 ); W_PRECALC_32_79_2(74, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
345 R( b, c, d, e, a, F3, 59 ); W_PRECALC_32_79_3(75, W6, W7, W0, W1, W2, W3, W4, W5, Wtmp0);
346 R( a, b, c, d, e, F4, 60 ); W_PRECALC_32_79_0(76, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
347 R( e, a, b, c, d, F4, 61 ); W_PRECALC_32_79_1(77, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
348 R( d, e, a, b, c, F4, 62 ); W_PRECALC_32_79_2(78, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
349 R( c, d, e, a, b, F4, 63 ); W_PRECALC_32_79_3(79, W5, W6, W7, W0, W1, W2, W3, W4, Wtmp0);
350
351 decq RNBLKS;
352 jz .Lend;
353
354 /* Transform 64-79 + Precalc 0-15 of next block. */
355 R( b, c, d, e, a, F4, 64 ); W_PRECALC_00_15_0(0, W0, Wtmp0);
356 R( a, b, c, d, e, F4, 65 ); W_PRECALC_00_15_1(1, W0, Wtmp0);
357 R( e, a, b, c, d, F4, 66 ); W_PRECALC_00_15_2(2, W0, Wtmp0);
358 R( d, e, a, b, c, F4, 67 ); W_PRECALC_00_15_3(3, W0, Wtmp0);
359 R( c, d, e, a, b, F4, 68 ); W_PRECALC_00_15_0(4, W7, Wtmp0);
360 R( b, c, d, e, a, F4, 69 ); W_PRECALC_00_15_1(5, W7, Wtmp0);
361 R( a, b, c, d, e, F4, 70 ); W_PRECALC_00_15_2(6, W7, Wtmp0);
362 R( e, a, b, c, d, F4, 71 ); W_PRECALC_00_15_3(7, W7, Wtmp0);
363 R( d, e, a, b, c, F4, 72 ); W_PRECALC_00_15_0(8, W6, Wtmp0);
364 R( c, d, e, a, b, F4, 73 ); W_PRECALC_00_15_1(9, W6, Wtmp0);
365 R( b, c, d, e, a, F4, 74 ); W_PRECALC_00_15_2(10, W6, Wtmp0);
366 R( a, b, c, d, e, F4, 75 ); W_PRECALC_00_15_3(11, W6, Wtmp0);
367 R( e, a, b, c, d, F4, 76 ); W_PRECALC_00_15_0(12, W5, Wtmp0);
368 R( d, e, a, b, c, F4, 77 ); W_PRECALC_00_15_1(13, W5, Wtmp0);
369 R( c, d, e, a, b, F4, 78 );
370 addl state_h0(RSTATE), a; W_PRECALC_00_15_2(14, W5, Wtmp0);
371 R( b, c, d, e, a, F4, 79 ); W_PRECALC_00_15_3(15, W5, Wtmp0);
372
373 /* Update the chaining variables. */
374 addl state_h3(RSTATE), d;
375 addl state_h2(RSTATE), c;
376 addl state_h1(RSTATE), b;
377 addl state_h4(RSTATE), e;
378
379 movl d, state_h3(RSTATE);
380 movl c, state_h2(RSTATE);
381 movl b, state_h1(RSTATE);
382 movl a, state_h0(RSTATE);
383 movl e, state_h4(RSTATE);
384
385 jmp .Loop;
386
387 .align 16
388 .Lend:
389 /* Transform 64-79 + Clear XMM registers + Burn stack. */
390 R( b, c, d, e, a, F4, 64 ); CLEAR_REG(BSWAP_REG);
391 R( a, b, c, d, e, F4, 65 ); CLEAR_REG(Wtmp0);
392 R( e, a, b, c, d, F4, 66 ); CLEAR_REG(Wtmp1);
393 R( d, e, a, b, c, F4, 67 ); CLEAR_REG(W0);
394 R( c, d, e, a, b, F4, 68 ); CLEAR_REG(W1);
395 R( b, c, d, e, a, F4, 69 ); CLEAR_REG(W2);
396 R( a, b, c, d, e, F4, 70 ); CLEAR_REG(W3);
397 R( e, a, b, c, d, F4, 71 ); CLEAR_REG(W4);
398 R( d, e, a, b, c, F4, 72 ); CLEAR_REG(W5);
399 R( c, d, e, a, b, F4, 73 ); CLEAR_REG(W6);
400 R( b, c, d, e, a, F4, 74 ); CLEAR_REG(W7);
401 R( a, b, c, d, e, F4, 75 );
402 R( e, a, b, c, d, F4, 76 ); movdqa Wtmp0, (0*16)(%rsp);
403 R( d, e, a, b, c, F4, 77 ); movdqa Wtmp0, (1*16)(%rsp);
404 R( c, d, e, a, b, F4, 78 ); movdqa Wtmp0, (2*16)(%rsp);
405 addl state_h0(RSTATE), a;
406 R( b, c, d, e, a, F4, 79 );
407
408 /* 16*4/16-1 = 3 */
409 movdqa Wtmp0, (3*16)(%rsp);
410
411 /* Update the chaining variables. */
412 addl state_h3(RSTATE), d;
413 addl state_h2(RSTATE), c;
414 addl state_h1(RSTATE), b;
415 addl state_h4(RSTATE), e;
416
417 movl d, state_h3(RSTATE);
418 movl c, state_h2(RSTATE);
419 movl b, state_h1(RSTATE);
420 movl a, state_h0(RSTATE);
421 movl e, state_h4(RSTATE);
422
423 movq ROLDSTACK, %rsp;
424 CFI_REGISTER(ROLDSTACK, %rsp);
425 CFI_DEF_CFA_REGISTER(%rsp);
426
427 popq %rbp;
428 CFI_POP(%rbp);
429 popq %rbx;
430 CFI_POP(%rbx);
431
432 /* stack already burned */
433 xorl %eax, %eax;
434
435 .Lret:
436 ret_spec_stop;
437 CFI_ENDPROC();
438 ELF(.size _gcry_sha1_transform_amd64_ssse3,
439 .-_gcry_sha1_transform_amd64_ssse3;)
440
441 #endif
442 #endif