xref: /minix3/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/sha256-586.S (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#include <machine/asm.h>
2*ebfedea0SLionel Sambuc.text
3*ebfedea0SLionel Sambuc.globl	sha256_block_data_order
4*ebfedea0SLionel Sambuc.type	sha256_block_data_order,@function
5*ebfedea0SLionel Sambuc.align	16
6*ebfedea0SLionel Sambucsha256_block_data_order:
7*ebfedea0SLionel Sambuc.L_sha256_block_data_order_begin:
8*ebfedea0SLionel Sambuc	pushl	%ebp
9*ebfedea0SLionel Sambuc	pushl	%ebx
10*ebfedea0SLionel Sambuc	pushl	%esi
11*ebfedea0SLionel Sambuc	pushl	%edi
12*ebfedea0SLionel Sambuc	movl	20(%esp),%esi
13*ebfedea0SLionel Sambuc	movl	24(%esp),%edi
14*ebfedea0SLionel Sambuc	movl	28(%esp),%eax
15*ebfedea0SLionel Sambuc	movl	%esp,%ebx
16*ebfedea0SLionel Sambuc	call	.L000pic_point
17*ebfedea0SLionel Sambuc.L000pic_point:
18*ebfedea0SLionel Sambuc	popl	%ebp
19*ebfedea0SLionel Sambuc	leal	.L001K256-.L000pic_point(%ebp),%ebp
20*ebfedea0SLionel Sambuc	subl	$16,%esp
21*ebfedea0SLionel Sambuc	andl	$-64,%esp
22*ebfedea0SLionel Sambuc	shll	$6,%eax
23*ebfedea0SLionel Sambuc	addl	%edi,%eax
24*ebfedea0SLionel Sambuc	movl	%esi,(%esp)
25*ebfedea0SLionel Sambuc	movl	%edi,4(%esp)
26*ebfedea0SLionel Sambuc	movl	%eax,8(%esp)
27*ebfedea0SLionel Sambuc	movl	%ebx,12(%esp)
28*ebfedea0SLionel Sambuc.align	16
29*ebfedea0SLionel Sambuc.L002loop:
30*ebfedea0SLionel Sambuc	movl	(%edi),%eax
31*ebfedea0SLionel Sambuc	movl	4(%edi),%ebx
32*ebfedea0SLionel Sambuc	movl	8(%edi),%ecx
33*ebfedea0SLionel Sambuc	movl	12(%edi),%edx
34*ebfedea0SLionel Sambuc	bswap	%eax
35*ebfedea0SLionel Sambuc	bswap	%ebx
36*ebfedea0SLionel Sambuc	bswap	%ecx
37*ebfedea0SLionel Sambuc	bswap	%edx
38*ebfedea0SLionel Sambuc	pushl	%eax
39*ebfedea0SLionel Sambuc	pushl	%ebx
40*ebfedea0SLionel Sambuc	pushl	%ecx
41*ebfedea0SLionel Sambuc	pushl	%edx
42*ebfedea0SLionel Sambuc	movl	16(%edi),%eax
43*ebfedea0SLionel Sambuc	movl	20(%edi),%ebx
44*ebfedea0SLionel Sambuc	movl	24(%edi),%ecx
45*ebfedea0SLionel Sambuc	movl	28(%edi),%edx
46*ebfedea0SLionel Sambuc	bswap	%eax
47*ebfedea0SLionel Sambuc	bswap	%ebx
48*ebfedea0SLionel Sambuc	bswap	%ecx
49*ebfedea0SLionel Sambuc	bswap	%edx
50*ebfedea0SLionel Sambuc	pushl	%eax
51*ebfedea0SLionel Sambuc	pushl	%ebx
52*ebfedea0SLionel Sambuc	pushl	%ecx
53*ebfedea0SLionel Sambuc	pushl	%edx
54*ebfedea0SLionel Sambuc	movl	32(%edi),%eax
55*ebfedea0SLionel Sambuc	movl	36(%edi),%ebx
56*ebfedea0SLionel Sambuc	movl	40(%edi),%ecx
57*ebfedea0SLionel Sambuc	movl	44(%edi),%edx
58*ebfedea0SLionel Sambuc	bswap	%eax
59*ebfedea0SLionel Sambuc	bswap	%ebx
60*ebfedea0SLionel Sambuc	bswap	%ecx
61*ebfedea0SLionel Sambuc	bswap	%edx
62*ebfedea0SLionel Sambuc	pushl	%eax
63*ebfedea0SLionel Sambuc	pushl	%ebx
64*ebfedea0SLionel Sambuc	pushl	%ecx
65*ebfedea0SLionel Sambuc	pushl	%edx
66*ebfedea0SLionel Sambuc	movl	48(%edi),%eax
67*ebfedea0SLionel Sambuc	movl	52(%edi),%ebx
68*ebfedea0SLionel Sambuc	movl	56(%edi),%ecx
69*ebfedea0SLionel Sambuc	movl	60(%edi),%edx
70*ebfedea0SLionel Sambuc	bswap	%eax
71*ebfedea0SLionel Sambuc	bswap	%ebx
72*ebfedea0SLionel Sambuc	bswap	%ecx
73*ebfedea0SLionel Sambuc	bswap	%edx
74*ebfedea0SLionel Sambuc	pushl	%eax
75*ebfedea0SLionel Sambuc	pushl	%ebx
76*ebfedea0SLionel Sambuc	pushl	%ecx
77*ebfedea0SLionel Sambuc	pushl	%edx
78*ebfedea0SLionel Sambuc	addl	$64,%edi
79*ebfedea0SLionel Sambuc	subl	$32,%esp
80*ebfedea0SLionel Sambuc	movl	%edi,100(%esp)
81*ebfedea0SLionel Sambuc	movl	(%esi),%eax
82*ebfedea0SLionel Sambuc	movl	4(%esi),%ebx
83*ebfedea0SLionel Sambuc	movl	8(%esi),%ecx
84*ebfedea0SLionel Sambuc	movl	12(%esi),%edi
85*ebfedea0SLionel Sambuc	movl	%ebx,4(%esp)
86*ebfedea0SLionel Sambuc	movl	%ecx,8(%esp)
87*ebfedea0SLionel Sambuc	movl	%edi,12(%esp)
88*ebfedea0SLionel Sambuc	movl	16(%esi),%edx
89*ebfedea0SLionel Sambuc	movl	20(%esi),%ebx
90*ebfedea0SLionel Sambuc	movl	24(%esi),%ecx
91*ebfedea0SLionel Sambuc	movl	28(%esi),%edi
92*ebfedea0SLionel Sambuc	movl	%ebx,20(%esp)
93*ebfedea0SLionel Sambuc	movl	%ecx,24(%esp)
94*ebfedea0SLionel Sambuc	movl	%edi,28(%esp)
95*ebfedea0SLionel Sambuc.align	16
96*ebfedea0SLionel Sambuc.L00300_15:
97*ebfedea0SLionel Sambuc	movl	92(%esp),%ebx
98*ebfedea0SLionel Sambuc	movl	%edx,%ecx
99*ebfedea0SLionel Sambuc	rorl	$14,%ecx
100*ebfedea0SLionel Sambuc	movl	20(%esp),%esi
101*ebfedea0SLionel Sambuc	xorl	%edx,%ecx
102*ebfedea0SLionel Sambuc	rorl	$5,%ecx
103*ebfedea0SLionel Sambuc	xorl	%edx,%ecx
104*ebfedea0SLionel Sambuc	rorl	$6,%ecx
105*ebfedea0SLionel Sambuc	movl	24(%esp),%edi
106*ebfedea0SLionel Sambuc	addl	%ecx,%ebx
107*ebfedea0SLionel Sambuc	xorl	%edi,%esi
108*ebfedea0SLionel Sambuc	movl	%edx,16(%esp)
109*ebfedea0SLionel Sambuc	movl	%eax,%ecx
110*ebfedea0SLionel Sambuc	andl	%edx,%esi
111*ebfedea0SLionel Sambuc	movl	12(%esp),%edx
112*ebfedea0SLionel Sambuc	xorl	%edi,%esi
113*ebfedea0SLionel Sambuc	movl	%eax,%edi
114*ebfedea0SLionel Sambuc	addl	%esi,%ebx
115*ebfedea0SLionel Sambuc	rorl	$9,%ecx
116*ebfedea0SLionel Sambuc	addl	28(%esp),%ebx
117*ebfedea0SLionel Sambuc	xorl	%eax,%ecx
118*ebfedea0SLionel Sambuc	rorl	$11,%ecx
119*ebfedea0SLionel Sambuc	movl	4(%esp),%esi
120*ebfedea0SLionel Sambuc	xorl	%eax,%ecx
121*ebfedea0SLionel Sambuc	rorl	$2,%ecx
122*ebfedea0SLionel Sambuc	addl	%ebx,%edx
123*ebfedea0SLionel Sambuc	movl	8(%esp),%edi
124*ebfedea0SLionel Sambuc	addl	%ecx,%ebx
125*ebfedea0SLionel Sambuc	movl	%eax,(%esp)
126*ebfedea0SLionel Sambuc	movl	%eax,%ecx
127*ebfedea0SLionel Sambuc	subl	$4,%esp
128*ebfedea0SLionel Sambuc	orl	%esi,%eax
129*ebfedea0SLionel Sambuc	andl	%esi,%ecx
130*ebfedea0SLionel Sambuc	andl	%edi,%eax
131*ebfedea0SLionel Sambuc	movl	(%ebp),%esi
132*ebfedea0SLionel Sambuc	orl	%ecx,%eax
133*ebfedea0SLionel Sambuc	addl	$4,%ebp
134*ebfedea0SLionel Sambuc	addl	%ebx,%eax
135*ebfedea0SLionel Sambuc	addl	%esi,%edx
136*ebfedea0SLionel Sambuc	addl	%esi,%eax
137*ebfedea0SLionel Sambuc	cmpl	$3248222580,%esi
138*ebfedea0SLionel Sambuc	jne	.L00300_15
139*ebfedea0SLionel Sambuc	movl	152(%esp),%ebx
140*ebfedea0SLionel Sambuc.align	16
141*ebfedea0SLionel Sambuc.L00416_63:
142*ebfedea0SLionel Sambuc	movl	%ebx,%esi
143*ebfedea0SLionel Sambuc	movl	100(%esp),%ecx
144*ebfedea0SLionel Sambuc	rorl	$11,%esi
145*ebfedea0SLionel Sambuc	movl	%ecx,%edi
146*ebfedea0SLionel Sambuc	xorl	%ebx,%esi
147*ebfedea0SLionel Sambuc	rorl	$7,%esi
148*ebfedea0SLionel Sambuc	shrl	$3,%ebx
149*ebfedea0SLionel Sambuc	rorl	$2,%edi
150*ebfedea0SLionel Sambuc	xorl	%esi,%ebx
151*ebfedea0SLionel Sambuc	xorl	%ecx,%edi
152*ebfedea0SLionel Sambuc	rorl	$17,%edi
153*ebfedea0SLionel Sambuc	shrl	$10,%ecx
154*ebfedea0SLionel Sambuc	addl	156(%esp),%ebx
155*ebfedea0SLionel Sambuc	xorl	%ecx,%edi
156*ebfedea0SLionel Sambuc	addl	120(%esp),%ebx
157*ebfedea0SLionel Sambuc	movl	%edx,%ecx
158*ebfedea0SLionel Sambuc	addl	%edi,%ebx
159*ebfedea0SLionel Sambuc	rorl	$14,%ecx
160*ebfedea0SLionel Sambuc	movl	20(%esp),%esi
161*ebfedea0SLionel Sambuc	xorl	%edx,%ecx
162*ebfedea0SLionel Sambuc	rorl	$5,%ecx
163*ebfedea0SLionel Sambuc	movl	%ebx,92(%esp)
164*ebfedea0SLionel Sambuc	xorl	%edx,%ecx
165*ebfedea0SLionel Sambuc	rorl	$6,%ecx
166*ebfedea0SLionel Sambuc	movl	24(%esp),%edi
167*ebfedea0SLionel Sambuc	addl	%ecx,%ebx
168*ebfedea0SLionel Sambuc	xorl	%edi,%esi
169*ebfedea0SLionel Sambuc	movl	%edx,16(%esp)
170*ebfedea0SLionel Sambuc	movl	%eax,%ecx
171*ebfedea0SLionel Sambuc	andl	%edx,%esi
172*ebfedea0SLionel Sambuc	movl	12(%esp),%edx
173*ebfedea0SLionel Sambuc	xorl	%edi,%esi
174*ebfedea0SLionel Sambuc	movl	%eax,%edi
175*ebfedea0SLionel Sambuc	addl	%esi,%ebx
176*ebfedea0SLionel Sambuc	rorl	$9,%ecx
177*ebfedea0SLionel Sambuc	addl	28(%esp),%ebx
178*ebfedea0SLionel Sambuc	xorl	%eax,%ecx
179*ebfedea0SLionel Sambuc	rorl	$11,%ecx
180*ebfedea0SLionel Sambuc	movl	4(%esp),%esi
181*ebfedea0SLionel Sambuc	xorl	%eax,%ecx
182*ebfedea0SLionel Sambuc	rorl	$2,%ecx
183*ebfedea0SLionel Sambuc	addl	%ebx,%edx
184*ebfedea0SLionel Sambuc	movl	8(%esp),%edi
185*ebfedea0SLionel Sambuc	addl	%ecx,%ebx
186*ebfedea0SLionel Sambuc	movl	%eax,(%esp)
187*ebfedea0SLionel Sambuc	movl	%eax,%ecx
188*ebfedea0SLionel Sambuc	subl	$4,%esp
189*ebfedea0SLionel Sambuc	orl	%esi,%eax
190*ebfedea0SLionel Sambuc	andl	%esi,%ecx
191*ebfedea0SLionel Sambuc	andl	%edi,%eax
192*ebfedea0SLionel Sambuc	movl	(%ebp),%esi
193*ebfedea0SLionel Sambuc	orl	%ecx,%eax
194*ebfedea0SLionel Sambuc	addl	$4,%ebp
195*ebfedea0SLionel Sambuc	addl	%ebx,%eax
196*ebfedea0SLionel Sambuc	movl	152(%esp),%ebx
197*ebfedea0SLionel Sambuc	addl	%esi,%edx
198*ebfedea0SLionel Sambuc	addl	%esi,%eax
199*ebfedea0SLionel Sambuc	cmpl	$3329325298,%esi
200*ebfedea0SLionel Sambuc	jne	.L00416_63
201*ebfedea0SLionel Sambuc	movl	352(%esp),%esi
202*ebfedea0SLionel Sambuc	movl	4(%esp),%ebx
203*ebfedea0SLionel Sambuc	movl	8(%esp),%ecx
204*ebfedea0SLionel Sambuc	movl	12(%esp),%edi
205*ebfedea0SLionel Sambuc	addl	(%esi),%eax
206*ebfedea0SLionel Sambuc	addl	4(%esi),%ebx
207*ebfedea0SLionel Sambuc	addl	8(%esi),%ecx
208*ebfedea0SLionel Sambuc	addl	12(%esi),%edi
209*ebfedea0SLionel Sambuc	movl	%eax,(%esi)
210*ebfedea0SLionel Sambuc	movl	%ebx,4(%esi)
211*ebfedea0SLionel Sambuc	movl	%ecx,8(%esi)
212*ebfedea0SLionel Sambuc	movl	%edi,12(%esi)
213*ebfedea0SLionel Sambuc	movl	20(%esp),%eax
214*ebfedea0SLionel Sambuc	movl	24(%esp),%ebx
215*ebfedea0SLionel Sambuc	movl	28(%esp),%ecx
216*ebfedea0SLionel Sambuc	movl	356(%esp),%edi
217*ebfedea0SLionel Sambuc	addl	16(%esi),%edx
218*ebfedea0SLionel Sambuc	addl	20(%esi),%eax
219*ebfedea0SLionel Sambuc	addl	24(%esi),%ebx
220*ebfedea0SLionel Sambuc	addl	28(%esi),%ecx
221*ebfedea0SLionel Sambuc	movl	%edx,16(%esi)
222*ebfedea0SLionel Sambuc	movl	%eax,20(%esi)
223*ebfedea0SLionel Sambuc	movl	%ebx,24(%esi)
224*ebfedea0SLionel Sambuc	movl	%ecx,28(%esi)
225*ebfedea0SLionel Sambuc	addl	$352,%esp
226*ebfedea0SLionel Sambuc	subl	$256,%ebp
227*ebfedea0SLionel Sambuc	cmpl	8(%esp),%edi
228*ebfedea0SLionel Sambuc	jb	.L002loop
229*ebfedea0SLionel Sambuc	movl	12(%esp),%esp
230*ebfedea0SLionel Sambuc	popl	%edi
231*ebfedea0SLionel Sambuc	popl	%esi
232*ebfedea0SLionel Sambuc	popl	%ebx
233*ebfedea0SLionel Sambuc	popl	%ebp
234*ebfedea0SLionel Sambuc	ret
235*ebfedea0SLionel Sambuc.align	64
236*ebfedea0SLionel Sambuc.L001K256:
237*ebfedea0SLionel Sambuc.long	1116352408,1899447441,3049323471,3921009573
238*ebfedea0SLionel Sambuc.long	961987163,1508970993,2453635748,2870763221
239*ebfedea0SLionel Sambuc.long	3624381080,310598401,607225278,1426881987
240*ebfedea0SLionel Sambuc.long	1925078388,2162078206,2614888103,3248222580
241*ebfedea0SLionel Sambuc.long	3835390401,4022224774,264347078,604807628
242*ebfedea0SLionel Sambuc.long	770255983,1249150122,1555081692,1996064986
243*ebfedea0SLionel Sambuc.long	2554220882,2821834349,2952996808,3210313671
244*ebfedea0SLionel Sambuc.long	3336571891,3584528711,113926993,338241895
245*ebfedea0SLionel Sambuc.long	666307205,773529912,1294757372,1396182291
246*ebfedea0SLionel Sambuc.long	1695183700,1986661051,2177026350,2456956037
247*ebfedea0SLionel Sambuc.long	2730485921,2820302411,3259730800,3345764771
248*ebfedea0SLionel Sambuc.long	3516065817,3600352804,4094571909,275423344
249*ebfedea0SLionel Sambuc.long	430227734,506948616,659060556,883997877
250*ebfedea0SLionel Sambuc.long	958139571,1322822218,1537002063,1747873779
251*ebfedea0SLionel Sambuc.long	1955562222,2024104815,2227730452,2361852424
252*ebfedea0SLionel Sambuc.long	2428436474,2756734187,3204031479,3329325298
253*ebfedea0SLionel Sambuc.size	sha256_block_data_order,.-.L_sha256_block_data_order_begin
254*ebfedea0SLionel Sambuc.byte	83,72,65,50,53,54,32,98,108,111,99,107,32,116,114,97
255*ebfedea0SLionel Sambuc.byte	110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
256*ebfedea0SLionel Sambuc.byte	67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
257*ebfedea0SLionel Sambuc.byte	112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
258*ebfedea0SLionel Sambuc.byte	62,0
259