1.text
2.code	32
3
4.type	K256,%object
5.align	5
6K256:
7.word	0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
8.word	0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
9.word	0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
10.word	0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
11.word	0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
12.word	0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
13.word	0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
14.word	0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
15.word	0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
16.word	0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
17.word	0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
18.word	0xd192e819,0xd6990624,0xf40e3585,0x106aa070
19.word	0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
20.word	0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
21.word	0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
22.word	0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
23.size	K256,.-K256
24
25.global	sha256_block_data_order
26.type	sha256_block_data_order,%function
27sha256_block_data_order:
28	sub	r3,pc,#8		@ sha256_block_data_order
29	add	r2,r1,r2,lsl#6	@ len to point at the end of inp
30	stmdb	sp!,{r0,r1,r2,r4-r12,lr}
31	ldmia	r0,{r4,r5,r6,r7,r8,r9,r10,r11}
32	sub	r14,r3,#256		@ K256
33	sub	sp,sp,#16*4		@ alloca(X[16])
34.Loop:
35	ldrb	r3,[r1,#3]			@ 0
36	ldrb	r12,[r1,#2]
37	ldrb	r2,[r1,#1]
38	ldrb	r0,[r1],#4
39	orr	r3,r3,r12,lsl#8
40	orr	r3,r3,r2,lsl#16
41	orr	r3,r3,r0,lsl#24
42
43	ldr	r12,[r14],#4			@ *K256++
44	str	r3,[sp,#0*4]
45	mov	r0,r8,ror#6
46	eor	r0,r0,r8,ror#11
47	eor	r0,r0,r8,ror#25	@ Sigma1(e)
48	add	r3,r3,r0
49	eor	r2,r9,r10
50	and	r2,r2,r8
51	eor	r2,r2,r10			@ Ch(e,f,g)
52	add	r3,r3,r2
53	add	r3,r3,r11
54	add	r3,r3,r12
55	mov	r11,r4,ror#2
56	eor	r11,r11,r4,ror#13
57	eor	r11,r11,r4,ror#22		@ Sigma0(a)
58	orr	r0,r4,r5
59	and	r0,r0,r6
60	and	r2,r4,r5
61	orr	r0,r0,r2			@ Maj(a,b,c)
62	add	r11,r11,r0
63	add	r7,r7,r3
64	add	r11,r11,r3
65	ldrb	r3,[r1,#3]			@ 1
66	ldrb	r12,[r1,#2]
67	ldrb	r2,[r1,#1]
68	ldrb	r0,[r1],#4
69	orr	r3,r3,r12,lsl#8
70	orr	r3,r3,r2,lsl#16
71	orr	r3,r3,r0,lsl#24
72
73	ldr	r12,[r14],#4			@ *K256++
74	str	r3,[sp,#1*4]
75	mov	r0,r7,ror#6
76	eor	r0,r0,r7,ror#11
77	eor	r0,r0,r7,ror#25	@ Sigma1(e)
78	add	r3,r3,r0
79	eor	r2,r8,r9
80	and	r2,r2,r7
81	eor	r2,r2,r9			@ Ch(e,f,g)
82	add	r3,r3,r2
83	add	r3,r3,r10
84	add	r3,r3,r12
85	mov	r10,r11,ror#2
86	eor	r10,r10,r11,ror#13
87	eor	r10,r10,r11,ror#22		@ Sigma0(a)
88	orr	r0,r11,r4
89	and	r0,r0,r5
90	and	r2,r11,r4
91	orr	r0,r0,r2			@ Maj(a,b,c)
92	add	r10,r10,r0
93	add	r6,r6,r3
94	add	r10,r10,r3
95	ldrb	r3,[r1,#3]			@ 2
96	ldrb	r12,[r1,#2]
97	ldrb	r2,[r1,#1]
98	ldrb	r0,[r1],#4
99	orr	r3,r3,r12,lsl#8
100	orr	r3,r3,r2,lsl#16
101	orr	r3,r3,r0,lsl#24
102
103	ldr	r12,[r14],#4			@ *K256++
104	str	r3,[sp,#2*4]
105	mov	r0,r6,ror#6
106	eor	r0,r0,r6,ror#11
107	eor	r0,r0,r6,ror#25	@ Sigma1(e)
108	add	r3,r3,r0
109	eor	r2,r7,r8
110	and	r2,r2,r6
111	eor	r2,r2,r8			@ Ch(e,f,g)
112	add	r3,r3,r2
113	add	r3,r3,r9
114	add	r3,r3,r12
115	mov	r9,r10,ror#2
116	eor	r9,r9,r10,ror#13
117	eor	r9,r9,r10,ror#22		@ Sigma0(a)
118	orr	r0,r10,r11
119	and	r0,r0,r4
120	and	r2,r10,r11
121	orr	r0,r0,r2			@ Maj(a,b,c)
122	add	r9,r9,r0
123	add	r5,r5,r3
124	add	r9,r9,r3
125	ldrb	r3,[r1,#3]			@ 3
126	ldrb	r12,[r1,#2]
127	ldrb	r2,[r1,#1]
128	ldrb	r0,[r1],#4
129	orr	r3,r3,r12,lsl#8
130	orr	r3,r3,r2,lsl#16
131	orr	r3,r3,r0,lsl#24
132
133	ldr	r12,[r14],#4			@ *K256++
134	str	r3,[sp,#3*4]
135	mov	r0,r5,ror#6
136	eor	r0,r0,r5,ror#11
137	eor	r0,r0,r5,ror#25	@ Sigma1(e)
138	add	r3,r3,r0
139	eor	r2,r6,r7
140	and	r2,r2,r5
141	eor	r2,r2,r7			@ Ch(e,f,g)
142	add	r3,r3,r2
143	add	r3,r3,r8
144	add	r3,r3,r12
145	mov	r8,r9,ror#2
146	eor	r8,r8,r9,ror#13
147	eor	r8,r8,r9,ror#22		@ Sigma0(a)
148	orr	r0,r9,r10
149	and	r0,r0,r11
150	and	r2,r9,r10
151	orr	r0,r0,r2			@ Maj(a,b,c)
152	add	r8,r8,r0
153	add	r4,r4,r3
154	add	r8,r8,r3
155	ldrb	r3,[r1,#3]			@ 4
156	ldrb	r12,[r1,#2]
157	ldrb	r2,[r1,#1]
158	ldrb	r0,[r1],#4
159	orr	r3,r3,r12,lsl#8
160	orr	r3,r3,r2,lsl#16
161	orr	r3,r3,r0,lsl#24
162
163	ldr	r12,[r14],#4			@ *K256++
164	str	r3,[sp,#4*4]
165	mov	r0,r4,ror#6
166	eor	r0,r0,r4,ror#11
167	eor	r0,r0,r4,ror#25	@ Sigma1(e)
168	add	r3,r3,r0
169	eor	r2,r5,r6
170	and	r2,r2,r4
171	eor	r2,r2,r6			@ Ch(e,f,g)
172	add	r3,r3,r2
173	add	r3,r3,r7
174	add	r3,r3,r12
175	mov	r7,r8,ror#2
176	eor	r7,r7,r8,ror#13
177	eor	r7,r7,r8,ror#22		@ Sigma0(a)
178	orr	r0,r8,r9
179	and	r0,r0,r10
180	and	r2,r8,r9
181	orr	r0,r0,r2			@ Maj(a,b,c)
182	add	r7,r7,r0
183	add	r11,r11,r3
184	add	r7,r7,r3
185	ldrb	r3,[r1,#3]			@ 5
186	ldrb	r12,[r1,#2]
187	ldrb	r2,[r1,#1]
188	ldrb	r0,[r1],#4
189	orr	r3,r3,r12,lsl#8
190	orr	r3,r3,r2,lsl#16
191	orr	r3,r3,r0,lsl#24
192
193	ldr	r12,[r14],#4			@ *K256++
194	str	r3,[sp,#5*4]
195	mov	r0,r11,ror#6
196	eor	r0,r0,r11,ror#11
197	eor	r0,r0,r11,ror#25	@ Sigma1(e)
198	add	r3,r3,r0
199	eor	r2,r4,r5
200	and	r2,r2,r11
201	eor	r2,r2,r5			@ Ch(e,f,g)
202	add	r3,r3,r2
203	add	r3,r3,r6
204	add	r3,r3,r12
205	mov	r6,r7,ror#2
206	eor	r6,r6,r7,ror#13
207	eor	r6,r6,r7,ror#22		@ Sigma0(a)
208	orr	r0,r7,r8
209	and	r0,r0,r9
210	and	r2,r7,r8
211	orr	r0,r0,r2			@ Maj(a,b,c)
212	add	r6,r6,r0
213	add	r10,r10,r3
214	add	r6,r6,r3
215	ldrb	r3,[r1,#3]			@ 6
216	ldrb	r12,[r1,#2]
217	ldrb	r2,[r1,#1]
218	ldrb	r0,[r1],#4
219	orr	r3,r3,r12,lsl#8
220	orr	r3,r3,r2,lsl#16
221	orr	r3,r3,r0,lsl#24
222
223	ldr	r12,[r14],#4			@ *K256++
224	str	r3,[sp,#6*4]
225	mov	r0,r10,ror#6
226	eor	r0,r0,r10,ror#11
227	eor	r0,r0,r10,ror#25	@ Sigma1(e)
228	add	r3,r3,r0
229	eor	r2,r11,r4
230	and	r2,r2,r10
231	eor	r2,r2,r4			@ Ch(e,f,g)
232	add	r3,r3,r2
233	add	r3,r3,r5
234	add	r3,r3,r12
235	mov	r5,r6,ror#2
236	eor	r5,r5,r6,ror#13
237	eor	r5,r5,r6,ror#22		@ Sigma0(a)
238	orr	r0,r6,r7
239	and	r0,r0,r8
240	and	r2,r6,r7
241	orr	r0,r0,r2			@ Maj(a,b,c)
242	add	r5,r5,r0
243	add	r9,r9,r3
244	add	r5,r5,r3
245	ldrb	r3,[r1,#3]			@ 7
246	ldrb	r12,[r1,#2]
247	ldrb	r2,[r1,#1]
248	ldrb	r0,[r1],#4
249	orr	r3,r3,r12,lsl#8
250	orr	r3,r3,r2,lsl#16
251	orr	r3,r3,r0,lsl#24
252
253	ldr	r12,[r14],#4			@ *K256++
254	str	r3,[sp,#7*4]
255	mov	r0,r9,ror#6
256	eor	r0,r0,r9,ror#11
257	eor	r0,r0,r9,ror#25	@ Sigma1(e)
258	add	r3,r3,r0
259	eor	r2,r10,r11
260	and	r2,r2,r9
261	eor	r2,r2,r11			@ Ch(e,f,g)
262	add	r3,r3,r2
263	add	r3,r3,r4
264	add	r3,r3,r12
265	mov	r4,r5,ror#2
266	eor	r4,r4,r5,ror#13
267	eor	r4,r4,r5,ror#22		@ Sigma0(a)
268	orr	r0,r5,r6
269	and	r0,r0,r7
270	and	r2,r5,r6
271	orr	r0,r0,r2			@ Maj(a,b,c)
272	add	r4,r4,r0
273	add	r8,r8,r3
274	add	r4,r4,r3
275	ldrb	r3,[r1,#3]			@ 8
276	ldrb	r12,[r1,#2]
277	ldrb	r2,[r1,#1]
278	ldrb	r0,[r1],#4
279	orr	r3,r3,r12,lsl#8
280	orr	r3,r3,r2,lsl#16
281	orr	r3,r3,r0,lsl#24
282
283	ldr	r12,[r14],#4			@ *K256++
284	str	r3,[sp,#8*4]
285	mov	r0,r8,ror#6
286	eor	r0,r0,r8,ror#11
287	eor	r0,r0,r8,ror#25	@ Sigma1(e)
288	add	r3,r3,r0
289	eor	r2,r9,r10
290	and	r2,r2,r8
291	eor	r2,r2,r10			@ Ch(e,f,g)
292	add	r3,r3,r2
293	add	r3,r3,r11
294	add	r3,r3,r12
295	mov	r11,r4,ror#2
296	eor	r11,r11,r4,ror#13
297	eor	r11,r11,r4,ror#22		@ Sigma0(a)
298	orr	r0,r4,r5
299	and	r0,r0,r6
300	and	r2,r4,r5
301	orr	r0,r0,r2			@ Maj(a,b,c)
302	add	r11,r11,r0
303	add	r7,r7,r3
304	add	r11,r11,r3
305	ldrb	r3,[r1,#3]			@ 9
306	ldrb	r12,[r1,#2]
307	ldrb	r2,[r1,#1]
308	ldrb	r0,[r1],#4
309	orr	r3,r3,r12,lsl#8
310	orr	r3,r3,r2,lsl#16
311	orr	r3,r3,r0,lsl#24
312
313	ldr	r12,[r14],#4			@ *K256++
314	str	r3,[sp,#9*4]
315	mov	r0,r7,ror#6
316	eor	r0,r0,r7,ror#11
317	eor	r0,r0,r7,ror#25	@ Sigma1(e)
318	add	r3,r3,r0
319	eor	r2,r8,r9
320	and	r2,r2,r7
321	eor	r2,r2,r9			@ Ch(e,f,g)
322	add	r3,r3,r2
323	add	r3,r3,r10
324	add	r3,r3,r12
325	mov	r10,r11,ror#2
326	eor	r10,r10,r11,ror#13
327	eor	r10,r10,r11,ror#22		@ Sigma0(a)
328	orr	r0,r11,r4
329	and	r0,r0,r5
330	and	r2,r11,r4
331	orr	r0,r0,r2			@ Maj(a,b,c)
332	add	r10,r10,r0
333	add	r6,r6,r3
334	add	r10,r10,r3
335	ldrb	r3,[r1,#3]			@ 10
336	ldrb	r12,[r1,#2]
337	ldrb	r2,[r1,#1]
338	ldrb	r0,[r1],#4
339	orr	r3,r3,r12,lsl#8
340	orr	r3,r3,r2,lsl#16
341	orr	r3,r3,r0,lsl#24
342
343	ldr	r12,[r14],#4			@ *K256++
344	str	r3,[sp,#10*4]
345	mov	r0,r6,ror#6
346	eor	r0,r0,r6,ror#11
347	eor	r0,r0,r6,ror#25	@ Sigma1(e)
348	add	r3,r3,r0
349	eor	r2,r7,r8
350	and	r2,r2,r6
351	eor	r2,r2,r8			@ Ch(e,f,g)
352	add	r3,r3,r2
353	add	r3,r3,r9
354	add	r3,r3,r12
355	mov	r9,r10,ror#2
356	eor	r9,r9,r10,ror#13
357	eor	r9,r9,r10,ror#22		@ Sigma0(a)
358	orr	r0,r10,r11
359	and	r0,r0,r4
360	and	r2,r10,r11
361	orr	r0,r0,r2			@ Maj(a,b,c)
362	add	r9,r9,r0
363	add	r5,r5,r3
364	add	r9,r9,r3
365	ldrb	r3,[r1,#3]			@ 11
366	ldrb	r12,[r1,#2]
367	ldrb	r2,[r1,#1]
368	ldrb	r0,[r1],#4
369	orr	r3,r3,r12,lsl#8
370	orr	r3,r3,r2,lsl#16
371	orr	r3,r3,r0,lsl#24
372
373	ldr	r12,[r14],#4			@ *K256++
374	str	r3,[sp,#11*4]
375	mov	r0,r5,ror#6
376	eor	r0,r0,r5,ror#11
377	eor	r0,r0,r5,ror#25	@ Sigma1(e)
378	add	r3,r3,r0
379	eor	r2,r6,r7
380	and	r2,r2,r5
381	eor	r2,r2,r7			@ Ch(e,f,g)
382	add	r3,r3,r2
383	add	r3,r3,r8
384	add	r3,r3,r12
385	mov	r8,r9,ror#2
386	eor	r8,r8,r9,ror#13
387	eor	r8,r8,r9,ror#22		@ Sigma0(a)
388	orr	r0,r9,r10
389	and	r0,r0,r11
390	and	r2,r9,r10
391	orr	r0,r0,r2			@ Maj(a,b,c)
392	add	r8,r8,r0
393	add	r4,r4,r3
394	add	r8,r8,r3
395	ldrb	r3,[r1,#3]			@ 12
396	ldrb	r12,[r1,#2]
397	ldrb	r2,[r1,#1]
398	ldrb	r0,[r1],#4
399	orr	r3,r3,r12,lsl#8
400	orr	r3,r3,r2,lsl#16
401	orr	r3,r3,r0,lsl#24
402
403	ldr	r12,[r14],#4			@ *K256++
404	str	r3,[sp,#12*4]
405	mov	r0,r4,ror#6
406	eor	r0,r0,r4,ror#11
407	eor	r0,r0,r4,ror#25	@ Sigma1(e)
408	add	r3,r3,r0
409	eor	r2,r5,r6
410	and	r2,r2,r4
411	eor	r2,r2,r6			@ Ch(e,f,g)
412	add	r3,r3,r2
413	add	r3,r3,r7
414	add	r3,r3,r12
415	mov	r7,r8,ror#2
416	eor	r7,r7,r8,ror#13
417	eor	r7,r7,r8,ror#22		@ Sigma0(a)
418	orr	r0,r8,r9
419	and	r0,r0,r10
420	and	r2,r8,r9
421	orr	r0,r0,r2			@ Maj(a,b,c)
422	add	r7,r7,r0
423	add	r11,r11,r3
424	add	r7,r7,r3
425	ldrb	r3,[r1,#3]			@ 13
426	ldrb	r12,[r1,#2]
427	ldrb	r2,[r1,#1]
428	ldrb	r0,[r1],#4
429	orr	r3,r3,r12,lsl#8
430	orr	r3,r3,r2,lsl#16
431	orr	r3,r3,r0,lsl#24
432
433	ldr	r12,[r14],#4			@ *K256++
434	str	r3,[sp,#13*4]
435	mov	r0,r11,ror#6
436	eor	r0,r0,r11,ror#11
437	eor	r0,r0,r11,ror#25	@ Sigma1(e)
438	add	r3,r3,r0
439	eor	r2,r4,r5
440	and	r2,r2,r11
441	eor	r2,r2,r5			@ Ch(e,f,g)
442	add	r3,r3,r2
443	add	r3,r3,r6
444	add	r3,r3,r12
445	mov	r6,r7,ror#2
446	eor	r6,r6,r7,ror#13
447	eor	r6,r6,r7,ror#22		@ Sigma0(a)
448	orr	r0,r7,r8
449	and	r0,r0,r9
450	and	r2,r7,r8
451	orr	r0,r0,r2			@ Maj(a,b,c)
452	add	r6,r6,r0
453	add	r10,r10,r3
454	add	r6,r6,r3
455	ldrb	r3,[r1,#3]			@ 14
456	ldrb	r12,[r1,#2]
457	ldrb	r2,[r1,#1]
458	ldrb	r0,[r1],#4
459	orr	r3,r3,r12,lsl#8
460	orr	r3,r3,r2,lsl#16
461	orr	r3,r3,r0,lsl#24
462
463	ldr	r12,[r14],#4			@ *K256++
464	str	r3,[sp,#14*4]
465	mov	r0,r10,ror#6
466	eor	r0,r0,r10,ror#11
467	eor	r0,r0,r10,ror#25	@ Sigma1(e)
468	add	r3,r3,r0
469	eor	r2,r11,r4
470	and	r2,r2,r10
471	eor	r2,r2,r4			@ Ch(e,f,g)
472	add	r3,r3,r2
473	add	r3,r3,r5
474	add	r3,r3,r12
475	mov	r5,r6,ror#2
476	eor	r5,r5,r6,ror#13
477	eor	r5,r5,r6,ror#22		@ Sigma0(a)
478	orr	r0,r6,r7
479	and	r0,r0,r8
480	and	r2,r6,r7
481	orr	r0,r0,r2			@ Maj(a,b,c)
482	add	r5,r5,r0
483	add	r9,r9,r3
484	add	r5,r5,r3
485	ldrb	r3,[r1,#3]			@ 15
486	ldrb	r12,[r1,#2]
487	ldrb	r2,[r1,#1]
488	ldrb	r0,[r1],#4
489	orr	r3,r3,r12,lsl#8
490	orr	r3,r3,r2,lsl#16
491	orr	r3,r3,r0,lsl#24
492	str	r1,[sp,#17*4]
493	ldr	r12,[r14],#4			@ *K256++
494	str	r3,[sp,#15*4]
495	mov	r0,r9,ror#6
496	eor	r0,r0,r9,ror#11
497	eor	r0,r0,r9,ror#25	@ Sigma1(e)
498	add	r3,r3,r0
499	eor	r2,r10,r11
500	and	r2,r2,r9
501	eor	r2,r2,r11			@ Ch(e,f,g)
502	add	r3,r3,r2
503	add	r3,r3,r4
504	add	r3,r3,r12
505	mov	r4,r5,ror#2
506	eor	r4,r4,r5,ror#13
507	eor	r4,r4,r5,ror#22		@ Sigma0(a)
508	orr	r0,r5,r6
509	and	r0,r0,r7
510	and	r2,r5,r6
511	orr	r0,r0,r2			@ Maj(a,b,c)
512	add	r4,r4,r0
513	add	r8,r8,r3
514	add	r4,r4,r3
515.Lrounds_16_xx:
516	ldr	r2,[sp,#1*4]	@ 16
517	ldr	r12,[sp,#14*4]
518	ldr	r3,[sp,#0*4]
519	ldr	r1,[sp,#9*4]
520	mov	r0,r2,ror#7
521	eor	r0,r0,r2,ror#18
522	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
523	mov	r2,r12,ror#17
524	eor	r2,r2,r12,ror#19
525	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
526	add	r3,r3,r0
527	add	r3,r3,r2
528	add	r3,r3,r1
529	ldr	r12,[r14],#4			@ *K256++
530	str	r3,[sp,#0*4]
531	mov	r0,r8,ror#6
532	eor	r0,r0,r8,ror#11
533	eor	r0,r0,r8,ror#25	@ Sigma1(e)
534	add	r3,r3,r0
535	eor	r2,r9,r10
536	and	r2,r2,r8
537	eor	r2,r2,r10			@ Ch(e,f,g)
538	add	r3,r3,r2
539	add	r3,r3,r11
540	add	r3,r3,r12
541	mov	r11,r4,ror#2
542	eor	r11,r11,r4,ror#13
543	eor	r11,r11,r4,ror#22		@ Sigma0(a)
544	orr	r0,r4,r5
545	and	r0,r0,r6
546	and	r2,r4,r5
547	orr	r0,r0,r2			@ Maj(a,b,c)
548	add	r11,r11,r0
549	add	r7,r7,r3
550	add	r11,r11,r3
551	ldr	r2,[sp,#2*4]	@ 17
552	ldr	r12,[sp,#15*4]
553	ldr	r3,[sp,#1*4]
554	ldr	r1,[sp,#10*4]
555	mov	r0,r2,ror#7
556	eor	r0,r0,r2,ror#18
557	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
558	mov	r2,r12,ror#17
559	eor	r2,r2,r12,ror#19
560	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
561	add	r3,r3,r0
562	add	r3,r3,r2
563	add	r3,r3,r1
564	ldr	r12,[r14],#4			@ *K256++
565	str	r3,[sp,#1*4]
566	mov	r0,r7,ror#6
567	eor	r0,r0,r7,ror#11
568	eor	r0,r0,r7,ror#25	@ Sigma1(e)
569	add	r3,r3,r0
570	eor	r2,r8,r9
571	and	r2,r2,r7
572	eor	r2,r2,r9			@ Ch(e,f,g)
573	add	r3,r3,r2
574	add	r3,r3,r10
575	add	r3,r3,r12
576	mov	r10,r11,ror#2
577	eor	r10,r10,r11,ror#13
578	eor	r10,r10,r11,ror#22		@ Sigma0(a)
579	orr	r0,r11,r4
580	and	r0,r0,r5
581	and	r2,r11,r4
582	orr	r0,r0,r2			@ Maj(a,b,c)
583	add	r10,r10,r0
584	add	r6,r6,r3
585	add	r10,r10,r3
586	ldr	r2,[sp,#3*4]	@ 18
587	ldr	r12,[sp,#0*4]
588	ldr	r3,[sp,#2*4]
589	ldr	r1,[sp,#11*4]
590	mov	r0,r2,ror#7
591	eor	r0,r0,r2,ror#18
592	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
593	mov	r2,r12,ror#17
594	eor	r2,r2,r12,ror#19
595	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
596	add	r3,r3,r0
597	add	r3,r3,r2
598	add	r3,r3,r1
599	ldr	r12,[r14],#4			@ *K256++
600	str	r3,[sp,#2*4]
601	mov	r0,r6,ror#6
602	eor	r0,r0,r6,ror#11
603	eor	r0,r0,r6,ror#25	@ Sigma1(e)
604	add	r3,r3,r0
605	eor	r2,r7,r8
606	and	r2,r2,r6
607	eor	r2,r2,r8			@ Ch(e,f,g)
608	add	r3,r3,r2
609	add	r3,r3,r9
610	add	r3,r3,r12
611	mov	r9,r10,ror#2
612	eor	r9,r9,r10,ror#13
613	eor	r9,r9,r10,ror#22		@ Sigma0(a)
614	orr	r0,r10,r11
615	and	r0,r0,r4
616	and	r2,r10,r11
617	orr	r0,r0,r2			@ Maj(a,b,c)
618	add	r9,r9,r0
619	add	r5,r5,r3
620	add	r9,r9,r3
621	ldr	r2,[sp,#4*4]	@ 19
622	ldr	r12,[sp,#1*4]
623	ldr	r3,[sp,#3*4]
624	ldr	r1,[sp,#12*4]
625	mov	r0,r2,ror#7
626	eor	r0,r0,r2,ror#18
627	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
628	mov	r2,r12,ror#17
629	eor	r2,r2,r12,ror#19
630	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
631	add	r3,r3,r0
632	add	r3,r3,r2
633	add	r3,r3,r1
634	ldr	r12,[r14],#4			@ *K256++
635	str	r3,[sp,#3*4]
636	mov	r0,r5,ror#6
637	eor	r0,r0,r5,ror#11
638	eor	r0,r0,r5,ror#25	@ Sigma1(e)
639	add	r3,r3,r0
640	eor	r2,r6,r7
641	and	r2,r2,r5
642	eor	r2,r2,r7			@ Ch(e,f,g)
643	add	r3,r3,r2
644	add	r3,r3,r8
645	add	r3,r3,r12
646	mov	r8,r9,ror#2
647	eor	r8,r8,r9,ror#13
648	eor	r8,r8,r9,ror#22		@ Sigma0(a)
649	orr	r0,r9,r10
650	and	r0,r0,r11
651	and	r2,r9,r10
652	orr	r0,r0,r2			@ Maj(a,b,c)
653	add	r8,r8,r0
654	add	r4,r4,r3
655	add	r8,r8,r3
656	ldr	r2,[sp,#5*4]	@ 20
657	ldr	r12,[sp,#2*4]
658	ldr	r3,[sp,#4*4]
659	ldr	r1,[sp,#13*4]
660	mov	r0,r2,ror#7
661	eor	r0,r0,r2,ror#18
662	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
663	mov	r2,r12,ror#17
664	eor	r2,r2,r12,ror#19
665	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
666	add	r3,r3,r0
667	add	r3,r3,r2
668	add	r3,r3,r1
669	ldr	r12,[r14],#4			@ *K256++
670	str	r3,[sp,#4*4]
671	mov	r0,r4,ror#6
672	eor	r0,r0,r4,ror#11
673	eor	r0,r0,r4,ror#25	@ Sigma1(e)
674	add	r3,r3,r0
675	eor	r2,r5,r6
676	and	r2,r2,r4
677	eor	r2,r2,r6			@ Ch(e,f,g)
678	add	r3,r3,r2
679	add	r3,r3,r7
680	add	r3,r3,r12
681	mov	r7,r8,ror#2
682	eor	r7,r7,r8,ror#13
683	eor	r7,r7,r8,ror#22		@ Sigma0(a)
684	orr	r0,r8,r9
685	and	r0,r0,r10
686	and	r2,r8,r9
687	orr	r0,r0,r2			@ Maj(a,b,c)
688	add	r7,r7,r0
689	add	r11,r11,r3
690	add	r7,r7,r3
691	ldr	r2,[sp,#6*4]	@ 21
692	ldr	r12,[sp,#3*4]
693	ldr	r3,[sp,#5*4]
694	ldr	r1,[sp,#14*4]
695	mov	r0,r2,ror#7
696	eor	r0,r0,r2,ror#18
697	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
698	mov	r2,r12,ror#17
699	eor	r2,r2,r12,ror#19
700	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
701	add	r3,r3,r0
702	add	r3,r3,r2
703	add	r3,r3,r1
704	ldr	r12,[r14],#4			@ *K256++
705	str	r3,[sp,#5*4]
706	mov	r0,r11,ror#6
707	eor	r0,r0,r11,ror#11
708	eor	r0,r0,r11,ror#25	@ Sigma1(e)
709	add	r3,r3,r0
710	eor	r2,r4,r5
711	and	r2,r2,r11
712	eor	r2,r2,r5			@ Ch(e,f,g)
713	add	r3,r3,r2
714	add	r3,r3,r6
715	add	r3,r3,r12
716	mov	r6,r7,ror#2
717	eor	r6,r6,r7,ror#13
718	eor	r6,r6,r7,ror#22		@ Sigma0(a)
719	orr	r0,r7,r8
720	and	r0,r0,r9
721	and	r2,r7,r8
722	orr	r0,r0,r2			@ Maj(a,b,c)
723	add	r6,r6,r0
724	add	r10,r10,r3
725	add	r6,r6,r3
726	ldr	r2,[sp,#7*4]	@ 22
727	ldr	r12,[sp,#4*4]
728	ldr	r3,[sp,#6*4]
729	ldr	r1,[sp,#15*4]
730	mov	r0,r2,ror#7
731	eor	r0,r0,r2,ror#18
732	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
733	mov	r2,r12,ror#17
734	eor	r2,r2,r12,ror#19
735	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
736	add	r3,r3,r0
737	add	r3,r3,r2
738	add	r3,r3,r1
739	ldr	r12,[r14],#4			@ *K256++
740	str	r3,[sp,#6*4]
741	mov	r0,r10,ror#6
742	eor	r0,r0,r10,ror#11
743	eor	r0,r0,r10,ror#25	@ Sigma1(e)
744	add	r3,r3,r0
745	eor	r2,r11,r4
746	and	r2,r2,r10
747	eor	r2,r2,r4			@ Ch(e,f,g)
748	add	r3,r3,r2
749	add	r3,r3,r5
750	add	r3,r3,r12
751	mov	r5,r6,ror#2
752	eor	r5,r5,r6,ror#13
753	eor	r5,r5,r6,ror#22		@ Sigma0(a)
754	orr	r0,r6,r7
755	and	r0,r0,r8
756	and	r2,r6,r7
757	orr	r0,r0,r2			@ Maj(a,b,c)
758	add	r5,r5,r0
759	add	r9,r9,r3
760	add	r5,r5,r3
761	ldr	r2,[sp,#8*4]	@ 23
762	ldr	r12,[sp,#5*4]
763	ldr	r3,[sp,#7*4]
764	ldr	r1,[sp,#0*4]
765	mov	r0,r2,ror#7
766	eor	r0,r0,r2,ror#18
767	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
768	mov	r2,r12,ror#17
769	eor	r2,r2,r12,ror#19
770	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
771	add	r3,r3,r0
772	add	r3,r3,r2
773	add	r3,r3,r1
774	ldr	r12,[r14],#4			@ *K256++
775	str	r3,[sp,#7*4]
776	mov	r0,r9,ror#6
777	eor	r0,r0,r9,ror#11
778	eor	r0,r0,r9,ror#25	@ Sigma1(e)
779	add	r3,r3,r0
780	eor	r2,r10,r11
781	and	r2,r2,r9
782	eor	r2,r2,r11			@ Ch(e,f,g)
783	add	r3,r3,r2
784	add	r3,r3,r4
785	add	r3,r3,r12
786	mov	r4,r5,ror#2
787	eor	r4,r4,r5,ror#13
788	eor	r4,r4,r5,ror#22		@ Sigma0(a)
789	orr	r0,r5,r6
790	and	r0,r0,r7
791	and	r2,r5,r6
792	orr	r0,r0,r2			@ Maj(a,b,c)
793	add	r4,r4,r0
794	add	r8,r8,r3
795	add	r4,r4,r3
796	ldr	r2,[sp,#9*4]	@ 24
797	ldr	r12,[sp,#6*4]
798	ldr	r3,[sp,#8*4]
799	ldr	r1,[sp,#1*4]
800	mov	r0,r2,ror#7
801	eor	r0,r0,r2,ror#18
802	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
803	mov	r2,r12,ror#17
804	eor	r2,r2,r12,ror#19
805	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
806	add	r3,r3,r0
807	add	r3,r3,r2
808	add	r3,r3,r1
809	ldr	r12,[r14],#4			@ *K256++
810	str	r3,[sp,#8*4]
811	mov	r0,r8,ror#6
812	eor	r0,r0,r8,ror#11
813	eor	r0,r0,r8,ror#25	@ Sigma1(e)
814	add	r3,r3,r0
815	eor	r2,r9,r10
816	and	r2,r2,r8
817	eor	r2,r2,r10			@ Ch(e,f,g)
818	add	r3,r3,r2
819	add	r3,r3,r11
820	add	r3,r3,r12
821	mov	r11,r4,ror#2
822	eor	r11,r11,r4,ror#13
823	eor	r11,r11,r4,ror#22		@ Sigma0(a)
824	orr	r0,r4,r5
825	and	r0,r0,r6
826	and	r2,r4,r5
827	orr	r0,r0,r2			@ Maj(a,b,c)
828	add	r11,r11,r0
829	add	r7,r7,r3
830	add	r11,r11,r3
831	ldr	r2,[sp,#10*4]	@ 25
832	ldr	r12,[sp,#7*4]
833	ldr	r3,[sp,#9*4]
834	ldr	r1,[sp,#2*4]
835	mov	r0,r2,ror#7
836	eor	r0,r0,r2,ror#18
837	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
838	mov	r2,r12,ror#17
839	eor	r2,r2,r12,ror#19
840	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
841	add	r3,r3,r0
842	add	r3,r3,r2
843	add	r3,r3,r1
844	ldr	r12,[r14],#4			@ *K256++
845	str	r3,[sp,#9*4]
846	mov	r0,r7,ror#6
847	eor	r0,r0,r7,ror#11
848	eor	r0,r0,r7,ror#25	@ Sigma1(e)
849	add	r3,r3,r0
850	eor	r2,r8,r9
851	and	r2,r2,r7
852	eor	r2,r2,r9			@ Ch(e,f,g)
853	add	r3,r3,r2
854	add	r3,r3,r10
855	add	r3,r3,r12
856	mov	r10,r11,ror#2
857	eor	r10,r10,r11,ror#13
858	eor	r10,r10,r11,ror#22		@ Sigma0(a)
859	orr	r0,r11,r4
860	and	r0,r0,r5
861	and	r2,r11,r4
862	orr	r0,r0,r2			@ Maj(a,b,c)
863	add	r10,r10,r0
864	add	r6,r6,r3
865	add	r10,r10,r3
866	ldr	r2,[sp,#11*4]	@ 26
867	ldr	r12,[sp,#8*4]
868	ldr	r3,[sp,#10*4]
869	ldr	r1,[sp,#3*4]
870	mov	r0,r2,ror#7
871	eor	r0,r0,r2,ror#18
872	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
873	mov	r2,r12,ror#17
874	eor	r2,r2,r12,ror#19
875	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
876	add	r3,r3,r0
877	add	r3,r3,r2
878	add	r3,r3,r1
879	ldr	r12,[r14],#4			@ *K256++
880	str	r3,[sp,#10*4]
881	mov	r0,r6,ror#6
882	eor	r0,r0,r6,ror#11
883	eor	r0,r0,r6,ror#25	@ Sigma1(e)
884	add	r3,r3,r0
885	eor	r2,r7,r8
886	and	r2,r2,r6
887	eor	r2,r2,r8			@ Ch(e,f,g)
888	add	r3,r3,r2
889	add	r3,r3,r9
890	add	r3,r3,r12
891	mov	r9,r10,ror#2
892	eor	r9,r9,r10,ror#13
893	eor	r9,r9,r10,ror#22		@ Sigma0(a)
894	orr	r0,r10,r11
895	and	r0,r0,r4
896	and	r2,r10,r11
897	orr	r0,r0,r2			@ Maj(a,b,c)
898	add	r9,r9,r0
899	add	r5,r5,r3
900	add	r9,r9,r3
901	ldr	r2,[sp,#12*4]	@ 27
902	ldr	r12,[sp,#9*4]
903	ldr	r3,[sp,#11*4]
904	ldr	r1,[sp,#4*4]
905	mov	r0,r2,ror#7
906	eor	r0,r0,r2,ror#18
907	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
908	mov	r2,r12,ror#17
909	eor	r2,r2,r12,ror#19
910	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
911	add	r3,r3,r0
912	add	r3,r3,r2
913	add	r3,r3,r1
914	ldr	r12,[r14],#4			@ *K256++
915	str	r3,[sp,#11*4]
916	mov	r0,r5,ror#6
917	eor	r0,r0,r5,ror#11
918	eor	r0,r0,r5,ror#25	@ Sigma1(e)
919	add	r3,r3,r0
920	eor	r2,r6,r7
921	and	r2,r2,r5
922	eor	r2,r2,r7			@ Ch(e,f,g)
923	add	r3,r3,r2
924	add	r3,r3,r8
925	add	r3,r3,r12
926	mov	r8,r9,ror#2
927	eor	r8,r8,r9,ror#13
928	eor	r8,r8,r9,ror#22		@ Sigma0(a)
929	orr	r0,r9,r10
930	and	r0,r0,r11
931	and	r2,r9,r10
932	orr	r0,r0,r2			@ Maj(a,b,c)
933	add	r8,r8,r0
934	add	r4,r4,r3
935	add	r8,r8,r3
936	ldr	r2,[sp,#13*4]	@ 28
937	ldr	r12,[sp,#10*4]
938	ldr	r3,[sp,#12*4]
939	ldr	r1,[sp,#5*4]
940	mov	r0,r2,ror#7
941	eor	r0,r0,r2,ror#18
942	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
943	mov	r2,r12,ror#17
944	eor	r2,r2,r12,ror#19
945	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
946	add	r3,r3,r0
947	add	r3,r3,r2
948	add	r3,r3,r1
949	ldr	r12,[r14],#4			@ *K256++
950	str	r3,[sp,#12*4]
951	mov	r0,r4,ror#6
952	eor	r0,r0,r4,ror#11
953	eor	r0,r0,r4,ror#25	@ Sigma1(e)
954	add	r3,r3,r0
955	eor	r2,r5,r6
956	and	r2,r2,r4
957	eor	r2,r2,r6			@ Ch(e,f,g)
958	add	r3,r3,r2
959	add	r3,r3,r7
960	add	r3,r3,r12
961	mov	r7,r8,ror#2
962	eor	r7,r7,r8,ror#13
963	eor	r7,r7,r8,ror#22		@ Sigma0(a)
964	orr	r0,r8,r9
965	and	r0,r0,r10
966	and	r2,r8,r9
967	orr	r0,r0,r2			@ Maj(a,b,c)
968	add	r7,r7,r0
969	add	r11,r11,r3
970	add	r7,r7,r3
971	ldr	r2,[sp,#14*4]	@ 29
972	ldr	r12,[sp,#11*4]
973	ldr	r3,[sp,#13*4]
974	ldr	r1,[sp,#6*4]
975	mov	r0,r2,ror#7
976	eor	r0,r0,r2,ror#18
977	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
978	mov	r2,r12,ror#17
979	eor	r2,r2,r12,ror#19
980	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
981	add	r3,r3,r0
982	add	r3,r3,r2
983	add	r3,r3,r1
984	ldr	r12,[r14],#4			@ *K256++
985	str	r3,[sp,#13*4]
986	mov	r0,r11,ror#6
987	eor	r0,r0,r11,ror#11
988	eor	r0,r0,r11,ror#25	@ Sigma1(e)
989	add	r3,r3,r0
990	eor	r2,r4,r5
991	and	r2,r2,r11
992	eor	r2,r2,r5			@ Ch(e,f,g)
993	add	r3,r3,r2
994	add	r3,r3,r6
995	add	r3,r3,r12
996	mov	r6,r7,ror#2
997	eor	r6,r6,r7,ror#13
998	eor	r6,r6,r7,ror#22		@ Sigma0(a)
999	orr	r0,r7,r8
1000	and	r0,r0,r9
1001	and	r2,r7,r8
1002	orr	r0,r0,r2			@ Maj(a,b,c)
1003	add	r6,r6,r0
1004	add	r10,r10,r3
1005	add	r6,r6,r3
1006	ldr	r2,[sp,#15*4]	@ 30
1007	ldr	r12,[sp,#12*4]
1008	ldr	r3,[sp,#14*4]
1009	ldr	r1,[sp,#7*4]
1010	mov	r0,r2,ror#7
1011	eor	r0,r0,r2,ror#18
1012	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
1013	mov	r2,r12,ror#17
1014	eor	r2,r2,r12,ror#19
1015	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
1016	add	r3,r3,r0
1017	add	r3,r3,r2
1018	add	r3,r3,r1
1019	ldr	r12,[r14],#4			@ *K256++
1020	str	r3,[sp,#14*4]
1021	mov	r0,r10,ror#6
1022	eor	r0,r0,r10,ror#11
1023	eor	r0,r0,r10,ror#25	@ Sigma1(e)
1024	add	r3,r3,r0
1025	eor	r2,r11,r4
1026	and	r2,r2,r10
1027	eor	r2,r2,r4			@ Ch(e,f,g)
1028	add	r3,r3,r2
1029	add	r3,r3,r5
1030	add	r3,r3,r12
1031	mov	r5,r6,ror#2
1032	eor	r5,r5,r6,ror#13
1033	eor	r5,r5,r6,ror#22		@ Sigma0(a)
1034	orr	r0,r6,r7
1035	and	r0,r0,r8
1036	and	r2,r6,r7
1037	orr	r0,r0,r2			@ Maj(a,b,c)
1038	add	r5,r5,r0
1039	add	r9,r9,r3
1040	add	r5,r5,r3
1041	ldr	r2,[sp,#0*4]	@ 31
1042	ldr	r12,[sp,#13*4]
1043	ldr	r3,[sp,#15*4]
1044	ldr	r1,[sp,#8*4]
1045	mov	r0,r2,ror#7
1046	eor	r0,r0,r2,ror#18
1047	eor	r0,r0,r2,lsr#3	@ sigma0(X[i+1])
1048	mov	r2,r12,ror#17
1049	eor	r2,r2,r12,ror#19
1050	eor	r2,r2,r12,lsr#10	@ sigma1(X[i+14])
1051	add	r3,r3,r0
1052	add	r3,r3,r2
1053	add	r3,r3,r1
1054	ldr	r12,[r14],#4			@ *K256++
1055	str	r3,[sp,#15*4]
1056	mov	r0,r9,ror#6
1057	eor	r0,r0,r9,ror#11
1058	eor	r0,r0,r9,ror#25	@ Sigma1(e)
1059	add	r3,r3,r0
1060	eor	r2,r10,r11
1061	and	r2,r2,r9
1062	eor	r2,r2,r11			@ Ch(e,f,g)
1063	add	r3,r3,r2
1064	add	r3,r3,r4
1065	add	r3,r3,r12
1066	mov	r4,r5,ror#2
1067	eor	r4,r4,r5,ror#13
1068	eor	r4,r4,r5,ror#22		@ Sigma0(a)
1069	orr	r0,r5,r6
1070	and	r0,r0,r7
1071	and	r2,r5,r6
1072	orr	r0,r0,r2			@ Maj(a,b,c)
1073	add	r4,r4,r0
1074	add	r8,r8,r3
1075	add	r4,r4,r3
1076	and	r12,r12,#0xff
1077	cmp	r12,#0xf2
1078	bne	.Lrounds_16_xx
1079
1080	ldr	r3,[sp,#16*4]		@ pull ctx
1081	ldr	r0,[r3,#0]
1082	ldr	r2,[r3,#4]
1083	ldr	r12,[r3,#8]
1084	add	r4,r4,r0
1085	ldr	r0,[r3,#12]
1086	add	r5,r5,r2
1087	ldr	r2,[r3,#16]
1088	add	r6,r6,r12
1089	ldr	r12,[r3,#20]
1090	add	r7,r7,r0
1091	ldr	r0,[r3,#24]
1092	add	r8,r8,r2
1093	ldr	r2,[r3,#28]
1094	add	r9,r9,r12
1095	ldr	r1,[sp,#17*4]		@ pull inp
1096	ldr	r12,[sp,#18*4]		@ pull inp+len
1097	add	r10,r10,r0
1098	add	r11,r11,r2
1099	stmia	r3,{r4,r5,r6,r7,r8,r9,r10,r11}
1100	cmp	r1,r12
1101	sub	r14,r14,#256	@ rewind Ktbl
1102	bne	.Loop
1103
1104	add	sp,sp,#19*4	@ destroy frame
1105	ldmia	sp!,{r4-r12,lr}
1106	tst	lr,#1
1107	moveq	pc,lr			@ be binary compatible with V4, yet
1108	.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
1109.size   sha256_block_data_order,.-sha256_block_data_order
1110.asciz  "SHA256 block transform for ARMv4, CRYPTOGAMS by <appro@openssl.org>"
1111.align	2
1112