12 /* x = (wp[off-f] ^ wp[off-8] ^ wp[off-14] ^ wp[off-16]) <<< 1;
15 * E += 0xca62c1d6 + x;
20 #define BSWAPDI BYTE $0x0f; BYTE $0xcf;
22 #define BODY(off,FN,V,A,B,C,D,E)\
23 movl (off-64)(%ebp), %edi;\
24 xorl (off-56)(%ebp), %edi;\
25 xorl (off-32)(%ebp), %edi;\
26 xorl (off-12)(%ebp), %edi;\
28 movl %edi, off(%ebp);\
29 leal V(%edi, E, 1), E;\
37 #define BODY0(off,FN,V,A,B,C,D,E)\
38 movl off(%ebx), %edi;\
40 movl %edi, off(%ebp);\
50 * fn1 = (((C^D)&B)^D);
67 * fn3 = ((B ^ C) & (D ^= B)) ^ B
80 * void sha1block(uchar *DATA, int LEN, ulong *STATE)
82 #define STACKSIZE (48+80*4)
83 #define DATA (STACKSIZE+8)
84 #define LEN (STACKSIZE+12)
85 #define STATE (STACKSIZE+16)
88 * stack offsets for locals
91 * ulong *w15, *w40, *w60, *w80;
94 * ulong a = eax, b = ebx, c = ecx, d = edx, e = esi
97 #define WARRAY (STACKSIZE-4-(80*4))
98 #define TMP1 (STACKSIZE-8-(80*4))
99 #define TMP2 (STACKSIZE-12-(80*4))
100 #define W15 (STACKSIZE-16-(80*4))
101 #define W40 (STACKSIZE-20-(80*4))
102 #define W60 (STACKSIZE-24-(80*4))
103 #define W80 (STACKSIZE-28-(80*4))
104 #define EDATA (STACKSIZE-32-(80*4))
105 #define OLDEBX (STACKSIZE-36-(80*4))
106 #define OLDESI (STACKSIZE-40-(80*4))
107 #define OLDEDI (STACKSIZE-44-(80*4))
111 subl $(STACKSIZE), %esp
113 mov %ebx, OLDEBX(%esp)
114 mov %esi, OLDESI(%esp)
115 mov %edi, OLDEDI(%esp)
117 movl DATA(%esp), %eax
119 movl %eax, EDATA(%esp)
121 leal (WARRAY+15*4)(%esp), %edi /* aw15 */
123 leal (WARRAY+40*4)(%esp), %edx /* aw40 */
125 leal (WARRAY+60*4)(%esp), %ecx /* aw60 */
127 leal (WARRAY+80*4)(%esp), %edi /* aw80 */
131 leal WARRAY(%esp), %ebp /* warray */
133 movl STATE(%esp), %edi /* state */
136 movl %ebx, TMP1(%esp) /* tmp1 */
141 movl DATA(%esp), %ebx /* data */
144 BODY0(0,FN1,0x5a827999,%eax,TMP1(%esp),%ecx,%edx,%esi)
146 BODY0(4,FN1,0x5a827999,%esi,%eax,TMP1(%esp),%ecx,%edx)
148 BODY0(8,FN1,0x5a827999,%edx,TMP2(%esp),%eax,%esi,%ecx)
149 BODY0(12,FN1,0x5a827999,%ecx,%edx,TMP2(%esp),%eax,%esi)
151 BODY0(16,FN1,0x5a827999,%esi,%ecx,%edx,TMP2(%esp),%eax)
156 cmpl W15(%esp), %ebp /* w15 */
159 BODY0(0,FN1,0x5a827999,%eax,TMP1(%esp),%ecx,%edx,%esi)
161 MOVL %ebx, DATA(%esp) /* data */
164 BODY(4,FN1,0x5a827999,%esi,%eax,%ebx,%ecx,%edx)
165 BODY(8,FN1,0x5a827999,%edx,%esi,%eax,%ebx,%ecx)
166 BODY(12,FN1,0x5a827999,%ecx,%edx,%esi,%eax,%ebx)
167 BODY(16,FN1,0x5a827999,%ebx,%ecx,%edx,%esi,%eax)
172 BODY(0,FN24,0x6ed9eba1,%eax,%ebx,%ecx,%edx,%esi)
173 BODY(4,FN24,0x6ed9eba1,%esi,%eax,%ebx,%ecx,%edx)
174 BODY(8,FN24,0x6ed9eba1,%edx,%esi,%eax,%ebx,%ecx)
175 BODY(12,FN24,0x6ed9eba1,%ecx,%edx,%esi,%eax,%ebx)
176 BODY(16,FN24,0x6ed9eba1,%ebx,%ecx,%edx,%esi,%eax)
183 BODY(0,FN3,0x8f1bbcdc,%eax,%ebx,%ecx,%edx,%esi)
184 BODY(4,FN3,0x8f1bbcdc,%esi,%eax,%ebx,%ecx,%edx)
185 BODY(8,FN3,0x8f1bbcdc,%edx,%esi,%eax,%ebx,%ecx)
186 BODY(12,FN3,0x8f1bbcdc,%ecx,%edx,%esi,%eax,%ebx)
187 BODY(16,FN3,0x8f1bbcdc,%ebx,%ecx,%edx,%esi,%eax)
190 cmpl W60(%esp), %ebp /* w60 */
194 BODY(0,FN24,0xca62c1d6,%eax,%ebx,%ecx,%edx,%esi)
195 BODY(4,FN24,0xca62c1d6,%esi,%eax,%ebx,%ecx,%edx)
196 BODY(8,FN24,0xca62c1d6,%edx,%esi,%eax,%ebx,%ecx)
197 BODY(12,FN24,0xca62c1d6,%ecx,%edx,%esi,%eax,%ebx)
198 BODY(16,FN24,0xca62c1d6,%ebx,%ecx,%edx,%esi,%eax)
201 cmpl W80(%esp), %ebp /* w80 */
204 movl STATE(%esp), %edi /* state */
211 movl EDATA(%esp), %edi /* edata */
212 cmpl %edi, DATA(%esp) /* data */
216 mov OLDEBX(%esp), %ebx
217 mov OLDESI(%esp), %esi
218 mov OLDEDI(%esp), %edi
219 addl $(STACKSIZE), %esp