1 @ SPDX-License-Identifier: GPL-2.0
3 @ This code is taken from the OpenSSL project but the author (Andy Polyakov)
4 @ has relicensed it under the GPLv2. Therefore this program is free software;
5 @ you can redistribute it and/or modify it under the terms of the GNU General
6 @ Public License version 2 as published by the Free Software Foundation.
8 @ The original headers, including the original license headers, are
9 @ included below for completeness.
11 @ ====================================================================
12 @ Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
13 @ project. The module is, however, dual licensed under OpenSSL and
14 @ CRYPTOGAMS licenses depending on where you obtain it. For further
15 @ details see http://www.openssl.org/~appro/cryptogams/.
16 @ ====================================================================
18 @ SHA256 block procedure for ARMv4. May 2007.
20 @ Performance is ~2x better than gcc 3.4 generated code and in "abso-
21 @ lute" terms is ~2250 cycles per 64-byte block or ~35 cycles per
22 @ byte [on single-issue Xscale PXA250 core].
26 @ Rescheduling for dual-issue pipeline resulted in 22% improvement on
27 @ Cortex A8 core and ~20 cycles per processed byte.
31 @ Profiler-assisted and platform-specific optimization resulted in 16%
32 @ improvement on Cortex A8 core and ~15.4 cycles per processed byte.
36 @ Add NEON implementation. On Cortex A8 it was measured to process one
37 @ byte in 12.5 cycles or 23% faster than integer-only code. Snapdragon
38 @ S4 does it in 12.5 cycles too, but it's 50% faster than integer-only
39 @ code (meaning that latter performs sub-optimally, nothing was done
44 @ Add ARMv8 code path performing at 2.0 cpb on Apple A7.
47 # include "arm_arch.h"
49 # define __ARM_ARCH__ __LINUX_ARM_ARCH__
50 # define __ARM_MAX_ARCH__ 7
69 .word 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
70 .word 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
71 .word 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
72 .word 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
73 .word 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
74 .word 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
75 .word 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
76 .word 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
77 .word 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
78 .word 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
79 .word 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
80 .word 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
81 .word 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
82 .word 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
83 .word 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
84 .word 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
87 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
89 .word OPENSSL_armcap_P-sha256_block_data_order
93 .global sha256_block_data_order
94 .type sha256_block_data_order,%function
95 sha256_block_data_order:
96 .Lsha256_block_data_order:
98 sub r3,pc,#8 @ sha256_block_data_order
100 adr r3,.Lsha256_block_data_order
102 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
103 ldr r12,.LOPENSSL_armcap
104 ldr r12,[r3,r12] @ OPENSSL_armcap_P
105 tst r12,#ARMV8_SHA256
110 add r2,r1,r2,lsl#6 @ len to point at the end of inp
111 stmdb sp!,{r0,r1,r2,r4-r11,lr}
112 ldmia r0,{r4,r5,r6,r7,r8,r9,r10,r11}
113 sub r14,r3,#256+32 @ K256
114 sub sp,sp,#16*4 @ alloca(X[16])
126 str r1,[sp,#17*4] @ make room for r1
129 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
130 eor r0,r0,r8,ror#19 @ Sigma1(e)
135 @ ldrb r2,[r1,#3] @ 0
136 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
143 str r1,[sp,#17*4] @ make room for r1
147 eor r0,r0,r8,ror#19 @ Sigma1(e)
149 ldr r12,[r14],#4 @ *K256++
150 add r11,r11,r2 @ h+=X[i]
153 add r11,r11,r0,ror#6 @ h+=Sigma1(e)
155 add r11,r11,r12 @ h+=K256[i]
156 eor r2,r2,r10 @ Ch(e,f,g)
158 add r11,r11,r2 @ h+=Ch(e,f,g)
161 cmp r12,#0xf2 @ done?
165 ldr r2,[r1],#4 @ prefetch
169 eor r12,r4,r5 @ a^b, b^c in next round
171 ldr r2,[sp,#2*4] @ from future BODY_16_xx
172 eor r12,r4,r5 @ a^b, b^c in next round
173 ldr r1,[sp,#15*4] @ from future BODY_16_xx
175 eor r0,r0,r4,ror#20 @ Sigma0(a)
176 and r3,r3,r12 @ (b^c)&=(a^b)
178 eor r3,r3,r5 @ Maj(a,b,c)
179 add r11,r11,r0,ror#2 @ h+=Sigma0(a)
180 @ add r11,r11,r3 @ h+=Maj(a,b,c)
184 str r1,[sp,#17*4] @ make room for r1
187 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
188 eor r0,r0,r7,ror#19 @ Sigma1(e)
193 @ ldrb r2,[r1,#3] @ 1
194 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
201 str r1,[sp,#17*4] @ make room for r1
205 eor r0,r0,r7,ror#19 @ Sigma1(e)
207 ldr r3,[r14],#4 @ *K256++
208 add r10,r10,r2 @ h+=X[i]
211 add r10,r10,r0,ror#6 @ h+=Sigma1(e)
213 add r10,r10,r3 @ h+=K256[i]
214 eor r2,r2,r9 @ Ch(e,f,g)
215 eor r0,r11,r11,ror#11
216 add r10,r10,r2 @ h+=Ch(e,f,g)
223 ldr r2,[r1],#4 @ prefetch
227 eor r3,r11,r4 @ a^b, b^c in next round
229 ldr r2,[sp,#3*4] @ from future BODY_16_xx
230 eor r3,r11,r4 @ a^b, b^c in next round
231 ldr r1,[sp,#0*4] @ from future BODY_16_xx
233 eor r0,r0,r11,ror#20 @ Sigma0(a)
234 and r12,r12,r3 @ (b^c)&=(a^b)
236 eor r12,r12,r4 @ Maj(a,b,c)
237 add r10,r10,r0,ror#2 @ h+=Sigma0(a)
238 @ add r10,r10,r12 @ h+=Maj(a,b,c)
242 str r1,[sp,#17*4] @ make room for r1
245 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
246 eor r0,r0,r6,ror#19 @ Sigma1(e)
251 @ ldrb r2,[r1,#3] @ 2
252 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
259 str r1,[sp,#17*4] @ make room for r1
263 eor r0,r0,r6,ror#19 @ Sigma1(e)
265 ldr r12,[r14],#4 @ *K256++
266 add r9,r9,r2 @ h+=X[i]
269 add r9,r9,r0,ror#6 @ h+=Sigma1(e)
271 add r9,r9,r12 @ h+=K256[i]
272 eor r2,r2,r8 @ Ch(e,f,g)
273 eor r0,r10,r10,ror#11
274 add r9,r9,r2 @ h+=Ch(e,f,g)
277 cmp r12,#0xf2 @ done?
281 ldr r2,[r1],#4 @ prefetch
285 eor r12,r10,r11 @ a^b, b^c in next round
287 ldr r2,[sp,#4*4] @ from future BODY_16_xx
288 eor r12,r10,r11 @ a^b, b^c in next round
289 ldr r1,[sp,#1*4] @ from future BODY_16_xx
291 eor r0,r0,r10,ror#20 @ Sigma0(a)
292 and r3,r3,r12 @ (b^c)&=(a^b)
294 eor r3,r3,r11 @ Maj(a,b,c)
295 add r9,r9,r0,ror#2 @ h+=Sigma0(a)
296 @ add r9,r9,r3 @ h+=Maj(a,b,c)
300 str r1,[sp,#17*4] @ make room for r1
303 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
304 eor r0,r0,r5,ror#19 @ Sigma1(e)
309 @ ldrb r2,[r1,#3] @ 3
310 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
317 str r1,[sp,#17*4] @ make room for r1
321 eor r0,r0,r5,ror#19 @ Sigma1(e)
323 ldr r3,[r14],#4 @ *K256++
324 add r8,r8,r2 @ h+=X[i]
327 add r8,r8,r0,ror#6 @ h+=Sigma1(e)
329 add r8,r8,r3 @ h+=K256[i]
330 eor r2,r2,r7 @ Ch(e,f,g)
332 add r8,r8,r2 @ h+=Ch(e,f,g)
339 ldr r2,[r1],#4 @ prefetch
343 eor r3,r9,r10 @ a^b, b^c in next round
345 ldr r2,[sp,#5*4] @ from future BODY_16_xx
346 eor r3,r9,r10 @ a^b, b^c in next round
347 ldr r1,[sp,#2*4] @ from future BODY_16_xx
349 eor r0,r0,r9,ror#20 @ Sigma0(a)
350 and r12,r12,r3 @ (b^c)&=(a^b)
352 eor r12,r12,r10 @ Maj(a,b,c)
353 add r8,r8,r0,ror#2 @ h+=Sigma0(a)
354 @ add r8,r8,r12 @ h+=Maj(a,b,c)
358 str r1,[sp,#17*4] @ make room for r1
361 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
362 eor r0,r0,r4,ror#19 @ Sigma1(e)
367 @ ldrb r2,[r1,#3] @ 4
368 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
375 str r1,[sp,#17*4] @ make room for r1
379 eor r0,r0,r4,ror#19 @ Sigma1(e)
381 ldr r12,[r14],#4 @ *K256++
382 add r7,r7,r2 @ h+=X[i]
385 add r7,r7,r0,ror#6 @ h+=Sigma1(e)
387 add r7,r7,r12 @ h+=K256[i]
388 eor r2,r2,r6 @ Ch(e,f,g)
390 add r7,r7,r2 @ h+=Ch(e,f,g)
393 cmp r12,#0xf2 @ done?
397 ldr r2,[r1],#4 @ prefetch
401 eor r12,r8,r9 @ a^b, b^c in next round
403 ldr r2,[sp,#6*4] @ from future BODY_16_xx
404 eor r12,r8,r9 @ a^b, b^c in next round
405 ldr r1,[sp,#3*4] @ from future BODY_16_xx
407 eor r0,r0,r8,ror#20 @ Sigma0(a)
408 and r3,r3,r12 @ (b^c)&=(a^b)
409 add r11,r11,r7 @ d+=h
410 eor r3,r3,r9 @ Maj(a,b,c)
411 add r7,r7,r0,ror#2 @ h+=Sigma0(a)
412 @ add r7,r7,r3 @ h+=Maj(a,b,c)
416 str r1,[sp,#17*4] @ make room for r1
419 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
420 eor r0,r0,r11,ror#19 @ Sigma1(e)
425 @ ldrb r2,[r1,#3] @ 5
426 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
433 str r1,[sp,#17*4] @ make room for r1
437 eor r0,r0,r11,ror#19 @ Sigma1(e)
439 ldr r3,[r14],#4 @ *K256++
440 add r6,r6,r2 @ h+=X[i]
443 add r6,r6,r0,ror#6 @ h+=Sigma1(e)
445 add r6,r6,r3 @ h+=K256[i]
446 eor r2,r2,r5 @ Ch(e,f,g)
448 add r6,r6,r2 @ h+=Ch(e,f,g)
455 ldr r2,[r1],#4 @ prefetch
459 eor r3,r7,r8 @ a^b, b^c in next round
461 ldr r2,[sp,#7*4] @ from future BODY_16_xx
462 eor r3,r7,r8 @ a^b, b^c in next round
463 ldr r1,[sp,#4*4] @ from future BODY_16_xx
465 eor r0,r0,r7,ror#20 @ Sigma0(a)
466 and r12,r12,r3 @ (b^c)&=(a^b)
467 add r10,r10,r6 @ d+=h
468 eor r12,r12,r8 @ Maj(a,b,c)
469 add r6,r6,r0,ror#2 @ h+=Sigma0(a)
470 @ add r6,r6,r12 @ h+=Maj(a,b,c)
474 str r1,[sp,#17*4] @ make room for r1
477 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
478 eor r0,r0,r10,ror#19 @ Sigma1(e)
483 @ ldrb r2,[r1,#3] @ 6
484 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
491 str r1,[sp,#17*4] @ make room for r1
495 eor r0,r0,r10,ror#19 @ Sigma1(e)
497 ldr r12,[r14],#4 @ *K256++
498 add r5,r5,r2 @ h+=X[i]
501 add r5,r5,r0,ror#6 @ h+=Sigma1(e)
503 add r5,r5,r12 @ h+=K256[i]
504 eor r2,r2,r4 @ Ch(e,f,g)
506 add r5,r5,r2 @ h+=Ch(e,f,g)
509 cmp r12,#0xf2 @ done?
513 ldr r2,[r1],#4 @ prefetch
517 eor r12,r6,r7 @ a^b, b^c in next round
519 ldr r2,[sp,#8*4] @ from future BODY_16_xx
520 eor r12,r6,r7 @ a^b, b^c in next round
521 ldr r1,[sp,#5*4] @ from future BODY_16_xx
523 eor r0,r0,r6,ror#20 @ Sigma0(a)
524 and r3,r3,r12 @ (b^c)&=(a^b)
526 eor r3,r3,r7 @ Maj(a,b,c)
527 add r5,r5,r0,ror#2 @ h+=Sigma0(a)
528 @ add r5,r5,r3 @ h+=Maj(a,b,c)
532 str r1,[sp,#17*4] @ make room for r1
535 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
536 eor r0,r0,r9,ror#19 @ Sigma1(e)
541 @ ldrb r2,[r1,#3] @ 7
542 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
549 str r1,[sp,#17*4] @ make room for r1
553 eor r0,r0,r9,ror#19 @ Sigma1(e)
555 ldr r3,[r14],#4 @ *K256++
556 add r4,r4,r2 @ h+=X[i]
559 add r4,r4,r0,ror#6 @ h+=Sigma1(e)
561 add r4,r4,r3 @ h+=K256[i]
562 eor r2,r2,r11 @ Ch(e,f,g)
564 add r4,r4,r2 @ h+=Ch(e,f,g)
571 ldr r2,[r1],#4 @ prefetch
575 eor r3,r5,r6 @ a^b, b^c in next round
577 ldr r2,[sp,#9*4] @ from future BODY_16_xx
578 eor r3,r5,r6 @ a^b, b^c in next round
579 ldr r1,[sp,#6*4] @ from future BODY_16_xx
581 eor r0,r0,r5,ror#20 @ Sigma0(a)
582 and r12,r12,r3 @ (b^c)&=(a^b)
584 eor r12,r12,r6 @ Maj(a,b,c)
585 add r4,r4,r0,ror#2 @ h+=Sigma0(a)
586 @ add r4,r4,r12 @ h+=Maj(a,b,c)
590 str r1,[sp,#17*4] @ make room for r1
593 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
594 eor r0,r0,r8,ror#19 @ Sigma1(e)
599 @ ldrb r2,[r1,#3] @ 8
600 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
607 str r1,[sp,#17*4] @ make room for r1
611 eor r0,r0,r8,ror#19 @ Sigma1(e)
613 ldr r12,[r14],#4 @ *K256++
614 add r11,r11,r2 @ h+=X[i]
617 add r11,r11,r0,ror#6 @ h+=Sigma1(e)
619 add r11,r11,r12 @ h+=K256[i]
620 eor r2,r2,r10 @ Ch(e,f,g)
622 add r11,r11,r2 @ h+=Ch(e,f,g)
625 cmp r12,#0xf2 @ done?
629 ldr r2,[r1],#4 @ prefetch
633 eor r12,r4,r5 @ a^b, b^c in next round
635 ldr r2,[sp,#10*4] @ from future BODY_16_xx
636 eor r12,r4,r5 @ a^b, b^c in next round
637 ldr r1,[sp,#7*4] @ from future BODY_16_xx
639 eor r0,r0,r4,ror#20 @ Sigma0(a)
640 and r3,r3,r12 @ (b^c)&=(a^b)
642 eor r3,r3,r5 @ Maj(a,b,c)
643 add r11,r11,r0,ror#2 @ h+=Sigma0(a)
644 @ add r11,r11,r3 @ h+=Maj(a,b,c)
648 str r1,[sp,#17*4] @ make room for r1
651 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
652 eor r0,r0,r7,ror#19 @ Sigma1(e)
657 @ ldrb r2,[r1,#3] @ 9
658 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
665 str r1,[sp,#17*4] @ make room for r1
669 eor r0,r0,r7,ror#19 @ Sigma1(e)
671 ldr r3,[r14],#4 @ *K256++
672 add r10,r10,r2 @ h+=X[i]
675 add r10,r10,r0,ror#6 @ h+=Sigma1(e)
677 add r10,r10,r3 @ h+=K256[i]
678 eor r2,r2,r9 @ Ch(e,f,g)
679 eor r0,r11,r11,ror#11
680 add r10,r10,r2 @ h+=Ch(e,f,g)
687 ldr r2,[r1],#4 @ prefetch
691 eor r3,r11,r4 @ a^b, b^c in next round
693 ldr r2,[sp,#11*4] @ from future BODY_16_xx
694 eor r3,r11,r4 @ a^b, b^c in next round
695 ldr r1,[sp,#8*4] @ from future BODY_16_xx
697 eor r0,r0,r11,ror#20 @ Sigma0(a)
698 and r12,r12,r3 @ (b^c)&=(a^b)
700 eor r12,r12,r4 @ Maj(a,b,c)
701 add r10,r10,r0,ror#2 @ h+=Sigma0(a)
702 @ add r10,r10,r12 @ h+=Maj(a,b,c)
704 @ ldr r2,[r1],#4 @ 10
706 str r1,[sp,#17*4] @ make room for r1
709 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
710 eor r0,r0,r6,ror#19 @ Sigma1(e)
715 @ ldrb r2,[r1,#3] @ 10
716 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
723 str r1,[sp,#17*4] @ make room for r1
727 eor r0,r0,r6,ror#19 @ Sigma1(e)
729 ldr r12,[r14],#4 @ *K256++
730 add r9,r9,r2 @ h+=X[i]
733 add r9,r9,r0,ror#6 @ h+=Sigma1(e)
735 add r9,r9,r12 @ h+=K256[i]
736 eor r2,r2,r8 @ Ch(e,f,g)
737 eor r0,r10,r10,ror#11
738 add r9,r9,r2 @ h+=Ch(e,f,g)
741 cmp r12,#0xf2 @ done?
745 ldr r2,[r1],#4 @ prefetch
749 eor r12,r10,r11 @ a^b, b^c in next round
751 ldr r2,[sp,#12*4] @ from future BODY_16_xx
752 eor r12,r10,r11 @ a^b, b^c in next round
753 ldr r1,[sp,#9*4] @ from future BODY_16_xx
755 eor r0,r0,r10,ror#20 @ Sigma0(a)
756 and r3,r3,r12 @ (b^c)&=(a^b)
758 eor r3,r3,r11 @ Maj(a,b,c)
759 add r9,r9,r0,ror#2 @ h+=Sigma0(a)
760 @ add r9,r9,r3 @ h+=Maj(a,b,c)
762 @ ldr r2,[r1],#4 @ 11
764 str r1,[sp,#17*4] @ make room for r1
767 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
768 eor r0,r0,r5,ror#19 @ Sigma1(e)
773 @ ldrb r2,[r1,#3] @ 11
774 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
781 str r1,[sp,#17*4] @ make room for r1
785 eor r0,r0,r5,ror#19 @ Sigma1(e)
787 ldr r3,[r14],#4 @ *K256++
788 add r8,r8,r2 @ h+=X[i]
791 add r8,r8,r0,ror#6 @ h+=Sigma1(e)
793 add r8,r8,r3 @ h+=K256[i]
794 eor r2,r2,r7 @ Ch(e,f,g)
796 add r8,r8,r2 @ h+=Ch(e,f,g)
803 ldr r2,[r1],#4 @ prefetch
807 eor r3,r9,r10 @ a^b, b^c in next round
809 ldr r2,[sp,#13*4] @ from future BODY_16_xx
810 eor r3,r9,r10 @ a^b, b^c in next round
811 ldr r1,[sp,#10*4] @ from future BODY_16_xx
813 eor r0,r0,r9,ror#20 @ Sigma0(a)
814 and r12,r12,r3 @ (b^c)&=(a^b)
816 eor r12,r12,r10 @ Maj(a,b,c)
817 add r8,r8,r0,ror#2 @ h+=Sigma0(a)
818 @ add r8,r8,r12 @ h+=Maj(a,b,c)
820 @ ldr r2,[r1],#4 @ 12
822 str r1,[sp,#17*4] @ make room for r1
825 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
826 eor r0,r0,r4,ror#19 @ Sigma1(e)
831 @ ldrb r2,[r1,#3] @ 12
832 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
839 str r1,[sp,#17*4] @ make room for r1
843 eor r0,r0,r4,ror#19 @ Sigma1(e)
845 ldr r12,[r14],#4 @ *K256++
846 add r7,r7,r2 @ h+=X[i]
849 add r7,r7,r0,ror#6 @ h+=Sigma1(e)
851 add r7,r7,r12 @ h+=K256[i]
852 eor r2,r2,r6 @ Ch(e,f,g)
854 add r7,r7,r2 @ h+=Ch(e,f,g)
857 cmp r12,#0xf2 @ done?
861 ldr r2,[r1],#4 @ prefetch
865 eor r12,r8,r9 @ a^b, b^c in next round
867 ldr r2,[sp,#14*4] @ from future BODY_16_xx
868 eor r12,r8,r9 @ a^b, b^c in next round
869 ldr r1,[sp,#11*4] @ from future BODY_16_xx
871 eor r0,r0,r8,ror#20 @ Sigma0(a)
872 and r3,r3,r12 @ (b^c)&=(a^b)
873 add r11,r11,r7 @ d+=h
874 eor r3,r3,r9 @ Maj(a,b,c)
875 add r7,r7,r0,ror#2 @ h+=Sigma0(a)
876 @ add r7,r7,r3 @ h+=Maj(a,b,c)
878 @ ldr r2,[r1],#4 @ 13
880 str r1,[sp,#17*4] @ make room for r1
883 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
884 eor r0,r0,r11,ror#19 @ Sigma1(e)
889 @ ldrb r2,[r1,#3] @ 13
890 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
897 str r1,[sp,#17*4] @ make room for r1
901 eor r0,r0,r11,ror#19 @ Sigma1(e)
903 ldr r3,[r14],#4 @ *K256++
904 add r6,r6,r2 @ h+=X[i]
907 add r6,r6,r0,ror#6 @ h+=Sigma1(e)
909 add r6,r6,r3 @ h+=K256[i]
910 eor r2,r2,r5 @ Ch(e,f,g)
912 add r6,r6,r2 @ h+=Ch(e,f,g)
919 ldr r2,[r1],#4 @ prefetch
923 eor r3,r7,r8 @ a^b, b^c in next round
925 ldr r2,[sp,#15*4] @ from future BODY_16_xx
926 eor r3,r7,r8 @ a^b, b^c in next round
927 ldr r1,[sp,#12*4] @ from future BODY_16_xx
929 eor r0,r0,r7,ror#20 @ Sigma0(a)
930 and r12,r12,r3 @ (b^c)&=(a^b)
931 add r10,r10,r6 @ d+=h
932 eor r12,r12,r8 @ Maj(a,b,c)
933 add r6,r6,r0,ror#2 @ h+=Sigma0(a)
934 @ add r6,r6,r12 @ h+=Maj(a,b,c)
936 @ ldr r2,[r1],#4 @ 14
938 str r1,[sp,#17*4] @ make room for r1
941 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
942 eor r0,r0,r10,ror#19 @ Sigma1(e)
947 @ ldrb r2,[r1,#3] @ 14
948 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
955 str r1,[sp,#17*4] @ make room for r1
959 eor r0,r0,r10,ror#19 @ Sigma1(e)
961 ldr r12,[r14],#4 @ *K256++
962 add r5,r5,r2 @ h+=X[i]
965 add r5,r5,r0,ror#6 @ h+=Sigma1(e)
967 add r5,r5,r12 @ h+=K256[i]
968 eor r2,r2,r4 @ Ch(e,f,g)
970 add r5,r5,r2 @ h+=Ch(e,f,g)
973 cmp r12,#0xf2 @ done?
977 ldr r2,[r1],#4 @ prefetch
981 eor r12,r6,r7 @ a^b, b^c in next round
983 ldr r2,[sp,#0*4] @ from future BODY_16_xx
984 eor r12,r6,r7 @ a^b, b^c in next round
985 ldr r1,[sp,#13*4] @ from future BODY_16_xx
987 eor r0,r0,r6,ror#20 @ Sigma0(a)
988 and r3,r3,r12 @ (b^c)&=(a^b)
990 eor r3,r3,r7 @ Maj(a,b,c)
991 add r5,r5,r0,ror#2 @ h+=Sigma0(a)
992 @ add r5,r5,r3 @ h+=Maj(a,b,c)
994 @ ldr r2,[r1],#4 @ 15
996 str r1,[sp,#17*4] @ make room for r1
999 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
1000 eor r0,r0,r9,ror#19 @ Sigma1(e)
1005 @ ldrb r2,[r1,#3] @ 15
1006 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
1013 str r1,[sp,#17*4] @ make room for r1
1017 eor r0,r0,r9,ror#19 @ Sigma1(e)
1019 ldr r3,[r14],#4 @ *K256++
1020 add r4,r4,r2 @ h+=X[i]
1023 add r4,r4,r0,ror#6 @ h+=Sigma1(e)
1025 add r4,r4,r3 @ h+=K256[i]
1026 eor r2,r2,r11 @ Ch(e,f,g)
1028 add r4,r4,r2 @ h+=Ch(e,f,g)
1031 cmp r3,#0xf2 @ done?
1034 # if __ARM_ARCH__>=7
1035 ldr r2,[r1],#4 @ prefetch
1039 eor r3,r5,r6 @ a^b, b^c in next round
1041 ldr r2,[sp,#1*4] @ from future BODY_16_xx
1042 eor r3,r5,r6 @ a^b, b^c in next round
1043 ldr r1,[sp,#14*4] @ from future BODY_16_xx
1045 eor r0,r0,r5,ror#20 @ Sigma0(a)
1046 and r12,r12,r3 @ (b^c)&=(a^b)
1048 eor r12,r12,r6 @ Maj(a,b,c)
1049 add r4,r4,r0,ror#2 @ h+=Sigma0(a)
1050 @ add r4,r4,r12 @ h+=Maj(a,b,c)
1052 @ ldr r2,[sp,#1*4] @ 16
1055 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
1058 eor r12,r12,r1,ror#19
1059 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1061 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1065 eor r0,r8,r8,ror#5 @ from BODY_00_15
1067 eor r0,r0,r8,ror#19 @ Sigma1(e)
1069 ldr r12,[r14],#4 @ *K256++
1070 add r11,r11,r2 @ h+=X[i]
1073 add r11,r11,r0,ror#6 @ h+=Sigma1(e)
1075 add r11,r11,r12 @ h+=K256[i]
1076 eor r2,r2,r10 @ Ch(e,f,g)
1078 add r11,r11,r2 @ h+=Ch(e,f,g)
1081 cmp r12,#0xf2 @ done?
1084 # if __ARM_ARCH__>=7
1085 ldr r2,[r1],#4 @ prefetch
1089 eor r12,r4,r5 @ a^b, b^c in next round
1091 ldr r2,[sp,#2*4] @ from future BODY_16_xx
1092 eor r12,r4,r5 @ a^b, b^c in next round
1093 ldr r1,[sp,#15*4] @ from future BODY_16_xx
1095 eor r0,r0,r4,ror#20 @ Sigma0(a)
1096 and r3,r3,r12 @ (b^c)&=(a^b)
1097 add r7,r7,r11 @ d+=h
1098 eor r3,r3,r5 @ Maj(a,b,c)
1099 add r11,r11,r0,ror#2 @ h+=Sigma0(a)
1100 @ add r11,r11,r3 @ h+=Maj(a,b,c)
1101 @ ldr r2,[sp,#2*4] @ 17
1104 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
1108 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1110 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1114 eor r0,r7,r7,ror#5 @ from BODY_00_15
1116 eor r0,r0,r7,ror#19 @ Sigma1(e)
1118 ldr r3,[r14],#4 @ *K256++
1119 add r10,r10,r2 @ h+=X[i]
1122 add r10,r10,r0,ror#6 @ h+=Sigma1(e)
1124 add r10,r10,r3 @ h+=K256[i]
1125 eor r2,r2,r9 @ Ch(e,f,g)
1126 eor r0,r11,r11,ror#11
1127 add r10,r10,r2 @ h+=Ch(e,f,g)
1130 cmp r3,#0xf2 @ done?
1133 # if __ARM_ARCH__>=7
1134 ldr r2,[r1],#4 @ prefetch
1138 eor r3,r11,r4 @ a^b, b^c in next round
1140 ldr r2,[sp,#3*4] @ from future BODY_16_xx
1141 eor r3,r11,r4 @ a^b, b^c in next round
1142 ldr r1,[sp,#0*4] @ from future BODY_16_xx
1144 eor r0,r0,r11,ror#20 @ Sigma0(a)
1145 and r12,r12,r3 @ (b^c)&=(a^b)
1146 add r6,r6,r10 @ d+=h
1147 eor r12,r12,r4 @ Maj(a,b,c)
1148 add r10,r10,r0,ror#2 @ h+=Sigma0(a)
1149 @ add r10,r10,r12 @ h+=Maj(a,b,c)
1150 @ ldr r2,[sp,#3*4] @ 18
1153 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
1156 eor r12,r12,r1,ror#19
1157 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1159 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1163 eor r0,r6,r6,ror#5 @ from BODY_00_15
1165 eor r0,r0,r6,ror#19 @ Sigma1(e)
1167 ldr r12,[r14],#4 @ *K256++
1168 add r9,r9,r2 @ h+=X[i]
1171 add r9,r9,r0,ror#6 @ h+=Sigma1(e)
1173 add r9,r9,r12 @ h+=K256[i]
1174 eor r2,r2,r8 @ Ch(e,f,g)
1175 eor r0,r10,r10,ror#11
1176 add r9,r9,r2 @ h+=Ch(e,f,g)
1179 cmp r12,#0xf2 @ done?
1182 # if __ARM_ARCH__>=7
1183 ldr r2,[r1],#4 @ prefetch
1187 eor r12,r10,r11 @ a^b, b^c in next round
1189 ldr r2,[sp,#4*4] @ from future BODY_16_xx
1190 eor r12,r10,r11 @ a^b, b^c in next round
1191 ldr r1,[sp,#1*4] @ from future BODY_16_xx
1193 eor r0,r0,r10,ror#20 @ Sigma0(a)
1194 and r3,r3,r12 @ (b^c)&=(a^b)
1196 eor r3,r3,r11 @ Maj(a,b,c)
1197 add r9,r9,r0,ror#2 @ h+=Sigma0(a)
1198 @ add r9,r9,r3 @ h+=Maj(a,b,c)
1199 @ ldr r2,[sp,#4*4] @ 19
1202 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
1206 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1208 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1212 eor r0,r5,r5,ror#5 @ from BODY_00_15
1214 eor r0,r0,r5,ror#19 @ Sigma1(e)
1216 ldr r3,[r14],#4 @ *K256++
1217 add r8,r8,r2 @ h+=X[i]
1220 add r8,r8,r0,ror#6 @ h+=Sigma1(e)
1222 add r8,r8,r3 @ h+=K256[i]
1223 eor r2,r2,r7 @ Ch(e,f,g)
1225 add r8,r8,r2 @ h+=Ch(e,f,g)
1228 cmp r3,#0xf2 @ done?
1231 # if __ARM_ARCH__>=7
1232 ldr r2,[r1],#4 @ prefetch
1236 eor r3,r9,r10 @ a^b, b^c in next round
1238 ldr r2,[sp,#5*4] @ from future BODY_16_xx
1239 eor r3,r9,r10 @ a^b, b^c in next round
1240 ldr r1,[sp,#2*4] @ from future BODY_16_xx
1242 eor r0,r0,r9,ror#20 @ Sigma0(a)
1243 and r12,r12,r3 @ (b^c)&=(a^b)
1245 eor r12,r12,r10 @ Maj(a,b,c)
1246 add r8,r8,r0,ror#2 @ h+=Sigma0(a)
1247 @ add r8,r8,r12 @ h+=Maj(a,b,c)
1248 @ ldr r2,[sp,#5*4] @ 20
1251 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
1254 eor r12,r12,r1,ror#19
1255 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1257 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1261 eor r0,r4,r4,ror#5 @ from BODY_00_15
1263 eor r0,r0,r4,ror#19 @ Sigma1(e)
1265 ldr r12,[r14],#4 @ *K256++
1266 add r7,r7,r2 @ h+=X[i]
1269 add r7,r7,r0,ror#6 @ h+=Sigma1(e)
1271 add r7,r7,r12 @ h+=K256[i]
1272 eor r2,r2,r6 @ Ch(e,f,g)
1274 add r7,r7,r2 @ h+=Ch(e,f,g)
1277 cmp r12,#0xf2 @ done?
1280 # if __ARM_ARCH__>=7
1281 ldr r2,[r1],#4 @ prefetch
1285 eor r12,r8,r9 @ a^b, b^c in next round
1287 ldr r2,[sp,#6*4] @ from future BODY_16_xx
1288 eor r12,r8,r9 @ a^b, b^c in next round
1289 ldr r1,[sp,#3*4] @ from future BODY_16_xx
1291 eor r0,r0,r8,ror#20 @ Sigma0(a)
1292 and r3,r3,r12 @ (b^c)&=(a^b)
1293 add r11,r11,r7 @ d+=h
1294 eor r3,r3,r9 @ Maj(a,b,c)
1295 add r7,r7,r0,ror#2 @ h+=Sigma0(a)
1296 @ add r7,r7,r3 @ h+=Maj(a,b,c)
1297 @ ldr r2,[sp,#6*4] @ 21
1300 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
1304 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1306 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1310 eor r0,r11,r11,ror#5 @ from BODY_00_15
1312 eor r0,r0,r11,ror#19 @ Sigma1(e)
1314 ldr r3,[r14],#4 @ *K256++
1315 add r6,r6,r2 @ h+=X[i]
1318 add r6,r6,r0,ror#6 @ h+=Sigma1(e)
1320 add r6,r6,r3 @ h+=K256[i]
1321 eor r2,r2,r5 @ Ch(e,f,g)
1323 add r6,r6,r2 @ h+=Ch(e,f,g)
1326 cmp r3,#0xf2 @ done?
1329 # if __ARM_ARCH__>=7
1330 ldr r2,[r1],#4 @ prefetch
1334 eor r3,r7,r8 @ a^b, b^c in next round
1336 ldr r2,[sp,#7*4] @ from future BODY_16_xx
1337 eor r3,r7,r8 @ a^b, b^c in next round
1338 ldr r1,[sp,#4*4] @ from future BODY_16_xx
1340 eor r0,r0,r7,ror#20 @ Sigma0(a)
1341 and r12,r12,r3 @ (b^c)&=(a^b)
1342 add r10,r10,r6 @ d+=h
1343 eor r12,r12,r8 @ Maj(a,b,c)
1344 add r6,r6,r0,ror#2 @ h+=Sigma0(a)
1345 @ add r6,r6,r12 @ h+=Maj(a,b,c)
1346 @ ldr r2,[sp,#7*4] @ 22
1349 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
1352 eor r12,r12,r1,ror#19
1353 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1355 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1359 eor r0,r10,r10,ror#5 @ from BODY_00_15
1361 eor r0,r0,r10,ror#19 @ Sigma1(e)
1363 ldr r12,[r14],#4 @ *K256++
1364 add r5,r5,r2 @ h+=X[i]
1367 add r5,r5,r0,ror#6 @ h+=Sigma1(e)
1369 add r5,r5,r12 @ h+=K256[i]
1370 eor r2,r2,r4 @ Ch(e,f,g)
1372 add r5,r5,r2 @ h+=Ch(e,f,g)
1375 cmp r12,#0xf2 @ done?
1378 # if __ARM_ARCH__>=7
1379 ldr r2,[r1],#4 @ prefetch
1383 eor r12,r6,r7 @ a^b, b^c in next round
1385 ldr r2,[sp,#8*4] @ from future BODY_16_xx
1386 eor r12,r6,r7 @ a^b, b^c in next round
1387 ldr r1,[sp,#5*4] @ from future BODY_16_xx
1389 eor r0,r0,r6,ror#20 @ Sigma0(a)
1390 and r3,r3,r12 @ (b^c)&=(a^b)
1392 eor r3,r3,r7 @ Maj(a,b,c)
1393 add r5,r5,r0,ror#2 @ h+=Sigma0(a)
1394 @ add r5,r5,r3 @ h+=Maj(a,b,c)
1395 @ ldr r2,[sp,#8*4] @ 23
1398 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
1402 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1404 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1408 eor r0,r9,r9,ror#5 @ from BODY_00_15
1410 eor r0,r0,r9,ror#19 @ Sigma1(e)
1412 ldr r3,[r14],#4 @ *K256++
1413 add r4,r4,r2 @ h+=X[i]
1416 add r4,r4,r0,ror#6 @ h+=Sigma1(e)
1418 add r4,r4,r3 @ h+=K256[i]
1419 eor r2,r2,r11 @ Ch(e,f,g)
1421 add r4,r4,r2 @ h+=Ch(e,f,g)
1424 cmp r3,#0xf2 @ done?
1427 # if __ARM_ARCH__>=7
1428 ldr r2,[r1],#4 @ prefetch
1432 eor r3,r5,r6 @ a^b, b^c in next round
1434 ldr r2,[sp,#9*4] @ from future BODY_16_xx
1435 eor r3,r5,r6 @ a^b, b^c in next round
1436 ldr r1,[sp,#6*4] @ from future BODY_16_xx
1438 eor r0,r0,r5,ror#20 @ Sigma0(a)
1439 and r12,r12,r3 @ (b^c)&=(a^b)
1441 eor r12,r12,r6 @ Maj(a,b,c)
1442 add r4,r4,r0,ror#2 @ h+=Sigma0(a)
1443 @ add r4,r4,r12 @ h+=Maj(a,b,c)
1444 @ ldr r2,[sp,#9*4] @ 24
1447 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
1450 eor r12,r12,r1,ror#19
1451 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1453 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1457 eor r0,r8,r8,ror#5 @ from BODY_00_15
1459 eor r0,r0,r8,ror#19 @ Sigma1(e)
1461 ldr r12,[r14],#4 @ *K256++
1462 add r11,r11,r2 @ h+=X[i]
1465 add r11,r11,r0,ror#6 @ h+=Sigma1(e)
1467 add r11,r11,r12 @ h+=K256[i]
1468 eor r2,r2,r10 @ Ch(e,f,g)
1470 add r11,r11,r2 @ h+=Ch(e,f,g)
1473 cmp r12,#0xf2 @ done?
1476 # if __ARM_ARCH__>=7
1477 ldr r2,[r1],#4 @ prefetch
1481 eor r12,r4,r5 @ a^b, b^c in next round
1483 ldr r2,[sp,#10*4] @ from future BODY_16_xx
1484 eor r12,r4,r5 @ a^b, b^c in next round
1485 ldr r1,[sp,#7*4] @ from future BODY_16_xx
1487 eor r0,r0,r4,ror#20 @ Sigma0(a)
1488 and r3,r3,r12 @ (b^c)&=(a^b)
1489 add r7,r7,r11 @ d+=h
1490 eor r3,r3,r5 @ Maj(a,b,c)
1491 add r11,r11,r0,ror#2 @ h+=Sigma0(a)
1492 @ add r11,r11,r3 @ h+=Maj(a,b,c)
1493 @ ldr r2,[sp,#10*4] @ 25
1496 add r11,r11,r3 @ h+=Maj(a,b,c) from the past
1500 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1502 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1506 eor r0,r7,r7,ror#5 @ from BODY_00_15
1508 eor r0,r0,r7,ror#19 @ Sigma1(e)
1510 ldr r3,[r14],#4 @ *K256++
1511 add r10,r10,r2 @ h+=X[i]
1514 add r10,r10,r0,ror#6 @ h+=Sigma1(e)
1516 add r10,r10,r3 @ h+=K256[i]
1517 eor r2,r2,r9 @ Ch(e,f,g)
1518 eor r0,r11,r11,ror#11
1519 add r10,r10,r2 @ h+=Ch(e,f,g)
1522 cmp r3,#0xf2 @ done?
1525 # if __ARM_ARCH__>=7
1526 ldr r2,[r1],#4 @ prefetch
1530 eor r3,r11,r4 @ a^b, b^c in next round
1532 ldr r2,[sp,#11*4] @ from future BODY_16_xx
1533 eor r3,r11,r4 @ a^b, b^c in next round
1534 ldr r1,[sp,#8*4] @ from future BODY_16_xx
1536 eor r0,r0,r11,ror#20 @ Sigma0(a)
1537 and r12,r12,r3 @ (b^c)&=(a^b)
1538 add r6,r6,r10 @ d+=h
1539 eor r12,r12,r4 @ Maj(a,b,c)
1540 add r10,r10,r0,ror#2 @ h+=Sigma0(a)
1541 @ add r10,r10,r12 @ h+=Maj(a,b,c)
1542 @ ldr r2,[sp,#11*4] @ 26
1545 add r10,r10,r12 @ h+=Maj(a,b,c) from the past
1548 eor r12,r12,r1,ror#19
1549 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1551 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1555 eor r0,r6,r6,ror#5 @ from BODY_00_15
1557 eor r0,r0,r6,ror#19 @ Sigma1(e)
1559 ldr r12,[r14],#4 @ *K256++
1560 add r9,r9,r2 @ h+=X[i]
1563 add r9,r9,r0,ror#6 @ h+=Sigma1(e)
1565 add r9,r9,r12 @ h+=K256[i]
1566 eor r2,r2,r8 @ Ch(e,f,g)
1567 eor r0,r10,r10,ror#11
1568 add r9,r9,r2 @ h+=Ch(e,f,g)
1571 cmp r12,#0xf2 @ done?
1574 # if __ARM_ARCH__>=7
1575 ldr r2,[r1],#4 @ prefetch
1579 eor r12,r10,r11 @ a^b, b^c in next round
1581 ldr r2,[sp,#12*4] @ from future BODY_16_xx
1582 eor r12,r10,r11 @ a^b, b^c in next round
1583 ldr r1,[sp,#9*4] @ from future BODY_16_xx
1585 eor r0,r0,r10,ror#20 @ Sigma0(a)
1586 and r3,r3,r12 @ (b^c)&=(a^b)
1588 eor r3,r3,r11 @ Maj(a,b,c)
1589 add r9,r9,r0,ror#2 @ h+=Sigma0(a)
1590 @ add r9,r9,r3 @ h+=Maj(a,b,c)
1591 @ ldr r2,[sp,#12*4] @ 27
1594 add r9,r9,r3 @ h+=Maj(a,b,c) from the past
1598 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1600 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1604 eor r0,r5,r5,ror#5 @ from BODY_00_15
1606 eor r0,r0,r5,ror#19 @ Sigma1(e)
1608 ldr r3,[r14],#4 @ *K256++
1609 add r8,r8,r2 @ h+=X[i]
1612 add r8,r8,r0,ror#6 @ h+=Sigma1(e)
1614 add r8,r8,r3 @ h+=K256[i]
1615 eor r2,r2,r7 @ Ch(e,f,g)
1617 add r8,r8,r2 @ h+=Ch(e,f,g)
1620 cmp r3,#0xf2 @ done?
1623 # if __ARM_ARCH__>=7
1624 ldr r2,[r1],#4 @ prefetch
1628 eor r3,r9,r10 @ a^b, b^c in next round
1630 ldr r2,[sp,#13*4] @ from future BODY_16_xx
1631 eor r3,r9,r10 @ a^b, b^c in next round
1632 ldr r1,[sp,#10*4] @ from future BODY_16_xx
1634 eor r0,r0,r9,ror#20 @ Sigma0(a)
1635 and r12,r12,r3 @ (b^c)&=(a^b)
1637 eor r12,r12,r10 @ Maj(a,b,c)
1638 add r8,r8,r0,ror#2 @ h+=Sigma0(a)
1639 @ add r8,r8,r12 @ h+=Maj(a,b,c)
1640 @ ldr r2,[sp,#13*4] @ 28
1643 add r8,r8,r12 @ h+=Maj(a,b,c) from the past
1646 eor r12,r12,r1,ror#19
1647 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1649 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1653 eor r0,r4,r4,ror#5 @ from BODY_00_15
1655 eor r0,r0,r4,ror#19 @ Sigma1(e)
1657 ldr r12,[r14],#4 @ *K256++
1658 add r7,r7,r2 @ h+=X[i]
1661 add r7,r7,r0,ror#6 @ h+=Sigma1(e)
1663 add r7,r7,r12 @ h+=K256[i]
1664 eor r2,r2,r6 @ Ch(e,f,g)
1666 add r7,r7,r2 @ h+=Ch(e,f,g)
1669 cmp r12,#0xf2 @ done?
1672 # if __ARM_ARCH__>=7
1673 ldr r2,[r1],#4 @ prefetch
1677 eor r12,r8,r9 @ a^b, b^c in next round
1679 ldr r2,[sp,#14*4] @ from future BODY_16_xx
1680 eor r12,r8,r9 @ a^b, b^c in next round
1681 ldr r1,[sp,#11*4] @ from future BODY_16_xx
1683 eor r0,r0,r8,ror#20 @ Sigma0(a)
1684 and r3,r3,r12 @ (b^c)&=(a^b)
1685 add r11,r11,r7 @ d+=h
1686 eor r3,r3,r9 @ Maj(a,b,c)
1687 add r7,r7,r0,ror#2 @ h+=Sigma0(a)
1688 @ add r7,r7,r3 @ h+=Maj(a,b,c)
1689 @ ldr r2,[sp,#14*4] @ 29
1692 add r7,r7,r3 @ h+=Maj(a,b,c) from the past
1696 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1698 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1702 eor r0,r11,r11,ror#5 @ from BODY_00_15
1704 eor r0,r0,r11,ror#19 @ Sigma1(e)
1706 ldr r3,[r14],#4 @ *K256++
1707 add r6,r6,r2 @ h+=X[i]
1710 add r6,r6,r0,ror#6 @ h+=Sigma1(e)
1712 add r6,r6,r3 @ h+=K256[i]
1713 eor r2,r2,r5 @ Ch(e,f,g)
1715 add r6,r6,r2 @ h+=Ch(e,f,g)
1718 cmp r3,#0xf2 @ done?
1721 # if __ARM_ARCH__>=7
1722 ldr r2,[r1],#4 @ prefetch
1726 eor r3,r7,r8 @ a^b, b^c in next round
1728 ldr r2,[sp,#15*4] @ from future BODY_16_xx
1729 eor r3,r7,r8 @ a^b, b^c in next round
1730 ldr r1,[sp,#12*4] @ from future BODY_16_xx
1732 eor r0,r0,r7,ror#20 @ Sigma0(a)
1733 and r12,r12,r3 @ (b^c)&=(a^b)
1734 add r10,r10,r6 @ d+=h
1735 eor r12,r12,r8 @ Maj(a,b,c)
1736 add r6,r6,r0,ror#2 @ h+=Sigma0(a)
1737 @ add r6,r6,r12 @ h+=Maj(a,b,c)
1738 @ ldr r2,[sp,#15*4] @ 30
1741 add r6,r6,r12 @ h+=Maj(a,b,c) from the past
1744 eor r12,r12,r1,ror#19
1745 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1747 eor r12,r12,r1,lsr#10 @ sigma1(X[i+14])
1751 eor r0,r10,r10,ror#5 @ from BODY_00_15
1753 eor r0,r0,r10,ror#19 @ Sigma1(e)
1755 ldr r12,[r14],#4 @ *K256++
1756 add r5,r5,r2 @ h+=X[i]
1759 add r5,r5,r0,ror#6 @ h+=Sigma1(e)
1761 add r5,r5,r12 @ h+=K256[i]
1762 eor r2,r2,r4 @ Ch(e,f,g)
1764 add r5,r5,r2 @ h+=Ch(e,f,g)
1767 cmp r12,#0xf2 @ done?
1770 # if __ARM_ARCH__>=7
1771 ldr r2,[r1],#4 @ prefetch
1775 eor r12,r6,r7 @ a^b, b^c in next round
1777 ldr r2,[sp,#0*4] @ from future BODY_16_xx
1778 eor r12,r6,r7 @ a^b, b^c in next round
1779 ldr r1,[sp,#13*4] @ from future BODY_16_xx
1781 eor r0,r0,r6,ror#20 @ Sigma0(a)
1782 and r3,r3,r12 @ (b^c)&=(a^b)
1784 eor r3,r3,r7 @ Maj(a,b,c)
1785 add r5,r5,r0,ror#2 @ h+=Sigma0(a)
1786 @ add r5,r5,r3 @ h+=Maj(a,b,c)
1787 @ ldr r2,[sp,#0*4] @ 31
1790 add r5,r5,r3 @ h+=Maj(a,b,c) from the past
1794 eor r0,r0,r2,lsr#3 @ sigma0(X[i+1])
1796 eor r3,r3,r1,lsr#10 @ sigma1(X[i+14])
1800 eor r0,r9,r9,ror#5 @ from BODY_00_15
1802 eor r0,r0,r9,ror#19 @ Sigma1(e)
1804 ldr r3,[r14],#4 @ *K256++
1805 add r4,r4,r2 @ h+=X[i]
1808 add r4,r4,r0,ror#6 @ h+=Sigma1(e)
1810 add r4,r4,r3 @ h+=K256[i]
1811 eor r2,r2,r11 @ Ch(e,f,g)
1813 add r4,r4,r2 @ h+=Ch(e,f,g)
1816 cmp r3,#0xf2 @ done?
1819 # if __ARM_ARCH__>=7
1820 ldr r2,[r1],#4 @ prefetch
1824 eor r3,r5,r6 @ a^b, b^c in next round
1826 ldr r2,[sp,#1*4] @ from future BODY_16_xx
1827 eor r3,r5,r6 @ a^b, b^c in next round
1828 ldr r1,[sp,#14*4] @ from future BODY_16_xx
1830 eor r0,r0,r5,ror#20 @ Sigma0(a)
1831 and r12,r12,r3 @ (b^c)&=(a^b)
1833 eor r12,r12,r6 @ Maj(a,b,c)
1834 add r4,r4,r0,ror#2 @ h+=Sigma0(a)
1835 @ add r4,r4,r12 @ h+=Maj(a,b,c)
1837 ite eq @ Thumb2 thing, sanity check in ARM
1839 ldreq r3,[sp,#16*4] @ pull ctx
1842 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
1857 ldr r1,[sp,#17*4] @ pull inp
1858 ldr r12,[sp,#18*4] @ pull inp+len
1861 stmia r3,{r4,r5,r6,r7,r8,r9,r10,r11}
1863 sub r14,r14,#256 @ rewind Ktbl
1866 add sp,sp,#19*4 @ destroy frame
1868 ldmia sp!,{r4-r11,pc}
1870 ldmia sp!,{r4-r11,lr}
1872 moveq pc,lr @ be binary compatible with V4, yet
1873 .word 0xe12fff1e @ interoperable with Thumb ISA:-)
1875 .size sha256_block_data_order,.-sha256_block_data_order
1876 #if __ARM_MAX_ARCH__>=7
1880 .global sha256_block_data_order_neon
1881 .type sha256_block_data_order_neon,%function
1883 sha256_block_data_order_neon:
1885 stmdb sp!,{r4-r12,lr}
1889 bic r11,r11,#15 @ align for 128-bit stores
1892 add r2,r1,r2,lsl#6 @ len to point at the end of inp
1898 vld1.32 {q8},[r14,:128]!
1899 vld1.32 {q9},[r14,:128]!
1900 vld1.32 {q10},[r14,:128]!
1901 vld1.32 {q11},[r14,:128]!
1902 vrev32.8 q0,q0 @ yes, even on
1904 vrev32.8 q1,q1 @ big-endian
1910 str r12,[sp,#76] @ save original sp
1913 vst1.32 {q8},[r1,:128]!
1915 vst1.32 {q9},[r1,:128]!
1917 vst1.32 {q10},[r1,:128]!
1918 vst1.32 {q11},[r1,:128]!
1936 eor r12,r0,r8,ror#19
1941 add r11,r11,r12,ror#6
1951 add r11,r11,r0,ror#2
1963 eor r0,r11,r11,ror#11
1966 add r10,r10,r3,ror#6
1969 eor r0,r0,r11,ror#20
1977 add r10,r10,r0,ror#2
1987 eor r12,r0,r6,ror#19
1989 eor r0,r10,r10,ror#11
1995 eor r0,r0,r10,ror#20
2004 vld1.32 {q8},[r14,:128]!
2024 vst1.32 {q8},[r1,:128]!
2034 eor r12,r0,r4,ror#19
2055 eor r0,r11,r11,ror#5
2060 eor r3,r0,r11,ror#19
2081 eor r0,r10,r10,ror#5
2085 eor r12,r0,r10,ror#19
2102 vld1.32 {q8},[r14,:128]!
2122 vst1.32 {q8},[r1,:128]!
2132 eor r12,r0,r8,ror#19
2137 add r11,r11,r12,ror#6
2147 add r11,r11,r0,ror#2
2159 eor r0,r11,r11,ror#11
2162 add r10,r10,r3,ror#6
2165 eor r0,r0,r11,ror#20
2173 add r10,r10,r0,ror#2
2183 eor r12,r0,r6,ror#19
2185 eor r0,r10,r10,ror#11
2191 eor r0,r0,r10,ror#20
2200 vld1.32 {q8},[r14,:128]!
2220 vst1.32 {q8},[r1,:128]!
2230 eor r12,r0,r4,ror#19
2251 eor r0,r11,r11,ror#5
2256 eor r3,r0,r11,ror#19
2277 eor r0,r10,r10,ror#5
2281 eor r12,r0,r10,ror#19
2298 vld1.32 {q8},[r14,:128]!
2318 vst1.32 {q8},[r1,:128]!
2321 teq r2,#0 @ check for K256 terminator
2328 sub r14,r14,#256 @ rewind r14
2331 subeq r1,r1,#64 @ avoid SEGV
2332 vld1.8 {q0},[r1]! @ load next input block
2343 vld1.32 {q8},[r14,:128]!
2345 eor r12,r0,r8,ror#19
2349 add r11,r11,r12,ror#6
2357 add r11,r11,r0,ror#2
2365 eor r0,r11,r11,ror#11
2367 add r10,r10,r3,ror#6
2369 eor r0,r0,r11,ror#20
2374 add r10,r10,r0,ror#2
2381 eor r12,r0,r6,ror#19
2382 eor r0,r10,r10,ror#11
2386 eor r0,r0,r10,ror#20
2410 vst1.32 {q8},[r1,:128]!
2415 vld1.32 {q8},[r14,:128]!
2417 eor r12,r0,r4,ror#19
2433 eor r0,r11,r11,ror#5
2436 eor r3,r0,r11,ror#19
2450 eor r0,r10,r10,ror#5
2453 eor r12,r0,r10,ror#19
2482 vst1.32 {q8},[r1,:128]!
2487 vld1.32 {q8},[r14,:128]!
2489 eor r12,r0,r8,ror#19
2493 add r11,r11,r12,ror#6
2501 add r11,r11,r0,ror#2
2509 eor r0,r11,r11,ror#11
2511 add r10,r10,r3,ror#6
2513 eor r0,r0,r11,ror#20
2518 add r10,r10,r0,ror#2
2525 eor r12,r0,r6,ror#19
2526 eor r0,r10,r10,ror#11
2530 eor r0,r0,r10,ror#20
2554 vst1.32 {q8},[r1,:128]!
2559 vld1.32 {q8},[r14,:128]!
2561 eor r12,r0,r4,ror#19
2577 eor r0,r11,r11,ror#5
2580 eor r3,r0,r11,ror#19
2594 eor r0,r10,r10,ror#5
2597 eor r12,r0,r10,ror#19
2626 vst1.32 {q8},[r1,:128]!
2628 add r4,r4,r12 @ h+=Maj(a,b,c) from the past
2632 add r4,r4,r0 @ accumulate
2654 ldreq sp,[sp,#76] @ restore original sp
2659 ldmia sp!,{r4-r12,pc}
2660 .size sha256_block_data_order_neon,.-sha256_block_data_order_neon
2662 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
2665 # define INST(a,b,c,d) .byte c,d|0xc,a,b
2667 # define INST(a,b,c,d) .byte a,b,c,d
2670 .type sha256_block_data_order_armv8,%function
2672 sha256_block_data_order_armv8:
2674 vld1.32 {q0,q1},[r0]
2677 sub r3,r3,#.LARMv8-K256
2681 add r2,r1,r2,lsl#6 @ len to point at the end of inp
2684 vld1.8 {q8-q9},[r1]!
2685 vld1.8 {q10-q11},[r1]!
2691 vmov q14,q0 @ offload
2696 INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
2698 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2699 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2700 INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
2703 INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
2705 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2706 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2707 INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
2709 vadd.i32 q12,q12,q10
2710 INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
2712 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2713 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2714 INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
2716 vadd.i32 q13,q13,q11
2717 INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
2719 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2720 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2721 INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
2724 INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
2726 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2727 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2728 INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
2731 INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
2733 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2734 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2735 INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
2737 vadd.i32 q12,q12,q10
2738 INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
2740 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2741 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2742 INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
2744 vadd.i32 q13,q13,q11
2745 INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
2747 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2748 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2749 INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
2752 INST(0xe2,0x03,0xfa,0xf3) @ sha256su0 q8,q9
2754 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2755 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2756 INST(0xe6,0x0c,0x64,0xf3) @ sha256su1 q8,q10,q11
2759 INST(0xe4,0x23,0xfa,0xf3) @ sha256su0 q9,q10
2761 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2762 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2763 INST(0xe0,0x2c,0x66,0xf3) @ sha256su1 q9,q11,q8
2765 vadd.i32 q12,q12,q10
2766 INST(0xe6,0x43,0xfa,0xf3) @ sha256su0 q10,q11
2768 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2769 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2770 INST(0xe2,0x4c,0x60,0xf3) @ sha256su1 q10,q8,q9
2772 vadd.i32 q13,q13,q11
2773 INST(0xe0,0x63,0xfa,0xf3) @ sha256su0 q11,q8
2775 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2776 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2777 INST(0xe4,0x6c,0x62,0xf3) @ sha256su1 q11,q9,q10
2781 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2782 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2787 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2788 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2791 vadd.i32 q12,q12,q10
2792 sub r3,r3,#256-16 @ rewind
2794 INST(0x68,0x0c,0x02,0xf3) @ sha256h q0,q1,q12
2795 INST(0x68,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q12
2797 vadd.i32 q13,q13,q11
2799 INST(0x6a,0x0c,0x02,0xf3) @ sha256h q0,q1,q13
2800 INST(0x6a,0x2c,0x14,0xf3) @ sha256h2 q1,q2,q13
2807 vst1.32 {q0,q1},[r0]
2810 .size sha256_block_data_order_armv8,.-sha256_block_data_order_armv8
2812 .asciz "SHA256 block transform for ARMv4/NEON/ARMv8, CRYPTOGAMS by <appro@openssl.org>"
2814 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
2815 .comm OPENSSL_armcap_P,4,4