1#include "arm_arch.h"
2
3.text
4.code	32
5
6.type	K256,%object
7.align	5
8K256:
9.word	0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
10.word	0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
11.word	0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
12.word	0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
13.word	0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
14.word	0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
15.word	0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
16.word	0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
17.word	0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
18.word	0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
19.word	0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
20.word	0xd192e819,0xd6990624,0xf40e3585,0x106aa070
21.word	0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
22.word	0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
23.word	0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
24.word	0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
25.size	K256,.-K256
26
27.global	sha256_block_data_order
28.type	sha256_block_data_order,%function
29sha256_block_data_order:
30	sub	r3,pc,#8		@ sha256_block_data_order
31	add	r2,r1,r2,lsl#6	@ len to point at the end of inp
32	stmdb	sp!,{r0,r1,r2,r4-r11,lr}
33	ldmia	r0,{r4,r5,r6,r7,r8,r9,r10,r11}
34	sub	r14,r3,#256		@ K256
35	sub	sp,sp,#16*4		@ alloca(X[16])
36.Loop:
37#if __ARM_ARCH__>=7
38	ldr	r3,[r1],#4
39#else
40	ldrb	r3,[r1,#3]			@ 0
41	ldrb	r12,[r1,#2]
42	ldrb	r2,[r1,#1]
43	ldrb	r0,[r1],#4
44	orr	r3,r3,r12,lsl#8
45	orr	r3,r3,r2,lsl#16
46	orr	r3,r3,r0,lsl#24
47#endif
48	mov	r0,r8,ror#6
49	ldr	r12,[r14],#4			@ *K256++
50	eor	r0,r0,r8,ror#11
51	eor	r2,r9,r10
52#if 0>=16
53	add	r3,r3,r1			@ from BODY_16_xx
54#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
55	rev	r3,r3
56#endif
57#if 0==15
58	str	r1,[sp,#17*4]			@ leave room for r1
59#endif
60	eor	r0,r0,r8,ror#25	@ Sigma1(e)
61	and	r2,r2,r8
62	str	r3,[sp,#0*4]
63	add	r3,r3,r0
64	eor	r2,r2,r10			@ Ch(e,f,g)
65	add	r3,r3,r11
66	mov	r11,r4,ror#2
67	add	r3,r3,r2
68	eor	r11,r11,r4,ror#13
69	add	r3,r3,r12
70	eor	r11,r11,r4,ror#22		@ Sigma0(a)
71#if 0>=15
72	ldr	r1,[sp,#2*4]		@ from BODY_16_xx
73#endif
74	orr	r0,r4,r5
75	and	r2,r4,r5
76	and	r0,r0,r6
77	add	r11,r11,r3
78	orr	r0,r0,r2			@ Maj(a,b,c)
79	add	r7,r7,r3
80	add	r11,r11,r0
81#if __ARM_ARCH__>=7
82	ldr	r3,[r1],#4
83#else
84	ldrb	r3,[r1,#3]			@ 1
85	ldrb	r12,[r1,#2]
86	ldrb	r2,[r1,#1]
87	ldrb	r0,[r1],#4
88	orr	r3,r3,r12,lsl#8
89	orr	r3,r3,r2,lsl#16
90	orr	r3,r3,r0,lsl#24
91#endif
92	mov	r0,r7,ror#6
93	ldr	r12,[r14],#4			@ *K256++
94	eor	r0,r0,r7,ror#11
95	eor	r2,r8,r9
96#if 1>=16
97	add	r3,r3,r1			@ from BODY_16_xx
98#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
99	rev	r3,r3
100#endif
101#if 1==15
102	str	r1,[sp,#17*4]			@ leave room for r1
103#endif
104	eor	r0,r0,r7,ror#25	@ Sigma1(e)
105	and	r2,r2,r7
106	str	r3,[sp,#1*4]
107	add	r3,r3,r0
108	eor	r2,r2,r9			@ Ch(e,f,g)
109	add	r3,r3,r10
110	mov	r10,r11,ror#2
111	add	r3,r3,r2
112	eor	r10,r10,r11,ror#13
113	add	r3,r3,r12
114	eor	r10,r10,r11,ror#22		@ Sigma0(a)
115#if 1>=15
116	ldr	r1,[sp,#3*4]		@ from BODY_16_xx
117#endif
118	orr	r0,r11,r4
119	and	r2,r11,r4
120	and	r0,r0,r5
121	add	r10,r10,r3
122	orr	r0,r0,r2			@ Maj(a,b,c)
123	add	r6,r6,r3
124	add	r10,r10,r0
125#if __ARM_ARCH__>=7
126	ldr	r3,[r1],#4
127#else
128	ldrb	r3,[r1,#3]			@ 2
129	ldrb	r12,[r1,#2]
130	ldrb	r2,[r1,#1]
131	ldrb	r0,[r1],#4
132	orr	r3,r3,r12,lsl#8
133	orr	r3,r3,r2,lsl#16
134	orr	r3,r3,r0,lsl#24
135#endif
136	mov	r0,r6,ror#6
137	ldr	r12,[r14],#4			@ *K256++
138	eor	r0,r0,r6,ror#11
139	eor	r2,r7,r8
140#if 2>=16
141	add	r3,r3,r1			@ from BODY_16_xx
142#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
143	rev	r3,r3
144#endif
145#if 2==15
146	str	r1,[sp,#17*4]			@ leave room for r1
147#endif
148	eor	r0,r0,r6,ror#25	@ Sigma1(e)
149	and	r2,r2,r6
150	str	r3,[sp,#2*4]
151	add	r3,r3,r0
152	eor	r2,r2,r8			@ Ch(e,f,g)
153	add	r3,r3,r9
154	mov	r9,r10,ror#2
155	add	r3,r3,r2
156	eor	r9,r9,r10,ror#13
157	add	r3,r3,r12
158	eor	r9,r9,r10,ror#22		@ Sigma0(a)
159#if 2>=15
160	ldr	r1,[sp,#4*4]		@ from BODY_16_xx
161#endif
162	orr	r0,r10,r11
163	and	r2,r10,r11
164	and	r0,r0,r4
165	add	r9,r9,r3
166	orr	r0,r0,r2			@ Maj(a,b,c)
167	add	r5,r5,r3
168	add	r9,r9,r0
169#if __ARM_ARCH__>=7
170	ldr	r3,[r1],#4
171#else
172	ldrb	r3,[r1,#3]			@ 3
173	ldrb	r12,[r1,#2]
174	ldrb	r2,[r1,#1]
175	ldrb	r0,[r1],#4
176	orr	r3,r3,r12,lsl#8
177	orr	r3,r3,r2,lsl#16
178	orr	r3,r3,r0,lsl#24
179#endif
180	mov	r0,r5,ror#6
181	ldr	r12,[r14],#4			@ *K256++
182	eor	r0,r0,r5,ror#11
183	eor	r2,r6,r7
184#if 3>=16
185	add	r3,r3,r1			@ from BODY_16_xx
186#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
187	rev	r3,r3
188#endif
189#if 3==15
190	str	r1,[sp,#17*4]			@ leave room for r1
191#endif
192	eor	r0,r0,r5,ror#25	@ Sigma1(e)
193	and	r2,r2,r5
194	str	r3,[sp,#3*4]
195	add	r3,r3,r0
196	eor	r2,r2,r7			@ Ch(e,f,g)
197	add	r3,r3,r8
198	mov	r8,r9,ror#2
199	add	r3,r3,r2
200	eor	r8,r8,r9,ror#13
201	add	r3,r3,r12
202	eor	r8,r8,r9,ror#22		@ Sigma0(a)
203#if 3>=15
204	ldr	r1,[sp,#5*4]		@ from BODY_16_xx
205#endif
206	orr	r0,r9,r10
207	and	r2,r9,r10
208	and	r0,r0,r11
209	add	r8,r8,r3
210	orr	r0,r0,r2			@ Maj(a,b,c)
211	add	r4,r4,r3
212	add	r8,r8,r0
213#if __ARM_ARCH__>=7
214	ldr	r3,[r1],#4
215#else
216	ldrb	r3,[r1,#3]			@ 4
217	ldrb	r12,[r1,#2]
218	ldrb	r2,[r1,#1]
219	ldrb	r0,[r1],#4
220	orr	r3,r3,r12,lsl#8
221	orr	r3,r3,r2,lsl#16
222	orr	r3,r3,r0,lsl#24
223#endif
224	mov	r0,r4,ror#6
225	ldr	r12,[r14],#4			@ *K256++
226	eor	r0,r0,r4,ror#11
227	eor	r2,r5,r6
228#if 4>=16
229	add	r3,r3,r1			@ from BODY_16_xx
230#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
231	rev	r3,r3
232#endif
233#if 4==15
234	str	r1,[sp,#17*4]			@ leave room for r1
235#endif
236	eor	r0,r0,r4,ror#25	@ Sigma1(e)
237	and	r2,r2,r4
238	str	r3,[sp,#4*4]
239	add	r3,r3,r0
240	eor	r2,r2,r6			@ Ch(e,f,g)
241	add	r3,r3,r7
242	mov	r7,r8,ror#2
243	add	r3,r3,r2
244	eor	r7,r7,r8,ror#13
245	add	r3,r3,r12
246	eor	r7,r7,r8,ror#22		@ Sigma0(a)
247#if 4>=15
248	ldr	r1,[sp,#6*4]		@ from BODY_16_xx
249#endif
250	orr	r0,r8,r9
251	and	r2,r8,r9
252	and	r0,r0,r10
253	add	r7,r7,r3
254	orr	r0,r0,r2			@ Maj(a,b,c)
255	add	r11,r11,r3
256	add	r7,r7,r0
257#if __ARM_ARCH__>=7
258	ldr	r3,[r1],#4
259#else
260	ldrb	r3,[r1,#3]			@ 5
261	ldrb	r12,[r1,#2]
262	ldrb	r2,[r1,#1]
263	ldrb	r0,[r1],#4
264	orr	r3,r3,r12,lsl#8
265	orr	r3,r3,r2,lsl#16
266	orr	r3,r3,r0,lsl#24
267#endif
268	mov	r0,r11,ror#6
269	ldr	r12,[r14],#4			@ *K256++
270	eor	r0,r0,r11,ror#11
271	eor	r2,r4,r5
272#if 5>=16
273	add	r3,r3,r1			@ from BODY_16_xx
274#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
275	rev	r3,r3
276#endif
277#if 5==15
278	str	r1,[sp,#17*4]			@ leave room for r1
279#endif
280	eor	r0,r0,r11,ror#25	@ Sigma1(e)
281	and	r2,r2,r11
282	str	r3,[sp,#5*4]
283	add	r3,r3,r0
284	eor	r2,r2,r5			@ Ch(e,f,g)
285	add	r3,r3,r6
286	mov	r6,r7,ror#2
287	add	r3,r3,r2
288	eor	r6,r6,r7,ror#13
289	add	r3,r3,r12
290	eor	r6,r6,r7,ror#22		@ Sigma0(a)
291#if 5>=15
292	ldr	r1,[sp,#7*4]		@ from BODY_16_xx
293#endif
294	orr	r0,r7,r8
295	and	r2,r7,r8
296	and	r0,r0,r9
297	add	r6,r6,r3
298	orr	r0,r0,r2			@ Maj(a,b,c)
299	add	r10,r10,r3
300	add	r6,r6,r0
301#if __ARM_ARCH__>=7
302	ldr	r3,[r1],#4
303#else
304	ldrb	r3,[r1,#3]			@ 6
305	ldrb	r12,[r1,#2]
306	ldrb	r2,[r1,#1]
307	ldrb	r0,[r1],#4
308	orr	r3,r3,r12,lsl#8
309	orr	r3,r3,r2,lsl#16
310	orr	r3,r3,r0,lsl#24
311#endif
312	mov	r0,r10,ror#6
313	ldr	r12,[r14],#4			@ *K256++
314	eor	r0,r0,r10,ror#11
315	eor	r2,r11,r4
316#if 6>=16
317	add	r3,r3,r1			@ from BODY_16_xx
318#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
319	rev	r3,r3
320#endif
321#if 6==15
322	str	r1,[sp,#17*4]			@ leave room for r1
323#endif
324	eor	r0,r0,r10,ror#25	@ Sigma1(e)
325	and	r2,r2,r10
326	str	r3,[sp,#6*4]
327	add	r3,r3,r0
328	eor	r2,r2,r4			@ Ch(e,f,g)
329	add	r3,r3,r5
330	mov	r5,r6,ror#2
331	add	r3,r3,r2
332	eor	r5,r5,r6,ror#13
333	add	r3,r3,r12
334	eor	r5,r5,r6,ror#22		@ Sigma0(a)
335#if 6>=15
336	ldr	r1,[sp,#8*4]		@ from BODY_16_xx
337#endif
338	orr	r0,r6,r7
339	and	r2,r6,r7
340	and	r0,r0,r8
341	add	r5,r5,r3
342	orr	r0,r0,r2			@ Maj(a,b,c)
343	add	r9,r9,r3
344	add	r5,r5,r0
345#if __ARM_ARCH__>=7
346	ldr	r3,[r1],#4
347#else
348	ldrb	r3,[r1,#3]			@ 7
349	ldrb	r12,[r1,#2]
350	ldrb	r2,[r1,#1]
351	ldrb	r0,[r1],#4
352	orr	r3,r3,r12,lsl#8
353	orr	r3,r3,r2,lsl#16
354	orr	r3,r3,r0,lsl#24
355#endif
356	mov	r0,r9,ror#6
357	ldr	r12,[r14],#4			@ *K256++
358	eor	r0,r0,r9,ror#11
359	eor	r2,r10,r11
360#if 7>=16
361	add	r3,r3,r1			@ from BODY_16_xx
362#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
363	rev	r3,r3
364#endif
365#if 7==15
366	str	r1,[sp,#17*4]			@ leave room for r1
367#endif
368	eor	r0,r0,r9,ror#25	@ Sigma1(e)
369	and	r2,r2,r9
370	str	r3,[sp,#7*4]
371	add	r3,r3,r0
372	eor	r2,r2,r11			@ Ch(e,f,g)
373	add	r3,r3,r4
374	mov	r4,r5,ror#2
375	add	r3,r3,r2
376	eor	r4,r4,r5,ror#13
377	add	r3,r3,r12
378	eor	r4,r4,r5,ror#22		@ Sigma0(a)
379#if 7>=15
380	ldr	r1,[sp,#9*4]		@ from BODY_16_xx
381#endif
382	orr	r0,r5,r6
383	and	r2,r5,r6
384	and	r0,r0,r7
385	add	r4,r4,r3
386	orr	r0,r0,r2			@ Maj(a,b,c)
387	add	r8,r8,r3
388	add	r4,r4,r0
389#if __ARM_ARCH__>=7
390	ldr	r3,[r1],#4
391#else
392	ldrb	r3,[r1,#3]			@ 8
393	ldrb	r12,[r1,#2]
394	ldrb	r2,[r1,#1]
395	ldrb	r0,[r1],#4
396	orr	r3,r3,r12,lsl#8
397	orr	r3,r3,r2,lsl#16
398	orr	r3,r3,r0,lsl#24
399#endif
400	mov	r0,r8,ror#6
401	ldr	r12,[r14],#4			@ *K256++
402	eor	r0,r0,r8,ror#11
403	eor	r2,r9,r10
404#if 8>=16
405	add	r3,r3,r1			@ from BODY_16_xx
406#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
407	rev	r3,r3
408#endif
409#if 8==15
410	str	r1,[sp,#17*4]			@ leave room for r1
411#endif
412	eor	r0,r0,r8,ror#25	@ Sigma1(e)
413	and	r2,r2,r8
414	str	r3,[sp,#8*4]
415	add	r3,r3,r0
416	eor	r2,r2,r10			@ Ch(e,f,g)
417	add	r3,r3,r11
418	mov	r11,r4,ror#2
419	add	r3,r3,r2
420	eor	r11,r11,r4,ror#13
421	add	r3,r3,r12
422	eor	r11,r11,r4,ror#22		@ Sigma0(a)
423#if 8>=15
424	ldr	r1,[sp,#10*4]		@ from BODY_16_xx
425#endif
426	orr	r0,r4,r5
427	and	r2,r4,r5
428	and	r0,r0,r6
429	add	r11,r11,r3
430	orr	r0,r0,r2			@ Maj(a,b,c)
431	add	r7,r7,r3
432	add	r11,r11,r0
433#if __ARM_ARCH__>=7
434	ldr	r3,[r1],#4
435#else
436	ldrb	r3,[r1,#3]			@ 9
437	ldrb	r12,[r1,#2]
438	ldrb	r2,[r1,#1]
439	ldrb	r0,[r1],#4
440	orr	r3,r3,r12,lsl#8
441	orr	r3,r3,r2,lsl#16
442	orr	r3,r3,r0,lsl#24
443#endif
444	mov	r0,r7,ror#6
445	ldr	r12,[r14],#4			@ *K256++
446	eor	r0,r0,r7,ror#11
447	eor	r2,r8,r9
448#if 9>=16
449	add	r3,r3,r1			@ from BODY_16_xx
450#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
451	rev	r3,r3
452#endif
453#if 9==15
454	str	r1,[sp,#17*4]			@ leave room for r1
455#endif
456	eor	r0,r0,r7,ror#25	@ Sigma1(e)
457	and	r2,r2,r7
458	str	r3,[sp,#9*4]
459	add	r3,r3,r0
460	eor	r2,r2,r9			@ Ch(e,f,g)
461	add	r3,r3,r10
462	mov	r10,r11,ror#2
463	add	r3,r3,r2
464	eor	r10,r10,r11,ror#13
465	add	r3,r3,r12
466	eor	r10,r10,r11,ror#22		@ Sigma0(a)
467#if 9>=15
468	ldr	r1,[sp,#11*4]		@ from BODY_16_xx
469#endif
470	orr	r0,r11,r4
471	and	r2,r11,r4
472	and	r0,r0,r5
473	add	r10,r10,r3
474	orr	r0,r0,r2			@ Maj(a,b,c)
475	add	r6,r6,r3
476	add	r10,r10,r0
477#if __ARM_ARCH__>=7
478	ldr	r3,[r1],#4
479#else
480	ldrb	r3,[r1,#3]			@ 10
481	ldrb	r12,[r1,#2]
482	ldrb	r2,[r1,#1]
483	ldrb	r0,[r1],#4
484	orr	r3,r3,r12,lsl#8
485	orr	r3,r3,r2,lsl#16
486	orr	r3,r3,r0,lsl#24
487#endif
488	mov	r0,r6,ror#6
489	ldr	r12,[r14],#4			@ *K256++
490	eor	r0,r0,r6,ror#11
491	eor	r2,r7,r8
492#if 10>=16
493	add	r3,r3,r1			@ from BODY_16_xx
494#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
495	rev	r3,r3
496#endif
497#if 10==15
498	str	r1,[sp,#17*4]			@ leave room for r1
499#endif
500	eor	r0,r0,r6,ror#25	@ Sigma1(e)
501	and	r2,r2,r6
502	str	r3,[sp,#10*4]
503	add	r3,r3,r0
504	eor	r2,r2,r8			@ Ch(e,f,g)
505	add	r3,r3,r9
506	mov	r9,r10,ror#2
507	add	r3,r3,r2
508	eor	r9,r9,r10,ror#13
509	add	r3,r3,r12
510	eor	r9,r9,r10,ror#22		@ Sigma0(a)
511#if 10>=15
512	ldr	r1,[sp,#12*4]		@ from BODY_16_xx
513#endif
514	orr	r0,r10,r11
515	and	r2,r10,r11
516	and	r0,r0,r4
517	add	r9,r9,r3
518	orr	r0,r0,r2			@ Maj(a,b,c)
519	add	r5,r5,r3
520	add	r9,r9,r0
521#if __ARM_ARCH__>=7
522	ldr	r3,[r1],#4
523#else
524	ldrb	r3,[r1,#3]			@ 11
525	ldrb	r12,[r1,#2]
526	ldrb	r2,[r1,#1]
527	ldrb	r0,[r1],#4
528	orr	r3,r3,r12,lsl#8
529	orr	r3,r3,r2,lsl#16
530	orr	r3,r3,r0,lsl#24
531#endif
532	mov	r0,r5,ror#6
533	ldr	r12,[r14],#4			@ *K256++
534	eor	r0,r0,r5,ror#11
535	eor	r2,r6,r7
536#if 11>=16
537	add	r3,r3,r1			@ from BODY_16_xx
538#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
539	rev	r3,r3
540#endif
541#if 11==15
542	str	r1,[sp,#17*4]			@ leave room for r1
543#endif
544	eor	r0,r0,r5,ror#25	@ Sigma1(e)
545	and	r2,r2,r5
546	str	r3,[sp,#11*4]
547	add	r3,r3,r0
548	eor	r2,r2,r7			@ Ch(e,f,g)
549	add	r3,r3,r8
550	mov	r8,r9,ror#2
551	add	r3,r3,r2
552	eor	r8,r8,r9,ror#13
553	add	r3,r3,r12
554	eor	r8,r8,r9,ror#22		@ Sigma0(a)
555#if 11>=15
556	ldr	r1,[sp,#13*4]		@ from BODY_16_xx
557#endif
558	orr	r0,r9,r10
559	and	r2,r9,r10
560	and	r0,r0,r11
561	add	r8,r8,r3
562	orr	r0,r0,r2			@ Maj(a,b,c)
563	add	r4,r4,r3
564	add	r8,r8,r0
565#if __ARM_ARCH__>=7
566	ldr	r3,[r1],#4
567#else
568	ldrb	r3,[r1,#3]			@ 12
569	ldrb	r12,[r1,#2]
570	ldrb	r2,[r1,#1]
571	ldrb	r0,[r1],#4
572	orr	r3,r3,r12,lsl#8
573	orr	r3,r3,r2,lsl#16
574	orr	r3,r3,r0,lsl#24
575#endif
576	mov	r0,r4,ror#6
577	ldr	r12,[r14],#4			@ *K256++
578	eor	r0,r0,r4,ror#11
579	eor	r2,r5,r6
580#if 12>=16
581	add	r3,r3,r1			@ from BODY_16_xx
582#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
583	rev	r3,r3
584#endif
585#if 12==15
586	str	r1,[sp,#17*4]			@ leave room for r1
587#endif
588	eor	r0,r0,r4,ror#25	@ Sigma1(e)
589	and	r2,r2,r4
590	str	r3,[sp,#12*4]
591	add	r3,r3,r0
592	eor	r2,r2,r6			@ Ch(e,f,g)
593	add	r3,r3,r7
594	mov	r7,r8,ror#2
595	add	r3,r3,r2
596	eor	r7,r7,r8,ror#13
597	add	r3,r3,r12
598	eor	r7,r7,r8,ror#22		@ Sigma0(a)
599#if 12>=15
600	ldr	r1,[sp,#14*4]		@ from BODY_16_xx
601#endif
602	orr	r0,r8,r9
603	and	r2,r8,r9
604	and	r0,r0,r10
605	add	r7,r7,r3
606	orr	r0,r0,r2			@ Maj(a,b,c)
607	add	r11,r11,r3
608	add	r7,r7,r0
609#if __ARM_ARCH__>=7
610	ldr	r3,[r1],#4
611#else
612	ldrb	r3,[r1,#3]			@ 13
613	ldrb	r12,[r1,#2]
614	ldrb	r2,[r1,#1]
615	ldrb	r0,[r1],#4
616	orr	r3,r3,r12,lsl#8
617	orr	r3,r3,r2,lsl#16
618	orr	r3,r3,r0,lsl#24
619#endif
620	mov	r0,r11,ror#6
621	ldr	r12,[r14],#4			@ *K256++
622	eor	r0,r0,r11,ror#11
623	eor	r2,r4,r5
624#if 13>=16
625	add	r3,r3,r1			@ from BODY_16_xx
626#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
627	rev	r3,r3
628#endif
629#if 13==15
630	str	r1,[sp,#17*4]			@ leave room for r1
631#endif
632	eor	r0,r0,r11,ror#25	@ Sigma1(e)
633	and	r2,r2,r11
634	str	r3,[sp,#13*4]
635	add	r3,r3,r0
636	eor	r2,r2,r5			@ Ch(e,f,g)
637	add	r3,r3,r6
638	mov	r6,r7,ror#2
639	add	r3,r3,r2
640	eor	r6,r6,r7,ror#13
641	add	r3,r3,r12
642	eor	r6,r6,r7,ror#22		@ Sigma0(a)
643#if 13>=15
644	ldr	r1,[sp,#15*4]		@ from BODY_16_xx
645#endif
646	orr	r0,r7,r8
647	and	r2,r7,r8
648	and	r0,r0,r9
649	add	r6,r6,r3
650	orr	r0,r0,r2			@ Maj(a,b,c)
651	add	r10,r10,r3
652	add	r6,r6,r0
653#if __ARM_ARCH__>=7
654	ldr	r3,[r1],#4
655#else
656	ldrb	r3,[r1,#3]			@ 14
657	ldrb	r12,[r1,#2]
658	ldrb	r2,[r1,#1]
659	ldrb	r0,[r1],#4
660	orr	r3,r3,r12,lsl#8
661	orr	r3,r3,r2,lsl#16
662	orr	r3,r3,r0,lsl#24
663#endif
664	mov	r0,r10,ror#6
665	ldr	r12,[r14],#4			@ *K256++
666	eor	r0,r0,r10,ror#11
667	eor	r2,r11,r4
668#if 14>=16
669	add	r3,r3,r1			@ from BODY_16_xx
670#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
671	rev	r3,r3
672#endif
673#if 14==15
674	str	r1,[sp,#17*4]			@ leave room for r1
675#endif
676	eor	r0,r0,r10,ror#25	@ Sigma1(e)
677	and	r2,r2,r10
678	str	r3,[sp,#14*4]
679	add	r3,r3,r0
680	eor	r2,r2,r4			@ Ch(e,f,g)
681	add	r3,r3,r5
682	mov	r5,r6,ror#2
683	add	r3,r3,r2
684	eor	r5,r5,r6,ror#13
685	add	r3,r3,r12
686	eor	r5,r5,r6,ror#22		@ Sigma0(a)
687#if 14>=15
688	ldr	r1,[sp,#0*4]		@ from BODY_16_xx
689#endif
690	orr	r0,r6,r7
691	and	r2,r6,r7
692	and	r0,r0,r8
693	add	r5,r5,r3
694	orr	r0,r0,r2			@ Maj(a,b,c)
695	add	r9,r9,r3
696	add	r5,r5,r0
697#if __ARM_ARCH__>=7
698	ldr	r3,[r1],#4
699#else
700	ldrb	r3,[r1,#3]			@ 15
701	ldrb	r12,[r1,#2]
702	ldrb	r2,[r1,#1]
703	ldrb	r0,[r1],#4
704	orr	r3,r3,r12,lsl#8
705	orr	r3,r3,r2,lsl#16
706	orr	r3,r3,r0,lsl#24
707#endif
708	mov	r0,r9,ror#6
709	ldr	r12,[r14],#4			@ *K256++
710	eor	r0,r0,r9,ror#11
711	eor	r2,r10,r11
712#if 15>=16
713	add	r3,r3,r1			@ from BODY_16_xx
714#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
715	rev	r3,r3
716#endif
717#if 15==15
718	str	r1,[sp,#17*4]			@ leave room for r1
719#endif
720	eor	r0,r0,r9,ror#25	@ Sigma1(e)
721	and	r2,r2,r9
722	str	r3,[sp,#15*4]
723	add	r3,r3,r0
724	eor	r2,r2,r11			@ Ch(e,f,g)
725	add	r3,r3,r4
726	mov	r4,r5,ror#2
727	add	r3,r3,r2
728	eor	r4,r4,r5,ror#13
729	add	r3,r3,r12
730	eor	r4,r4,r5,ror#22		@ Sigma0(a)
731#if 15>=15
732	ldr	r1,[sp,#1*4]		@ from BODY_16_xx
733#endif
734	orr	r0,r5,r6
735	and	r2,r5,r6
736	and	r0,r0,r7
737	add	r4,r4,r3
738	orr	r0,r0,r2			@ Maj(a,b,c)
739	add	r8,r8,r3
740	add	r4,r4,r0
741.Lrounds_16_xx:
742	@ ldr	r1,[sp,#1*4]		@ 16
743	ldr	r12,[sp,#14*4]
744	mov	r0,r1,ror#7
745	ldr	r3,[sp,#0*4]
746	eor	r0,r0,r1,ror#18
747	ldr	r2,[sp,#9*4]
748	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
749	mov	r1,r12,ror#17
750	add	r3,r3,r0
751	eor	r1,r1,r12,ror#19
752	add	r3,r3,r2
753	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
754	@ add	r3,r3,r1
755	mov	r0,r8,ror#6
756	ldr	r12,[r14],#4			@ *K256++
757	eor	r0,r0,r8,ror#11
758	eor	r2,r9,r10
759#if 16>=16
760	add	r3,r3,r1			@ from BODY_16_xx
761#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
762	rev	r3,r3
763#endif
764#if 16==15
765	str	r1,[sp,#17*4]			@ leave room for r1
766#endif
767	eor	r0,r0,r8,ror#25	@ Sigma1(e)
768	and	r2,r2,r8
769	str	r3,[sp,#0*4]
770	add	r3,r3,r0
771	eor	r2,r2,r10			@ Ch(e,f,g)
772	add	r3,r3,r11
773	mov	r11,r4,ror#2
774	add	r3,r3,r2
775	eor	r11,r11,r4,ror#13
776	add	r3,r3,r12
777	eor	r11,r11,r4,ror#22		@ Sigma0(a)
778#if 16>=15
779	ldr	r1,[sp,#2*4]		@ from BODY_16_xx
780#endif
781	orr	r0,r4,r5
782	and	r2,r4,r5
783	and	r0,r0,r6
784	add	r11,r11,r3
785	orr	r0,r0,r2			@ Maj(a,b,c)
786	add	r7,r7,r3
787	add	r11,r11,r0
788	@ ldr	r1,[sp,#2*4]		@ 17
789	ldr	r12,[sp,#15*4]
790	mov	r0,r1,ror#7
791	ldr	r3,[sp,#1*4]
792	eor	r0,r0,r1,ror#18
793	ldr	r2,[sp,#10*4]
794	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
795	mov	r1,r12,ror#17
796	add	r3,r3,r0
797	eor	r1,r1,r12,ror#19
798	add	r3,r3,r2
799	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
800	@ add	r3,r3,r1
801	mov	r0,r7,ror#6
802	ldr	r12,[r14],#4			@ *K256++
803	eor	r0,r0,r7,ror#11
804	eor	r2,r8,r9
805#if 17>=16
806	add	r3,r3,r1			@ from BODY_16_xx
807#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
808	rev	r3,r3
809#endif
810#if 17==15
811	str	r1,[sp,#17*4]			@ leave room for r1
812#endif
813	eor	r0,r0,r7,ror#25	@ Sigma1(e)
814	and	r2,r2,r7
815	str	r3,[sp,#1*4]
816	add	r3,r3,r0
817	eor	r2,r2,r9			@ Ch(e,f,g)
818	add	r3,r3,r10
819	mov	r10,r11,ror#2
820	add	r3,r3,r2
821	eor	r10,r10,r11,ror#13
822	add	r3,r3,r12
823	eor	r10,r10,r11,ror#22		@ Sigma0(a)
824#if 17>=15
825	ldr	r1,[sp,#3*4]		@ from BODY_16_xx
826#endif
827	orr	r0,r11,r4
828	and	r2,r11,r4
829	and	r0,r0,r5
830	add	r10,r10,r3
831	orr	r0,r0,r2			@ Maj(a,b,c)
832	add	r6,r6,r3
833	add	r10,r10,r0
834	@ ldr	r1,[sp,#3*4]		@ 18
835	ldr	r12,[sp,#0*4]
836	mov	r0,r1,ror#7
837	ldr	r3,[sp,#2*4]
838	eor	r0,r0,r1,ror#18
839	ldr	r2,[sp,#11*4]
840	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
841	mov	r1,r12,ror#17
842	add	r3,r3,r0
843	eor	r1,r1,r12,ror#19
844	add	r3,r3,r2
845	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
846	@ add	r3,r3,r1
847	mov	r0,r6,ror#6
848	ldr	r12,[r14],#4			@ *K256++
849	eor	r0,r0,r6,ror#11
850	eor	r2,r7,r8
851#if 18>=16
852	add	r3,r3,r1			@ from BODY_16_xx
853#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
854	rev	r3,r3
855#endif
856#if 18==15
857	str	r1,[sp,#17*4]			@ leave room for r1
858#endif
859	eor	r0,r0,r6,ror#25	@ Sigma1(e)
860	and	r2,r2,r6
861	str	r3,[sp,#2*4]
862	add	r3,r3,r0
863	eor	r2,r2,r8			@ Ch(e,f,g)
864	add	r3,r3,r9
865	mov	r9,r10,ror#2
866	add	r3,r3,r2
867	eor	r9,r9,r10,ror#13
868	add	r3,r3,r12
869	eor	r9,r9,r10,ror#22		@ Sigma0(a)
870#if 18>=15
871	ldr	r1,[sp,#4*4]		@ from BODY_16_xx
872#endif
873	orr	r0,r10,r11
874	and	r2,r10,r11
875	and	r0,r0,r4
876	add	r9,r9,r3
877	orr	r0,r0,r2			@ Maj(a,b,c)
878	add	r5,r5,r3
879	add	r9,r9,r0
880	@ ldr	r1,[sp,#4*4]		@ 19
881	ldr	r12,[sp,#1*4]
882	mov	r0,r1,ror#7
883	ldr	r3,[sp,#3*4]
884	eor	r0,r0,r1,ror#18
885	ldr	r2,[sp,#12*4]
886	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
887	mov	r1,r12,ror#17
888	add	r3,r3,r0
889	eor	r1,r1,r12,ror#19
890	add	r3,r3,r2
891	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
892	@ add	r3,r3,r1
893	mov	r0,r5,ror#6
894	ldr	r12,[r14],#4			@ *K256++
895	eor	r0,r0,r5,ror#11
896	eor	r2,r6,r7
897#if 19>=16
898	add	r3,r3,r1			@ from BODY_16_xx
899#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
900	rev	r3,r3
901#endif
902#if 19==15
903	str	r1,[sp,#17*4]			@ leave room for r1
904#endif
905	eor	r0,r0,r5,ror#25	@ Sigma1(e)
906	and	r2,r2,r5
907	str	r3,[sp,#3*4]
908	add	r3,r3,r0
909	eor	r2,r2,r7			@ Ch(e,f,g)
910	add	r3,r3,r8
911	mov	r8,r9,ror#2
912	add	r3,r3,r2
913	eor	r8,r8,r9,ror#13
914	add	r3,r3,r12
915	eor	r8,r8,r9,ror#22		@ Sigma0(a)
916#if 19>=15
917	ldr	r1,[sp,#5*4]		@ from BODY_16_xx
918#endif
919	orr	r0,r9,r10
920	and	r2,r9,r10
921	and	r0,r0,r11
922	add	r8,r8,r3
923	orr	r0,r0,r2			@ Maj(a,b,c)
924	add	r4,r4,r3
925	add	r8,r8,r0
926	@ ldr	r1,[sp,#5*4]		@ 20
927	ldr	r12,[sp,#2*4]
928	mov	r0,r1,ror#7
929	ldr	r3,[sp,#4*4]
930	eor	r0,r0,r1,ror#18
931	ldr	r2,[sp,#13*4]
932	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
933	mov	r1,r12,ror#17
934	add	r3,r3,r0
935	eor	r1,r1,r12,ror#19
936	add	r3,r3,r2
937	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
938	@ add	r3,r3,r1
939	mov	r0,r4,ror#6
940	ldr	r12,[r14],#4			@ *K256++
941	eor	r0,r0,r4,ror#11
942	eor	r2,r5,r6
943#if 20>=16
944	add	r3,r3,r1			@ from BODY_16_xx
945#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
946	rev	r3,r3
947#endif
948#if 20==15
949	str	r1,[sp,#17*4]			@ leave room for r1
950#endif
951	eor	r0,r0,r4,ror#25	@ Sigma1(e)
952	and	r2,r2,r4
953	str	r3,[sp,#4*4]
954	add	r3,r3,r0
955	eor	r2,r2,r6			@ Ch(e,f,g)
956	add	r3,r3,r7
957	mov	r7,r8,ror#2
958	add	r3,r3,r2
959	eor	r7,r7,r8,ror#13
960	add	r3,r3,r12
961	eor	r7,r7,r8,ror#22		@ Sigma0(a)
962#if 20>=15
963	ldr	r1,[sp,#6*4]		@ from BODY_16_xx
964#endif
965	orr	r0,r8,r9
966	and	r2,r8,r9
967	and	r0,r0,r10
968	add	r7,r7,r3
969	orr	r0,r0,r2			@ Maj(a,b,c)
970	add	r11,r11,r3
971	add	r7,r7,r0
972	@ ldr	r1,[sp,#6*4]		@ 21
973	ldr	r12,[sp,#3*4]
974	mov	r0,r1,ror#7
975	ldr	r3,[sp,#5*4]
976	eor	r0,r0,r1,ror#18
977	ldr	r2,[sp,#14*4]
978	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
979	mov	r1,r12,ror#17
980	add	r3,r3,r0
981	eor	r1,r1,r12,ror#19
982	add	r3,r3,r2
983	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
984	@ add	r3,r3,r1
985	mov	r0,r11,ror#6
986	ldr	r12,[r14],#4			@ *K256++
987	eor	r0,r0,r11,ror#11
988	eor	r2,r4,r5
989#if 21>=16
990	add	r3,r3,r1			@ from BODY_16_xx
991#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
992	rev	r3,r3
993#endif
994#if 21==15
995	str	r1,[sp,#17*4]			@ leave room for r1
996#endif
997	eor	r0,r0,r11,ror#25	@ Sigma1(e)
998	and	r2,r2,r11
999	str	r3,[sp,#5*4]
1000	add	r3,r3,r0
1001	eor	r2,r2,r5			@ Ch(e,f,g)
1002	add	r3,r3,r6
1003	mov	r6,r7,ror#2
1004	add	r3,r3,r2
1005	eor	r6,r6,r7,ror#13
1006	add	r3,r3,r12
1007	eor	r6,r6,r7,ror#22		@ Sigma0(a)
1008#if 21>=15
1009	ldr	r1,[sp,#7*4]		@ from BODY_16_xx
1010#endif
1011	orr	r0,r7,r8
1012	and	r2,r7,r8
1013	and	r0,r0,r9
1014	add	r6,r6,r3
1015	orr	r0,r0,r2			@ Maj(a,b,c)
1016	add	r10,r10,r3
1017	add	r6,r6,r0
1018	@ ldr	r1,[sp,#7*4]		@ 22
1019	ldr	r12,[sp,#4*4]
1020	mov	r0,r1,ror#7
1021	ldr	r3,[sp,#6*4]
1022	eor	r0,r0,r1,ror#18
1023	ldr	r2,[sp,#15*4]
1024	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1025	mov	r1,r12,ror#17
1026	add	r3,r3,r0
1027	eor	r1,r1,r12,ror#19
1028	add	r3,r3,r2
1029	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1030	@ add	r3,r3,r1
1031	mov	r0,r10,ror#6
1032	ldr	r12,[r14],#4			@ *K256++
1033	eor	r0,r0,r10,ror#11
1034	eor	r2,r11,r4
1035#if 22>=16
1036	add	r3,r3,r1			@ from BODY_16_xx
1037#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1038	rev	r3,r3
1039#endif
1040#if 22==15
1041	str	r1,[sp,#17*4]			@ leave room for r1
1042#endif
1043	eor	r0,r0,r10,ror#25	@ Sigma1(e)
1044	and	r2,r2,r10
1045	str	r3,[sp,#6*4]
1046	add	r3,r3,r0
1047	eor	r2,r2,r4			@ Ch(e,f,g)
1048	add	r3,r3,r5
1049	mov	r5,r6,ror#2
1050	add	r3,r3,r2
1051	eor	r5,r5,r6,ror#13
1052	add	r3,r3,r12
1053	eor	r5,r5,r6,ror#22		@ Sigma0(a)
1054#if 22>=15
1055	ldr	r1,[sp,#8*4]		@ from BODY_16_xx
1056#endif
1057	orr	r0,r6,r7
1058	and	r2,r6,r7
1059	and	r0,r0,r8
1060	add	r5,r5,r3
1061	orr	r0,r0,r2			@ Maj(a,b,c)
1062	add	r9,r9,r3
1063	add	r5,r5,r0
1064	@ ldr	r1,[sp,#8*4]		@ 23
1065	ldr	r12,[sp,#5*4]
1066	mov	r0,r1,ror#7
1067	ldr	r3,[sp,#7*4]
1068	eor	r0,r0,r1,ror#18
1069	ldr	r2,[sp,#0*4]
1070	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1071	mov	r1,r12,ror#17
1072	add	r3,r3,r0
1073	eor	r1,r1,r12,ror#19
1074	add	r3,r3,r2
1075	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1076	@ add	r3,r3,r1
1077	mov	r0,r9,ror#6
1078	ldr	r12,[r14],#4			@ *K256++
1079	eor	r0,r0,r9,ror#11
1080	eor	r2,r10,r11
1081#if 23>=16
1082	add	r3,r3,r1			@ from BODY_16_xx
1083#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1084	rev	r3,r3
1085#endif
1086#if 23==15
1087	str	r1,[sp,#17*4]			@ leave room for r1
1088#endif
1089	eor	r0,r0,r9,ror#25	@ Sigma1(e)
1090	and	r2,r2,r9
1091	str	r3,[sp,#7*4]
1092	add	r3,r3,r0
1093	eor	r2,r2,r11			@ Ch(e,f,g)
1094	add	r3,r3,r4
1095	mov	r4,r5,ror#2
1096	add	r3,r3,r2
1097	eor	r4,r4,r5,ror#13
1098	add	r3,r3,r12
1099	eor	r4,r4,r5,ror#22		@ Sigma0(a)
1100#if 23>=15
1101	ldr	r1,[sp,#9*4]		@ from BODY_16_xx
1102#endif
1103	orr	r0,r5,r6
1104	and	r2,r5,r6
1105	and	r0,r0,r7
1106	add	r4,r4,r3
1107	orr	r0,r0,r2			@ Maj(a,b,c)
1108	add	r8,r8,r3
1109	add	r4,r4,r0
1110	@ ldr	r1,[sp,#9*4]		@ 24
1111	ldr	r12,[sp,#6*4]
1112	mov	r0,r1,ror#7
1113	ldr	r3,[sp,#8*4]
1114	eor	r0,r0,r1,ror#18
1115	ldr	r2,[sp,#1*4]
1116	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1117	mov	r1,r12,ror#17
1118	add	r3,r3,r0
1119	eor	r1,r1,r12,ror#19
1120	add	r3,r3,r2
1121	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1122	@ add	r3,r3,r1
1123	mov	r0,r8,ror#6
1124	ldr	r12,[r14],#4			@ *K256++
1125	eor	r0,r0,r8,ror#11
1126	eor	r2,r9,r10
1127#if 24>=16
1128	add	r3,r3,r1			@ from BODY_16_xx
1129#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1130	rev	r3,r3
1131#endif
1132#if 24==15
1133	str	r1,[sp,#17*4]			@ leave room for r1
1134#endif
1135	eor	r0,r0,r8,ror#25	@ Sigma1(e)
1136	and	r2,r2,r8
1137	str	r3,[sp,#8*4]
1138	add	r3,r3,r0
1139	eor	r2,r2,r10			@ Ch(e,f,g)
1140	add	r3,r3,r11
1141	mov	r11,r4,ror#2
1142	add	r3,r3,r2
1143	eor	r11,r11,r4,ror#13
1144	add	r3,r3,r12
1145	eor	r11,r11,r4,ror#22		@ Sigma0(a)
1146#if 24>=15
1147	ldr	r1,[sp,#10*4]		@ from BODY_16_xx
1148#endif
1149	orr	r0,r4,r5
1150	and	r2,r4,r5
1151	and	r0,r0,r6
1152	add	r11,r11,r3
1153	orr	r0,r0,r2			@ Maj(a,b,c)
1154	add	r7,r7,r3
1155	add	r11,r11,r0
1156	@ ldr	r1,[sp,#10*4]		@ 25
1157	ldr	r12,[sp,#7*4]
1158	mov	r0,r1,ror#7
1159	ldr	r3,[sp,#9*4]
1160	eor	r0,r0,r1,ror#18
1161	ldr	r2,[sp,#2*4]
1162	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1163	mov	r1,r12,ror#17
1164	add	r3,r3,r0
1165	eor	r1,r1,r12,ror#19
1166	add	r3,r3,r2
1167	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1168	@ add	r3,r3,r1
1169	mov	r0,r7,ror#6
1170	ldr	r12,[r14],#4			@ *K256++
1171	eor	r0,r0,r7,ror#11
1172	eor	r2,r8,r9
1173#if 25>=16
1174	add	r3,r3,r1			@ from BODY_16_xx
1175#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1176	rev	r3,r3
1177#endif
1178#if 25==15
1179	str	r1,[sp,#17*4]			@ leave room for r1
1180#endif
1181	eor	r0,r0,r7,ror#25	@ Sigma1(e)
1182	and	r2,r2,r7
1183	str	r3,[sp,#9*4]
1184	add	r3,r3,r0
1185	eor	r2,r2,r9			@ Ch(e,f,g)
1186	add	r3,r3,r10
1187	mov	r10,r11,ror#2
1188	add	r3,r3,r2
1189	eor	r10,r10,r11,ror#13
1190	add	r3,r3,r12
1191	eor	r10,r10,r11,ror#22		@ Sigma0(a)
1192#if 25>=15
1193	ldr	r1,[sp,#11*4]		@ from BODY_16_xx
1194#endif
1195	orr	r0,r11,r4
1196	and	r2,r11,r4
1197	and	r0,r0,r5
1198	add	r10,r10,r3
1199	orr	r0,r0,r2			@ Maj(a,b,c)
1200	add	r6,r6,r3
1201	add	r10,r10,r0
1202	@ ldr	r1,[sp,#11*4]		@ 26
1203	ldr	r12,[sp,#8*4]
1204	mov	r0,r1,ror#7
1205	ldr	r3,[sp,#10*4]
1206	eor	r0,r0,r1,ror#18
1207	ldr	r2,[sp,#3*4]
1208	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1209	mov	r1,r12,ror#17
1210	add	r3,r3,r0
1211	eor	r1,r1,r12,ror#19
1212	add	r3,r3,r2
1213	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1214	@ add	r3,r3,r1
1215	mov	r0,r6,ror#6
1216	ldr	r12,[r14],#4			@ *K256++
1217	eor	r0,r0,r6,ror#11
1218	eor	r2,r7,r8
1219#if 26>=16
1220	add	r3,r3,r1			@ from BODY_16_xx
1221#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1222	rev	r3,r3
1223#endif
1224#if 26==15
1225	str	r1,[sp,#17*4]			@ leave room for r1
1226#endif
1227	eor	r0,r0,r6,ror#25	@ Sigma1(e)
1228	and	r2,r2,r6
1229	str	r3,[sp,#10*4]
1230	add	r3,r3,r0
1231	eor	r2,r2,r8			@ Ch(e,f,g)
1232	add	r3,r3,r9
1233	mov	r9,r10,ror#2
1234	add	r3,r3,r2
1235	eor	r9,r9,r10,ror#13
1236	add	r3,r3,r12
1237	eor	r9,r9,r10,ror#22		@ Sigma0(a)
1238#if 26>=15
1239	ldr	r1,[sp,#12*4]		@ from BODY_16_xx
1240#endif
1241	orr	r0,r10,r11
1242	and	r2,r10,r11
1243	and	r0,r0,r4
1244	add	r9,r9,r3
1245	orr	r0,r0,r2			@ Maj(a,b,c)
1246	add	r5,r5,r3
1247	add	r9,r9,r0
1248	@ ldr	r1,[sp,#12*4]		@ 27
1249	ldr	r12,[sp,#9*4]
1250	mov	r0,r1,ror#7
1251	ldr	r3,[sp,#11*4]
1252	eor	r0,r0,r1,ror#18
1253	ldr	r2,[sp,#4*4]
1254	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1255	mov	r1,r12,ror#17
1256	add	r3,r3,r0
1257	eor	r1,r1,r12,ror#19
1258	add	r3,r3,r2
1259	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1260	@ add	r3,r3,r1
1261	mov	r0,r5,ror#6
1262	ldr	r12,[r14],#4			@ *K256++
1263	eor	r0,r0,r5,ror#11
1264	eor	r2,r6,r7
1265#if 27>=16
1266	add	r3,r3,r1			@ from BODY_16_xx
1267#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1268	rev	r3,r3
1269#endif
1270#if 27==15
1271	str	r1,[sp,#17*4]			@ leave room for r1
1272#endif
1273	eor	r0,r0,r5,ror#25	@ Sigma1(e)
1274	and	r2,r2,r5
1275	str	r3,[sp,#11*4]
1276	add	r3,r3,r0
1277	eor	r2,r2,r7			@ Ch(e,f,g)
1278	add	r3,r3,r8
1279	mov	r8,r9,ror#2
1280	add	r3,r3,r2
1281	eor	r8,r8,r9,ror#13
1282	add	r3,r3,r12
1283	eor	r8,r8,r9,ror#22		@ Sigma0(a)
1284#if 27>=15
1285	ldr	r1,[sp,#13*4]		@ from BODY_16_xx
1286#endif
1287	orr	r0,r9,r10
1288	and	r2,r9,r10
1289	and	r0,r0,r11
1290	add	r8,r8,r3
1291	orr	r0,r0,r2			@ Maj(a,b,c)
1292	add	r4,r4,r3
1293	add	r8,r8,r0
1294	@ ldr	r1,[sp,#13*4]		@ 28
1295	ldr	r12,[sp,#10*4]
1296	mov	r0,r1,ror#7
1297	ldr	r3,[sp,#12*4]
1298	eor	r0,r0,r1,ror#18
1299	ldr	r2,[sp,#5*4]
1300	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1301	mov	r1,r12,ror#17
1302	add	r3,r3,r0
1303	eor	r1,r1,r12,ror#19
1304	add	r3,r3,r2
1305	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1306	@ add	r3,r3,r1
1307	mov	r0,r4,ror#6
1308	ldr	r12,[r14],#4			@ *K256++
1309	eor	r0,r0,r4,ror#11
1310	eor	r2,r5,r6
1311#if 28>=16
1312	add	r3,r3,r1			@ from BODY_16_xx
1313#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1314	rev	r3,r3
1315#endif
1316#if 28==15
1317	str	r1,[sp,#17*4]			@ leave room for r1
1318#endif
1319	eor	r0,r0,r4,ror#25	@ Sigma1(e)
1320	and	r2,r2,r4
1321	str	r3,[sp,#12*4]
1322	add	r3,r3,r0
1323	eor	r2,r2,r6			@ Ch(e,f,g)
1324	add	r3,r3,r7
1325	mov	r7,r8,ror#2
1326	add	r3,r3,r2
1327	eor	r7,r7,r8,ror#13
1328	add	r3,r3,r12
1329	eor	r7,r7,r8,ror#22		@ Sigma0(a)
1330#if 28>=15
1331	ldr	r1,[sp,#14*4]		@ from BODY_16_xx
1332#endif
1333	orr	r0,r8,r9
1334	and	r2,r8,r9
1335	and	r0,r0,r10
1336	add	r7,r7,r3
1337	orr	r0,r0,r2			@ Maj(a,b,c)
1338	add	r11,r11,r3
1339	add	r7,r7,r0
1340	@ ldr	r1,[sp,#14*4]		@ 29
1341	ldr	r12,[sp,#11*4]
1342	mov	r0,r1,ror#7
1343	ldr	r3,[sp,#13*4]
1344	eor	r0,r0,r1,ror#18
1345	ldr	r2,[sp,#6*4]
1346	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1347	mov	r1,r12,ror#17
1348	add	r3,r3,r0
1349	eor	r1,r1,r12,ror#19
1350	add	r3,r3,r2
1351	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1352	@ add	r3,r3,r1
1353	mov	r0,r11,ror#6
1354	ldr	r12,[r14],#4			@ *K256++
1355	eor	r0,r0,r11,ror#11
1356	eor	r2,r4,r5
1357#if 29>=16
1358	add	r3,r3,r1			@ from BODY_16_xx
1359#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1360	rev	r3,r3
1361#endif
1362#if 29==15
1363	str	r1,[sp,#17*4]			@ leave room for r1
1364#endif
1365	eor	r0,r0,r11,ror#25	@ Sigma1(e)
1366	and	r2,r2,r11
1367	str	r3,[sp,#13*4]
1368	add	r3,r3,r0
1369	eor	r2,r2,r5			@ Ch(e,f,g)
1370	add	r3,r3,r6
1371	mov	r6,r7,ror#2
1372	add	r3,r3,r2
1373	eor	r6,r6,r7,ror#13
1374	add	r3,r3,r12
1375	eor	r6,r6,r7,ror#22		@ Sigma0(a)
1376#if 29>=15
1377	ldr	r1,[sp,#15*4]		@ from BODY_16_xx
1378#endif
1379	orr	r0,r7,r8
1380	and	r2,r7,r8
1381	and	r0,r0,r9
1382	add	r6,r6,r3
1383	orr	r0,r0,r2			@ Maj(a,b,c)
1384	add	r10,r10,r3
1385	add	r6,r6,r0
1386	@ ldr	r1,[sp,#15*4]		@ 30
1387	ldr	r12,[sp,#12*4]
1388	mov	r0,r1,ror#7
1389	ldr	r3,[sp,#14*4]
1390	eor	r0,r0,r1,ror#18
1391	ldr	r2,[sp,#7*4]
1392	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1393	mov	r1,r12,ror#17
1394	add	r3,r3,r0
1395	eor	r1,r1,r12,ror#19
1396	add	r3,r3,r2
1397	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1398	@ add	r3,r3,r1
1399	mov	r0,r10,ror#6
1400	ldr	r12,[r14],#4			@ *K256++
1401	eor	r0,r0,r10,ror#11
1402	eor	r2,r11,r4
1403#if 30>=16
1404	add	r3,r3,r1			@ from BODY_16_xx
1405#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1406	rev	r3,r3
1407#endif
1408#if 30==15
1409	str	r1,[sp,#17*4]			@ leave room for r1
1410#endif
1411	eor	r0,r0,r10,ror#25	@ Sigma1(e)
1412	and	r2,r2,r10
1413	str	r3,[sp,#14*4]
1414	add	r3,r3,r0
1415	eor	r2,r2,r4			@ Ch(e,f,g)
1416	add	r3,r3,r5
1417	mov	r5,r6,ror#2
1418	add	r3,r3,r2
1419	eor	r5,r5,r6,ror#13
1420	add	r3,r3,r12
1421	eor	r5,r5,r6,ror#22		@ Sigma0(a)
1422#if 30>=15
1423	ldr	r1,[sp,#0*4]		@ from BODY_16_xx
1424#endif
1425	orr	r0,r6,r7
1426	and	r2,r6,r7
1427	and	r0,r0,r8
1428	add	r5,r5,r3
1429	orr	r0,r0,r2			@ Maj(a,b,c)
1430	add	r9,r9,r3
1431	add	r5,r5,r0
1432	@ ldr	r1,[sp,#0*4]		@ 31
1433	ldr	r12,[sp,#13*4]
1434	mov	r0,r1,ror#7
1435	ldr	r3,[sp,#15*4]
1436	eor	r0,r0,r1,ror#18
1437	ldr	r2,[sp,#8*4]
1438	eor	r0,r0,r1,lsr#3	@ sigma0(X[i+1])
1439	mov	r1,r12,ror#17
1440	add	r3,r3,r0
1441	eor	r1,r1,r12,ror#19
1442	add	r3,r3,r2
1443	eor	r1,r1,r12,lsr#10	@ sigma1(X[i+14])
1444	@ add	r3,r3,r1
1445	mov	r0,r9,ror#6
1446	ldr	r12,[r14],#4			@ *K256++
1447	eor	r0,r0,r9,ror#11
1448	eor	r2,r10,r11
1449#if 31>=16
1450	add	r3,r3,r1			@ from BODY_16_xx
1451#elif __ARM_ARCH__>=7 && defined(__ARMEL__)
1452	rev	r3,r3
1453#endif
1454#if 31==15
1455	str	r1,[sp,#17*4]			@ leave room for r1
1456#endif
1457	eor	r0,r0,r9,ror#25	@ Sigma1(e)
1458	and	r2,r2,r9
1459	str	r3,[sp,#15*4]
1460	add	r3,r3,r0
1461	eor	r2,r2,r11			@ Ch(e,f,g)
1462	add	r3,r3,r4
1463	mov	r4,r5,ror#2
1464	add	r3,r3,r2
1465	eor	r4,r4,r5,ror#13
1466	add	r3,r3,r12
1467	eor	r4,r4,r5,ror#22		@ Sigma0(a)
1468#if 31>=15
1469	ldr	r1,[sp,#1*4]		@ from BODY_16_xx
1470#endif
1471	orr	r0,r5,r6
1472	and	r2,r5,r6
1473	and	r0,r0,r7
1474	add	r4,r4,r3
1475	orr	r0,r0,r2			@ Maj(a,b,c)
1476	add	r8,r8,r3
1477	add	r4,r4,r0
1478	and	r12,r12,#0xff
1479	cmp	r12,#0xf2
1480	bne	.Lrounds_16_xx
1481
1482	ldr	r3,[sp,#16*4]		@ pull ctx
1483	ldr	r0,[r3,#0]
1484	ldr	r2,[r3,#4]
1485	ldr	r12,[r3,#8]
1486	add	r4,r4,r0
1487	ldr	r0,[r3,#12]
1488	add	r5,r5,r2
1489	ldr	r2,[r3,#16]
1490	add	r6,r6,r12
1491	ldr	r12,[r3,#20]
1492	add	r7,r7,r0
1493	ldr	r0,[r3,#24]
1494	add	r8,r8,r2
1495	ldr	r2,[r3,#28]
1496	add	r9,r9,r12
1497	ldr	r1,[sp,#17*4]		@ pull inp
1498	ldr	r12,[sp,#18*4]		@ pull inp+len
1499	add	r10,r10,r0
1500	add	r11,r11,r2
1501	stmia	r3,{r4,r5,r6,r7,r8,r9,r10,r11}
1502	cmp	r1,r12
1503	sub	r14,r14,#256	@ rewind Ktbl
1504	bne	.Loop
1505
1506	add	sp,sp,#19*4	@ destroy frame
1507#if __ARM_ARCH__>=5
1508	ldmia	sp!,{r4-r11,pc}
1509#else
1510	ldmia	sp!,{r4-r11,lr}
1511	tst	lr,#1
1512	moveq	pc,lr			@ be binary compatible with V4, yet
1513	.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
1514#endif
1515.size   sha256_block_data_order,.-sha256_block_data_order
1516.asciz  "SHA256 block transform for ARMv4, CRYPTOGAMS by <appro@openssl.org>"
1517.align	2
1518