6 # define WORD64(hi0,lo0,hi1,lo1) .word lo0,hi0, lo1,hi1
10 # define WORD64(hi0,lo0,hi1,lo1) .word hi0,lo0, hi1,lo1
18 WORD64(0x428a2f98,0xd728ae22, 0x71374491,0x23ef65cd)
19 WORD64(0xb5c0fbcf,0xec4d3b2f, 0xe9b5dba5,0x8189dbbc)
20 WORD64(0x3956c25b,0xf348b538, 0x59f111f1,0xb605d019)
21 WORD64(0x923f82a4,0xaf194f9b, 0xab1c5ed5,0xda6d8118)
22 WORD64(0xd807aa98,0xa3030242, 0x12835b01,0x45706fbe)
23 WORD64(0x243185be,0x4ee4b28c, 0x550c7dc3,0xd5ffb4e2)
24 WORD64(0x72be5d74,0xf27b896f, 0x80deb1fe,0x3b1696b1)
25 WORD64(0x9bdc06a7,0x25c71235, 0xc19bf174,0xcf692694)
26 WORD64(0xe49b69c1,0x9ef14ad2, 0xefbe4786,0x384f25e3)
27 WORD64(0x0fc19dc6,0x8b8cd5b5, 0x240ca1cc,0x77ac9c65)
28 WORD64(0x2de92c6f,0x592b0275, 0x4a7484aa,0x6ea6e483)
29 WORD64(0x5cb0a9dc,0xbd41fbd4, 0x76f988da,0x831153b5)
30 WORD64(0x983e5152,0xee66dfab, 0xa831c66d,0x2db43210)
31 WORD64(0xb00327c8,0x98fb213f, 0xbf597fc7,0xbeef0ee4)
32 WORD64(0xc6e00bf3,0x3da88fc2, 0xd5a79147,0x930aa725)
33 WORD64(0x06ca6351,0xe003826f, 0x14292967,0x0a0e6e70)
34 WORD64(0x27b70a85,0x46d22ffc, 0x2e1b2138,0x5c26c926)
35 WORD64(0x4d2c6dfc,0x5ac42aed, 0x53380d13,0x9d95b3df)
36 WORD64(0x650a7354,0x8baf63de, 0x766a0abb,0x3c77b2a8)
37 WORD64(0x81c2c92e,0x47edaee6, 0x92722c85,0x1482353b)
38 WORD64(0xa2bfe8a1,0x4cf10364, 0xa81a664b,0xbc423001)
39 WORD64(0xc24b8b70,0xd0f89791, 0xc76c51a3,0x0654be30)
40 WORD64(0xd192e819,0xd6ef5218, 0xd6990624,0x5565a910)
41 WORD64(0xf40e3585,0x5771202a, 0x106aa070,0x32bbd1b8)
42 WORD64(0x19a4c116,0xb8d2d0c8, 0x1e376c08,0x5141ab53)
43 WORD64(0x2748774c,0xdf8eeb99, 0x34b0bcb5,0xe19b48a8)
44 WORD64(0x391c0cb3,0xc5c95a63, 0x4ed8aa4a,0xe3418acb)
45 WORD64(0x5b9cca4f,0x7763e373, 0x682e6ff3,0xd6b2b8a3)
46 WORD64(0x748f82ee,0x5defb2fc, 0x78a5636f,0x43172f60)
47 WORD64(0x84c87814,0xa1f0ab72, 0x8cc70208,0x1a6439ec)
48 WORD64(0x90befffa,0x23631e28, 0xa4506ceb,0xde82bde9)
49 WORD64(0xbef9a3f7,0xb2c67915, 0xc67178f2,0xe372532b)
50 WORD64(0xca273ece,0xea26619c, 0xd186b8c7,0x21c0c207)
51 WORD64(0xeada7dd6,0xcde0eb1e, 0xf57d4f7f,0xee6ed178)
52 WORD64(0x06f067aa,0x72176fba, 0x0a637dc5,0xa2c898a6)
53 WORD64(0x113f9804,0xbef90dae, 0x1b710b35,0x131c471b)
54 WORD64(0x28db77f5,0x23047d84, 0x32caab7b,0x40c72493)
55 WORD64(0x3c9ebe0a,0x15c9bebc, 0x431d67c4,0x9c100d4c)
56 WORD64(0x4cc5d4be,0xcb3e42b6, 0x597f299c,0xfc657e2a)
57 WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
59 #if __ARM_MAX_ARCH__>=7
61 .word OPENSSL_armcap_P-sha512_block_data_order
67 .global sha512_block_data_order
68 .type sha512_block_data_order,%function
69 sha512_block_data_order:
70 sub r3,pc,#8 @ sha512_block_data_order
71 add r2,r1,r2,lsl#7 @ len to point at the end of inp
72 #if __ARM_MAX_ARCH__>=7
73 ldr r12,.LOPENSSL_armcap
74 ldr r12,[r3,r12] @ OPENSSL_armcap_P
79 sub r14,r3,#672 @ K512
136 @ Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
137 @ LO lo>>14^hi<<18 ^ lo>>18^hi<<14 ^ hi>>9^lo<<23
138 @ HI hi>>14^lo<<18 ^ hi>>18^lo<<14 ^ lo>>9^hi<<23
144 ldr r11,[sp,#56+0] @ h.lo
145 eor r10,r10,r7,lsl#18
146 ldr r12,[sp,#56+4] @ h.hi
148 eor r10,r10,r8,lsr#18
150 eor r10,r10,r7,lsl#14
154 eor r10,r10,r8,lsl#23 @ Sigma1(e)
156 ldr r9,[sp,#40+0] @ f.lo
157 adc r4,r4,r10 @ T += Sigma1(e)
158 ldr r10,[sp,#40+4] @ f.hi
160 ldr r11,[sp,#48+0] @ g.lo
161 adc r4,r4,r12 @ T += h
162 ldr r12,[sp,#48+4] @ g.hi
173 ldr r11,[r14,#LO] @ K[i].lo
174 eor r10,r10,r12 @ Ch(e,f,g)
175 ldr r12,[r14,#HI] @ K[i].hi
178 ldr r7,[sp,#24+0] @ d.lo
179 adc r4,r4,r10 @ T += Ch(e,f,g)
180 ldr r8,[sp,#24+4] @ d.hi
183 adc r4,r4,r12 @ T += K[i]
185 ldr r11,[sp,#8+0] @ b.lo
186 adc r8,r8,r4 @ d += T
189 ldr r12,[sp,#16+0] @ c.lo
191 @ Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
192 @ LO lo>>28^hi<<4 ^ hi>>2^lo<<30 ^ hi>>7^lo<<25
193 @ HI hi>>28^lo<<4 ^ lo>>2^hi<<30 ^ lo>>7^hi<<25
201 eor r10,r10,r6,lsl#30
205 eor r10,r10,r6,lsl#25 @ Sigma0(a)
208 adc r4,r4,r10 @ T += Sigma0(a)
210 ldr r10,[sp,#8+4] @ b.hi
212 ldr r11,[sp,#16+4] @ c.hi
216 orr r5,r5,r9 @ Maj(a,b,c).lo
219 orr r6,r6,r12 @ Maj(a,b,c).hi
221 adc r6,r6,r4 @ h += T
230 @ sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
231 @ LO lo>>1^hi<<31 ^ lo>>8^hi<<24 ^ lo>>7^hi<<25
232 @ HI hi>>1^lo<<31 ^ hi>>8^lo<<24 ^ hi>>7
247 @ sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
248 @ LO lo>>19^hi<<13 ^ hi>>29^lo<<3 ^ lo>>6^hi<<26
249 @ HI hi>>19^lo<<13 ^ lo>>29^hi<<3 ^ hi>>6
253 eor r10,r10,r11,lsl#13
255 eor r10,r10,r11,lsr#29
257 eor r10,r10,r12,lsl#3
259 eor r10,r10,r12,lsr#6
273 @ Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
274 @ LO lo>>14^hi<<18 ^ lo>>18^hi<<14 ^ hi>>9^lo<<23
275 @ HI hi>>14^lo<<18 ^ hi>>18^lo<<14 ^ lo>>9^hi<<23
281 ldr r11,[sp,#56+0] @ h.lo
282 eor r10,r10,r7,lsl#18
283 ldr r12,[sp,#56+4] @ h.hi
285 eor r10,r10,r8,lsr#18
287 eor r10,r10,r7,lsl#14
291 eor r10,r10,r8,lsl#23 @ Sigma1(e)
293 ldr r9,[sp,#40+0] @ f.lo
294 adc r4,r4,r10 @ T += Sigma1(e)
295 ldr r10,[sp,#40+4] @ f.hi
297 ldr r11,[sp,#48+0] @ g.lo
298 adc r4,r4,r12 @ T += h
299 ldr r12,[sp,#48+4] @ g.hi
310 ldr r11,[r14,#LO] @ K[i].lo
311 eor r10,r10,r12 @ Ch(e,f,g)
312 ldr r12,[r14,#HI] @ K[i].hi
315 ldr r7,[sp,#24+0] @ d.lo
316 adc r4,r4,r10 @ T += Ch(e,f,g)
317 ldr r8,[sp,#24+4] @ d.hi
320 adc r4,r4,r12 @ T += K[i]
322 ldr r11,[sp,#8+0] @ b.lo
323 adc r8,r8,r4 @ d += T
326 ldr r12,[sp,#16+0] @ c.lo
328 @ Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
329 @ LO lo>>28^hi<<4 ^ hi>>2^lo<<30 ^ hi>>7^lo<<25
330 @ HI hi>>28^lo<<4 ^ lo>>2^hi<<30 ^ lo>>7^hi<<25
338 eor r10,r10,r6,lsl#30
342 eor r10,r10,r6,lsl#25 @ Sigma0(a)
345 adc r4,r4,r10 @ T += Sigma0(a)
347 ldr r10,[sp,#8+4] @ b.hi
349 ldr r11,[sp,#16+4] @ c.hi
353 orr r5,r5,r9 @ Maj(a,b,c).lo
356 orr r6,r6,r12 @ Maj(a,b,c).hi
358 adc r6,r6,r4 @ h += T
362 ldreq r10,[sp,#184+4]
436 add sp,sp,#8*9 @ destroy frame
438 ldmia sp!,{r4-r12,pc}
440 ldmia sp!,{r4-r12,lr}
442 moveq pc,lr @ be binary compatible with V4, yet
443 .word 0xe12fff1e @ interoperable with Thumb ISA:-)
445 #if __ARM_MAX_ARCH__>=7
451 dmb @ errata #451034 on early Cortex A8
452 vstmdb sp!,{d8-d15} @ ABI specification says so
453 sub r3,r3,#672 @ K512
454 vldmia r0,{d16-d23} @ load context
456 vshr.u64 d24,d20,#14 @ 0
458 vld1.64 {d0},[r1]! @ handles unaligned
462 vadd.i64 d16,d30 @ h+=Maj from the past
465 vld1.64 {d28},[r3,:64]! @ K[i++]
470 #if 0<16 && defined(__ARMEL__)
474 vbsl d29,d21,d22 @ Ch(e,f,g)
476 veor d26,d25 @ Sigma1(e)
488 vbsl d30,d18,d17 @ Maj(a,b,c)
489 veor d23,d26 @ Sigma0(a)
493 vshr.u64 d24,d19,#14 @ 1
495 vld1.64 {d1},[r1]! @ handles unaligned
499 vadd.i64 d23,d30 @ h+=Maj from the past
502 vld1.64 {d28},[r3,:64]! @ K[i++]
507 #if 1<16 && defined(__ARMEL__)
511 vbsl d29,d20,d21 @ Ch(e,f,g)
513 veor d26,d25 @ Sigma1(e)
525 vbsl d30,d17,d16 @ Maj(a,b,c)
526 veor d22,d26 @ Sigma0(a)
530 vshr.u64 d24,d18,#14 @ 2
532 vld1.64 {d2},[r1]! @ handles unaligned
536 vadd.i64 d22,d30 @ h+=Maj from the past
539 vld1.64 {d28},[r3,:64]! @ K[i++]
544 #if 2<16 && defined(__ARMEL__)
548 vbsl d29,d19,d20 @ Ch(e,f,g)
550 veor d26,d25 @ Sigma1(e)
562 vbsl d30,d16,d23 @ Maj(a,b,c)
563 veor d21,d26 @ Sigma0(a)
567 vshr.u64 d24,d17,#14 @ 3
569 vld1.64 {d3},[r1]! @ handles unaligned
573 vadd.i64 d21,d30 @ h+=Maj from the past
576 vld1.64 {d28},[r3,:64]! @ K[i++]
581 #if 3<16 && defined(__ARMEL__)
585 vbsl d29,d18,d19 @ Ch(e,f,g)
587 veor d26,d25 @ Sigma1(e)
599 vbsl d30,d23,d22 @ Maj(a,b,c)
600 veor d20,d26 @ Sigma0(a)
604 vshr.u64 d24,d16,#14 @ 4
606 vld1.64 {d4},[r1]! @ handles unaligned
610 vadd.i64 d20,d30 @ h+=Maj from the past
613 vld1.64 {d28},[r3,:64]! @ K[i++]
618 #if 4<16 && defined(__ARMEL__)
622 vbsl d29,d17,d18 @ Ch(e,f,g)
624 veor d26,d25 @ Sigma1(e)
636 vbsl d30,d22,d21 @ Maj(a,b,c)
637 veor d19,d26 @ Sigma0(a)
641 vshr.u64 d24,d23,#14 @ 5
643 vld1.64 {d5},[r1]! @ handles unaligned
647 vadd.i64 d19,d30 @ h+=Maj from the past
650 vld1.64 {d28},[r3,:64]! @ K[i++]
655 #if 5<16 && defined(__ARMEL__)
659 vbsl d29,d16,d17 @ Ch(e,f,g)
661 veor d26,d25 @ Sigma1(e)
673 vbsl d30,d21,d20 @ Maj(a,b,c)
674 veor d18,d26 @ Sigma0(a)
678 vshr.u64 d24,d22,#14 @ 6
680 vld1.64 {d6},[r1]! @ handles unaligned
684 vadd.i64 d18,d30 @ h+=Maj from the past
687 vld1.64 {d28},[r3,:64]! @ K[i++]
692 #if 6<16 && defined(__ARMEL__)
696 vbsl d29,d23,d16 @ Ch(e,f,g)
698 veor d26,d25 @ Sigma1(e)
710 vbsl d30,d20,d19 @ Maj(a,b,c)
711 veor d17,d26 @ Sigma0(a)
715 vshr.u64 d24,d21,#14 @ 7
717 vld1.64 {d7},[r1]! @ handles unaligned
721 vadd.i64 d17,d30 @ h+=Maj from the past
724 vld1.64 {d28},[r3,:64]! @ K[i++]
729 #if 7<16 && defined(__ARMEL__)
733 vbsl d29,d22,d23 @ Ch(e,f,g)
735 veor d26,d25 @ Sigma1(e)
747 vbsl d30,d19,d18 @ Maj(a,b,c)
748 veor d16,d26 @ Sigma0(a)
752 vshr.u64 d24,d20,#14 @ 8
754 vld1.64 {d8},[r1]! @ handles unaligned
758 vadd.i64 d16,d30 @ h+=Maj from the past
761 vld1.64 {d28},[r3,:64]! @ K[i++]
766 #if 8<16 && defined(__ARMEL__)
770 vbsl d29,d21,d22 @ Ch(e,f,g)
772 veor d26,d25 @ Sigma1(e)
784 vbsl d30,d18,d17 @ Maj(a,b,c)
785 veor d23,d26 @ Sigma0(a)
789 vshr.u64 d24,d19,#14 @ 9
791 vld1.64 {d9},[r1]! @ handles unaligned
795 vadd.i64 d23,d30 @ h+=Maj from the past
798 vld1.64 {d28},[r3,:64]! @ K[i++]
803 #if 9<16 && defined(__ARMEL__)
807 vbsl d29,d20,d21 @ Ch(e,f,g)
809 veor d26,d25 @ Sigma1(e)
821 vbsl d30,d17,d16 @ Maj(a,b,c)
822 veor d22,d26 @ Sigma0(a)
826 vshr.u64 d24,d18,#14 @ 10
828 vld1.64 {d10},[r1]! @ handles unaligned
832 vadd.i64 d22,d30 @ h+=Maj from the past
835 vld1.64 {d28},[r3,:64]! @ K[i++]
840 #if 10<16 && defined(__ARMEL__)
844 vbsl d29,d19,d20 @ Ch(e,f,g)
846 veor d26,d25 @ Sigma1(e)
858 vbsl d30,d16,d23 @ Maj(a,b,c)
859 veor d21,d26 @ Sigma0(a)
863 vshr.u64 d24,d17,#14 @ 11
865 vld1.64 {d11},[r1]! @ handles unaligned
869 vadd.i64 d21,d30 @ h+=Maj from the past
872 vld1.64 {d28},[r3,:64]! @ K[i++]
877 #if 11<16 && defined(__ARMEL__)
881 vbsl d29,d18,d19 @ Ch(e,f,g)
883 veor d26,d25 @ Sigma1(e)
895 vbsl d30,d23,d22 @ Maj(a,b,c)
896 veor d20,d26 @ Sigma0(a)
900 vshr.u64 d24,d16,#14 @ 12
902 vld1.64 {d12},[r1]! @ handles unaligned
906 vadd.i64 d20,d30 @ h+=Maj from the past
909 vld1.64 {d28},[r3,:64]! @ K[i++]
914 #if 12<16 && defined(__ARMEL__)
918 vbsl d29,d17,d18 @ Ch(e,f,g)
920 veor d26,d25 @ Sigma1(e)
932 vbsl d30,d22,d21 @ Maj(a,b,c)
933 veor d19,d26 @ Sigma0(a)
937 vshr.u64 d24,d23,#14 @ 13
939 vld1.64 {d13},[r1]! @ handles unaligned
943 vadd.i64 d19,d30 @ h+=Maj from the past
946 vld1.64 {d28},[r3,:64]! @ K[i++]
951 #if 13<16 && defined(__ARMEL__)
955 vbsl d29,d16,d17 @ Ch(e,f,g)
957 veor d26,d25 @ Sigma1(e)
969 vbsl d30,d21,d20 @ Maj(a,b,c)
970 veor d18,d26 @ Sigma0(a)
974 vshr.u64 d24,d22,#14 @ 14
976 vld1.64 {d14},[r1]! @ handles unaligned
980 vadd.i64 d18,d30 @ h+=Maj from the past
983 vld1.64 {d28},[r3,:64]! @ K[i++]
988 #if 14<16 && defined(__ARMEL__)
992 vbsl d29,d23,d16 @ Ch(e,f,g)
994 veor d26,d25 @ Sigma1(e)
1006 vbsl d30,d20,d19 @ Maj(a,b,c)
1007 veor d17,d26 @ Sigma0(a)
1011 vshr.u64 d24,d21,#14 @ 15
1013 vld1.64 {d15},[r1]! @ handles unaligned
1015 vshr.u64 d25,d21,#18
1017 vadd.i64 d17,d30 @ h+=Maj from the past
1019 vshr.u64 d26,d21,#41
1020 vld1.64 {d28},[r3,:64]! @ K[i++]
1025 #if 15<16 && defined(__ARMEL__)
1029 vbsl d29,d22,d23 @ Ch(e,f,g)
1030 vshr.u64 d24,d17,#28
1031 veor d26,d25 @ Sigma1(e)
1032 vadd.i64 d27,d29,d16
1033 vshr.u64 d25,d17,#34
1036 vshr.u64 d26,d17,#39
1043 vbsl d30,d19,d18 @ Maj(a,b,c)
1044 veor d16,d26 @ Sigma0(a)
1053 vadd.i64 d16,d30 @ h+=Maj from the past
1056 vext.8 q14,q0,q1,#8 @ X[i+1]
1060 veor q15,q13 @ sigma1(X[i+14])
1066 vext.8 q14,q4,q5,#8 @ X[i+9]
1068 vshr.u64 d24,d20,#14 @ from NEON_00_15
1070 vshr.u64 d25,d20,#18 @ from NEON_00_15
1071 veor q15,q13 @ sigma0(X[i+1])
1072 vshr.u64 d26,d20,#41 @ from NEON_00_15
1074 vld1.64 {d28},[r3,:64]! @ K[i++]
1079 #if 16<16 && defined(__ARMEL__)
1083 vbsl d29,d21,d22 @ Ch(e,f,g)
1084 vshr.u64 d24,d16,#28
1085 veor d26,d25 @ Sigma1(e)
1086 vadd.i64 d27,d29,d23
1087 vshr.u64 d25,d16,#34
1090 vshr.u64 d26,d16,#39
1097 vbsl d30,d18,d17 @ Maj(a,b,c)
1098 veor d23,d26 @ Sigma0(a)
1102 vshr.u64 d24,d19,#14 @ 17
1104 vld1.64 {d1},[r1]! @ handles unaligned
1106 vshr.u64 d25,d19,#18
1108 vadd.i64 d23,d30 @ h+=Maj from the past
1110 vshr.u64 d26,d19,#41
1111 vld1.64 {d28},[r3,:64]! @ K[i++]
1116 #if 17<16 && defined(__ARMEL__)
1120 vbsl d29,d20,d21 @ Ch(e,f,g)
1121 vshr.u64 d24,d23,#28
1122 veor d26,d25 @ Sigma1(e)
1123 vadd.i64 d27,d29,d22
1124 vshr.u64 d25,d23,#34
1127 vshr.u64 d26,d23,#39
1134 vbsl d30,d17,d16 @ Maj(a,b,c)
1135 veor d22,d26 @ Sigma0(a)
1141 vadd.i64 d22,d30 @ h+=Maj from the past
1144 vext.8 q14,q1,q2,#8 @ X[i+1]
1148 veor q15,q13 @ sigma1(X[i+14])
1154 vext.8 q14,q5,q6,#8 @ X[i+9]
1156 vshr.u64 d24,d18,#14 @ from NEON_00_15
1158 vshr.u64 d25,d18,#18 @ from NEON_00_15
1159 veor q15,q13 @ sigma0(X[i+1])
1160 vshr.u64 d26,d18,#41 @ from NEON_00_15
1162 vld1.64 {d28},[r3,:64]! @ K[i++]
1167 #if 18<16 && defined(__ARMEL__)
1171 vbsl d29,d19,d20 @ Ch(e,f,g)
1172 vshr.u64 d24,d22,#28
1173 veor d26,d25 @ Sigma1(e)
1174 vadd.i64 d27,d29,d21
1175 vshr.u64 d25,d22,#34
1178 vshr.u64 d26,d22,#39
1185 vbsl d30,d16,d23 @ Maj(a,b,c)
1186 veor d21,d26 @ Sigma0(a)
1190 vshr.u64 d24,d17,#14 @ 19
1192 vld1.64 {d3},[r1]! @ handles unaligned
1194 vshr.u64 d25,d17,#18
1196 vadd.i64 d21,d30 @ h+=Maj from the past
1198 vshr.u64 d26,d17,#41
1199 vld1.64 {d28},[r3,:64]! @ K[i++]
1204 #if 19<16 && defined(__ARMEL__)
1208 vbsl d29,d18,d19 @ Ch(e,f,g)
1209 vshr.u64 d24,d21,#28
1210 veor d26,d25 @ Sigma1(e)
1211 vadd.i64 d27,d29,d20
1212 vshr.u64 d25,d21,#34
1215 vshr.u64 d26,d21,#39
1222 vbsl d30,d23,d22 @ Maj(a,b,c)
1223 veor d20,d26 @ Sigma0(a)
1229 vadd.i64 d20,d30 @ h+=Maj from the past
1232 vext.8 q14,q2,q3,#8 @ X[i+1]
1236 veor q15,q13 @ sigma1(X[i+14])
1242 vext.8 q14,q6,q7,#8 @ X[i+9]
1244 vshr.u64 d24,d16,#14 @ from NEON_00_15
1246 vshr.u64 d25,d16,#18 @ from NEON_00_15
1247 veor q15,q13 @ sigma0(X[i+1])
1248 vshr.u64 d26,d16,#41 @ from NEON_00_15
1250 vld1.64 {d28},[r3,:64]! @ K[i++]
1255 #if 20<16 && defined(__ARMEL__)
1259 vbsl d29,d17,d18 @ Ch(e,f,g)
1260 vshr.u64 d24,d20,#28
1261 veor d26,d25 @ Sigma1(e)
1262 vadd.i64 d27,d29,d19
1263 vshr.u64 d25,d20,#34
1266 vshr.u64 d26,d20,#39
1273 vbsl d30,d22,d21 @ Maj(a,b,c)
1274 veor d19,d26 @ Sigma0(a)
1278 vshr.u64 d24,d23,#14 @ 21
1280 vld1.64 {d5},[r1]! @ handles unaligned
1282 vshr.u64 d25,d23,#18
1284 vadd.i64 d19,d30 @ h+=Maj from the past
1286 vshr.u64 d26,d23,#41
1287 vld1.64 {d28},[r3,:64]! @ K[i++]
1292 #if 21<16 && defined(__ARMEL__)
1296 vbsl d29,d16,d17 @ Ch(e,f,g)
1297 vshr.u64 d24,d19,#28
1298 veor d26,d25 @ Sigma1(e)
1299 vadd.i64 d27,d29,d18
1300 vshr.u64 d25,d19,#34
1303 vshr.u64 d26,d19,#39
1310 vbsl d30,d21,d20 @ Maj(a,b,c)
1311 veor d18,d26 @ Sigma0(a)
1317 vadd.i64 d18,d30 @ h+=Maj from the past
1320 vext.8 q14,q3,q4,#8 @ X[i+1]
1324 veor q15,q13 @ sigma1(X[i+14])
1330 vext.8 q14,q7,q0,#8 @ X[i+9]
1332 vshr.u64 d24,d22,#14 @ from NEON_00_15
1334 vshr.u64 d25,d22,#18 @ from NEON_00_15
1335 veor q15,q13 @ sigma0(X[i+1])
1336 vshr.u64 d26,d22,#41 @ from NEON_00_15
1338 vld1.64 {d28},[r3,:64]! @ K[i++]
1343 #if 22<16 && defined(__ARMEL__)
1347 vbsl d29,d23,d16 @ Ch(e,f,g)
1348 vshr.u64 d24,d18,#28
1349 veor d26,d25 @ Sigma1(e)
1350 vadd.i64 d27,d29,d17
1351 vshr.u64 d25,d18,#34
1354 vshr.u64 d26,d18,#39
1361 vbsl d30,d20,d19 @ Maj(a,b,c)
1362 veor d17,d26 @ Sigma0(a)
1366 vshr.u64 d24,d21,#14 @ 23
1368 vld1.64 {d7},[r1]! @ handles unaligned
1370 vshr.u64 d25,d21,#18
1372 vadd.i64 d17,d30 @ h+=Maj from the past
1374 vshr.u64 d26,d21,#41
1375 vld1.64 {d28},[r3,:64]! @ K[i++]
1380 #if 23<16 && defined(__ARMEL__)
1384 vbsl d29,d22,d23 @ Ch(e,f,g)
1385 vshr.u64 d24,d17,#28
1386 veor d26,d25 @ Sigma1(e)
1387 vadd.i64 d27,d29,d16
1388 vshr.u64 d25,d17,#34
1391 vshr.u64 d26,d17,#39
1398 vbsl d30,d19,d18 @ Maj(a,b,c)
1399 veor d16,d26 @ Sigma0(a)
1405 vadd.i64 d16,d30 @ h+=Maj from the past
1408 vext.8 q14,q4,q5,#8 @ X[i+1]
1412 veor q15,q13 @ sigma1(X[i+14])
1418 vext.8 q14,q0,q1,#8 @ X[i+9]
1420 vshr.u64 d24,d20,#14 @ from NEON_00_15
1422 vshr.u64 d25,d20,#18 @ from NEON_00_15
1423 veor q15,q13 @ sigma0(X[i+1])
1424 vshr.u64 d26,d20,#41 @ from NEON_00_15
1426 vld1.64 {d28},[r3,:64]! @ K[i++]
1431 #if 24<16 && defined(__ARMEL__)
1435 vbsl d29,d21,d22 @ Ch(e,f,g)
1436 vshr.u64 d24,d16,#28
1437 veor d26,d25 @ Sigma1(e)
1438 vadd.i64 d27,d29,d23
1439 vshr.u64 d25,d16,#34
1442 vshr.u64 d26,d16,#39
1449 vbsl d30,d18,d17 @ Maj(a,b,c)
1450 veor d23,d26 @ Sigma0(a)
1454 vshr.u64 d24,d19,#14 @ 25
1456 vld1.64 {d9},[r1]! @ handles unaligned
1458 vshr.u64 d25,d19,#18
1460 vadd.i64 d23,d30 @ h+=Maj from the past
1462 vshr.u64 d26,d19,#41
1463 vld1.64 {d28},[r3,:64]! @ K[i++]
1468 #if 25<16 && defined(__ARMEL__)
1472 vbsl d29,d20,d21 @ Ch(e,f,g)
1473 vshr.u64 d24,d23,#28
1474 veor d26,d25 @ Sigma1(e)
1475 vadd.i64 d27,d29,d22
1476 vshr.u64 d25,d23,#34
1479 vshr.u64 d26,d23,#39
1486 vbsl d30,d17,d16 @ Maj(a,b,c)
1487 veor d22,d26 @ Sigma0(a)
1493 vadd.i64 d22,d30 @ h+=Maj from the past
1496 vext.8 q14,q5,q6,#8 @ X[i+1]
1500 veor q15,q13 @ sigma1(X[i+14])
1506 vext.8 q14,q1,q2,#8 @ X[i+9]
1508 vshr.u64 d24,d18,#14 @ from NEON_00_15
1510 vshr.u64 d25,d18,#18 @ from NEON_00_15
1511 veor q15,q13 @ sigma0(X[i+1])
1512 vshr.u64 d26,d18,#41 @ from NEON_00_15
1514 vld1.64 {d28},[r3,:64]! @ K[i++]
1519 #if 26<16 && defined(__ARMEL__)
1523 vbsl d29,d19,d20 @ Ch(e,f,g)
1524 vshr.u64 d24,d22,#28
1525 veor d26,d25 @ Sigma1(e)
1526 vadd.i64 d27,d29,d21
1527 vshr.u64 d25,d22,#34
1530 vshr.u64 d26,d22,#39
1537 vbsl d30,d16,d23 @ Maj(a,b,c)
1538 veor d21,d26 @ Sigma0(a)
1542 vshr.u64 d24,d17,#14 @ 27
1544 vld1.64 {d11},[r1]! @ handles unaligned
1546 vshr.u64 d25,d17,#18
1548 vadd.i64 d21,d30 @ h+=Maj from the past
1550 vshr.u64 d26,d17,#41
1551 vld1.64 {d28},[r3,:64]! @ K[i++]
1556 #if 27<16 && defined(__ARMEL__)
1560 vbsl d29,d18,d19 @ Ch(e,f,g)
1561 vshr.u64 d24,d21,#28
1562 veor d26,d25 @ Sigma1(e)
1563 vadd.i64 d27,d29,d20
1564 vshr.u64 d25,d21,#34
1567 vshr.u64 d26,d21,#39
1574 vbsl d30,d23,d22 @ Maj(a,b,c)
1575 veor d20,d26 @ Sigma0(a)
1581 vadd.i64 d20,d30 @ h+=Maj from the past
1584 vext.8 q14,q6,q7,#8 @ X[i+1]
1588 veor q15,q13 @ sigma1(X[i+14])
1594 vext.8 q14,q2,q3,#8 @ X[i+9]
1596 vshr.u64 d24,d16,#14 @ from NEON_00_15
1598 vshr.u64 d25,d16,#18 @ from NEON_00_15
1599 veor q15,q13 @ sigma0(X[i+1])
1600 vshr.u64 d26,d16,#41 @ from NEON_00_15
1602 vld1.64 {d28},[r3,:64]! @ K[i++]
1607 #if 28<16 && defined(__ARMEL__)
1611 vbsl d29,d17,d18 @ Ch(e,f,g)
1612 vshr.u64 d24,d20,#28
1613 veor d26,d25 @ Sigma1(e)
1614 vadd.i64 d27,d29,d19
1615 vshr.u64 d25,d20,#34
1618 vshr.u64 d26,d20,#39
1625 vbsl d30,d22,d21 @ Maj(a,b,c)
1626 veor d19,d26 @ Sigma0(a)
1630 vshr.u64 d24,d23,#14 @ 29
1632 vld1.64 {d13},[r1]! @ handles unaligned
1634 vshr.u64 d25,d23,#18
1636 vadd.i64 d19,d30 @ h+=Maj from the past
1638 vshr.u64 d26,d23,#41
1639 vld1.64 {d28},[r3,:64]! @ K[i++]
1644 #if 29<16 && defined(__ARMEL__)
1648 vbsl d29,d16,d17 @ Ch(e,f,g)
1649 vshr.u64 d24,d19,#28
1650 veor d26,d25 @ Sigma1(e)
1651 vadd.i64 d27,d29,d18
1652 vshr.u64 d25,d19,#34
1655 vshr.u64 d26,d19,#39
1662 vbsl d30,d21,d20 @ Maj(a,b,c)
1663 veor d18,d26 @ Sigma0(a)
1669 vadd.i64 d18,d30 @ h+=Maj from the past
1672 vext.8 q14,q7,q0,#8 @ X[i+1]
1676 veor q15,q13 @ sigma1(X[i+14])
1682 vext.8 q14,q3,q4,#8 @ X[i+9]
1684 vshr.u64 d24,d22,#14 @ from NEON_00_15
1686 vshr.u64 d25,d22,#18 @ from NEON_00_15
1687 veor q15,q13 @ sigma0(X[i+1])
1688 vshr.u64 d26,d22,#41 @ from NEON_00_15
1690 vld1.64 {d28},[r3,:64]! @ K[i++]
1695 #if 30<16 && defined(__ARMEL__)
1699 vbsl d29,d23,d16 @ Ch(e,f,g)
1700 vshr.u64 d24,d18,#28
1701 veor d26,d25 @ Sigma1(e)
1702 vadd.i64 d27,d29,d17
1703 vshr.u64 d25,d18,#34
1706 vshr.u64 d26,d18,#39
1713 vbsl d30,d20,d19 @ Maj(a,b,c)
1714 veor d17,d26 @ Sigma0(a)
1718 vshr.u64 d24,d21,#14 @ 31
1720 vld1.64 {d15},[r1]! @ handles unaligned
1722 vshr.u64 d25,d21,#18
1724 vadd.i64 d17,d30 @ h+=Maj from the past
1726 vshr.u64 d26,d21,#41
1727 vld1.64 {d28},[r3,:64]! @ K[i++]
1732 #if 31<16 && defined(__ARMEL__)
1736 vbsl d29,d22,d23 @ Ch(e,f,g)
1737 vshr.u64 d24,d17,#28
1738 veor d26,d25 @ Sigma1(e)
1739 vadd.i64 d27,d29,d16
1740 vshr.u64 d25,d17,#34
1743 vshr.u64 d26,d17,#39
1750 vbsl d30,d19,d18 @ Maj(a,b,c)
1751 veor d16,d26 @ Sigma0(a)
1757 vadd.i64 d16,d30 @ h+=Maj from the past
1758 vldmia r0,{d24-d31} @ load context to temp
1759 vadd.i64 q8,q12 @ vectorized accumulate
1763 vstmia r0,{d16-d23} @ save context
1765 sub r3,#640 @ rewind K512
1768 vldmia sp!,{d8-d15} @ epilogue
1769 RET @ .word 0xe12fff1e
1771 .size sha512_block_data_order,.-sha512_block_data_order
1772 .asciz "SHA512 block transform for ARMv4/NEON, CRYPTOGAMS by <appro@openssl.org>"
1774 #if __ARM_MAX_ARCH__>=7
1775 .comm OPENSSL_armcap_P,4,4