5 .type _sha1block, @function
8 /* x = (wp[off-f] ^ wp[off-8] ^ wp[off-14] ^ wp[off-16]) <<< 1;
11 * E += 0xca62c1d6 + x;
16 #define BSWAPDI BYTE $0x0f; BYTE $0xcf;
18 #define BODY(off,FN,V,A,B,C,D,E)\
19 movl (off-64)(%ebp), %edi;\
20 xorl (off-56)(%ebp), %edi;\
21 xorl (off-32)(%ebp), %edi;\
22 xorl (off-12)(%ebp), %edi;\
24 movl %edi, off(%ebp);\
25 leal V(%edi, E, 1), E;\
33 #define BODY0(off,FN,V,A,B,C,D,E)\
34 movl off(%ebx), %edi;\
36 movl %edi, off(%ebp);\
46 * fn1 = (((C^D)&B)^D);
63 * fn3 = ((B ^ C) & (D ^= B)) ^ B
76 * void sha1block(uchar *DATA, int LEN, ulong *STATE)
78 #define STACKSIZE (48+80*4)
79 #define DATA (STACKSIZE+8)
80 #define LEN (STACKSIZE+12)
81 #define STATE (STACKSIZE+16)
84 * stack offsets for locals
87 * ulong *w15, *w40, *w60, *w80;
90 * ulong a = eax, b = ebx, c = ecx, d = edx, e = esi
93 #define WARRAY (STACKSIZE-4-(80*4))
94 #define TMP1 (STACKSIZE-8-(80*4))
95 #define TMP2 (STACKSIZE-12-(80*4))
96 #define W15 (STACKSIZE-16-(80*4))
97 #define W40 (STACKSIZE-20-(80*4))
98 #define W60 (STACKSIZE-24-(80*4))
99 #define W80 (STACKSIZE-28-(80*4))
100 #define EDATA (STACKSIZE-32-(80*4))
101 #define OLDEBX (STACKSIZE-36-(80*4))
102 #define OLDESI (STACKSIZE-40-(80*4))
103 #define OLDEDI (STACKSIZE-44-(80*4))
107 subl $(STACKSIZE), %esp
109 mov %ebx, OLDEBX(%esp)
110 mov %esi, OLDESI(%esp)
111 mov %edi, OLDEDI(%esp)
113 movl DATA(%esp), %eax
115 movl %eax, EDATA(%esp)
117 leal (WARRAY+15*4)(%esp), %edi /* aw15 */
119 leal (WARRAY+40*4)(%esp), %edx /* aw40 */
121 leal (WARRAY+60*4)(%esp), %ecx /* aw60 */
123 leal (WARRAY+80*4)(%esp), %edi /* aw80 */
127 leal WARRAY(%esp), %ebp /* warray */
129 movl STATE(%esp), %edi /* state */
132 movl %ebx, TMP1(%esp) /* tmp1 */
137 movl DATA(%esp), %ebx /* data */
140 BODY0(0,FN1,0x5a827999,%eax,TMP1(%esp),%ecx,%edx,%esi)
142 BODY0(4,FN1,0x5a827999,%esi,%eax,TMP1(%esp),%ecx,%edx)
144 BODY0(8,FN1,0x5a827999,%edx,TMP2(%esp),%eax,%esi,%ecx)
145 BODY0(12,FN1,0x5a827999,%ecx,%edx,TMP2(%esp),%eax,%esi)
147 BODY0(16,FN1,0x5a827999,%esi,%ecx,%edx,TMP2(%esp),%eax)
152 cmpl W15(%esp), %ebp /* w15 */
155 BODY0(0,FN1,0x5a827999,%eax,TMP1(%esp),%ecx,%edx,%esi)
157 MOVL %ebx, DATA(%esp) /* data */
160 BODY(4,FN1,0x5a827999,%esi,%eax,%ebx,%ecx,%edx)
161 BODY(8,FN1,0x5a827999,%edx,%esi,%eax,%ebx,%ecx)
162 BODY(12,FN1,0x5a827999,%ecx,%edx,%esi,%eax,%ebx)
163 BODY(16,FN1,0x5a827999,%ebx,%ecx,%edx,%esi,%eax)
168 BODY(0,FN24,0x6ed9eba1,%eax,%ebx,%ecx,%edx,%esi)
169 BODY(4,FN24,0x6ed9eba1,%esi,%eax,%ebx,%ecx,%edx)
170 BODY(8,FN24,0x6ed9eba1,%edx,%esi,%eax,%ebx,%ecx)
171 BODY(12,FN24,0x6ed9eba1,%ecx,%edx,%esi,%eax,%ebx)
172 BODY(16,FN24,0x6ed9eba1,%ebx,%ecx,%edx,%esi,%eax)
179 BODY(0,FN3,0x8f1bbcdc,%eax,%ebx,%ecx,%edx,%esi)
180 BODY(4,FN3,0x8f1bbcdc,%esi,%eax,%ebx,%ecx,%edx)
181 BODY(8,FN3,0x8f1bbcdc,%edx,%esi,%eax,%ebx,%ecx)
182 BODY(12,FN3,0x8f1bbcdc,%ecx,%edx,%esi,%eax,%ebx)
183 BODY(16,FN3,0x8f1bbcdc,%ebx,%ecx,%edx,%esi,%eax)
186 cmpl W60(%esp), %ebp /* w60 */
190 BODY(0,FN24,0xca62c1d6,%eax,%ebx,%ecx,%edx,%esi)
191 BODY(4,FN24,0xca62c1d6,%esi,%eax,%ebx,%ecx,%edx)
192 BODY(8,FN24,0xca62c1d6,%edx,%esi,%eax,%ebx,%ecx)
193 BODY(12,FN24,0xca62c1d6,%ecx,%edx,%esi,%eax,%ebx)
194 BODY(16,FN24,0xca62c1d6,%ebx,%ecx,%edx,%esi,%eax)
197 cmpl W80(%esp), %ebp /* w80 */
200 movl STATE(%esp), %edi /* state */
207 movl EDATA(%esp), %edi /* edata */
208 cmpl %edi, DATA(%esp) /* data */
212 mov OLDEBX(%esp), %ebx
213 mov OLDESI(%esp), %esi
214 mov OLDEDI(%esp), %edi
215 addl $(STACKSIZE), %esp