Home | History | Annotate | Download | only in sha
      1 .text
      2 
      3 .global	sha1_block_data_order
      4 .type	sha1_block_data_order,%function
      5 
      6 .align	2
      7 sha1_block_data_order:
      8 	stmdb	sp!,{r4-r12,lr}
      9 	add	r2,r1,r2,lsl#6	@ r2 to point at the end of r1
     10 	ldmia	r0,{r3,r4,r5,r6,r7}
     11 .Lloop:
     12 	ldr	r8,.LK_00_19
     13 	mov	r14,sp
     14 	sub	sp,sp,#15*4
     15 	mov	r5,r5,ror#30
     16 	mov	r6,r6,ror#30
     17 	mov	r7,r7,ror#30		@ [6]
     18 .L_00_15:
     19 	ldrb	r10,[r1],#4
     20 	ldrb	r11,[r1,#-3]
     21 	ldrb	r12,[r1,#-2]
     22 	add	r7,r8,r7,ror#2			@ E+=K_00_19
     23 	orr	r10,r11,r10,lsl#8
     24 	ldrb	r11,[r1,#-1]
     25 	orr	r10,r12,r10,lsl#8
     26 	add	r7,r7,r3,ror#27			@ E+=ROR(A,27)
     27 	orr	r10,r11,r10,lsl#8
     28 	add	r7,r7,r10			@ E+=X[i]
     29 	eor	r11,r5,r6			@ F_xx_xx
     30 	str	r10,[r14,#-4]!
     31 	and	r11,r4,r11,ror#2
     32 	eor	r11,r11,r6,ror#2		@ F_00_19(B,C,D)
     33 	add	r7,r7,r11			@ E+=F_00_19(B,C,D)
     34 	ldrb	r10,[r1],#4
     35 	ldrb	r11,[r1,#-3]
     36 	ldrb	r12,[r1,#-2]
     37 	add	r6,r8,r6,ror#2			@ E+=K_00_19
     38 	orr	r10,r11,r10,lsl#8
     39 	ldrb	r11,[r1,#-1]
     40 	orr	r10,r12,r10,lsl#8
     41 	add	r6,r6,r7,ror#27			@ E+=ROR(A,27)
     42 	orr	r10,r11,r10,lsl#8
     43 	add	r6,r6,r10			@ E+=X[i]
     44 	eor	r11,r4,r5			@ F_xx_xx
     45 	str	r10,[r14,#-4]!
     46 	and	r11,r3,r11,ror#2
     47 	eor	r11,r11,r5,ror#2		@ F_00_19(B,C,D)
     48 	add	r6,r6,r11			@ E+=F_00_19(B,C,D)
     49 	ldrb	r10,[r1],#4
     50 	ldrb	r11,[r1,#-3]
     51 	ldrb	r12,[r1,#-2]
     52 	add	r5,r8,r5,ror#2			@ E+=K_00_19
     53 	orr	r10,r11,r10,lsl#8
     54 	ldrb	r11,[r1,#-1]
     55 	orr	r10,r12,r10,lsl#8
     56 	add	r5,r5,r6,ror#27			@ E+=ROR(A,27)
     57 	orr	r10,r11,r10,lsl#8
     58 	add	r5,r5,r10			@ E+=X[i]
     59 	eor	r11,r3,r4			@ F_xx_xx
     60 	str	r10,[r14,#-4]!
     61 	and	r11,r7,r11,ror#2
     62 	eor	r11,r11,r4,ror#2		@ F_00_19(B,C,D)
     63 	add	r5,r5,r11			@ E+=F_00_19(B,C,D)
     64 	ldrb	r10,[r1],#4
     65 	ldrb	r11,[r1,#-3]
     66 	ldrb	r12,[r1,#-2]
     67 	add	r4,r8,r4,ror#2			@ E+=K_00_19
     68 	orr	r10,r11,r10,lsl#8
     69 	ldrb	r11,[r1,#-1]
     70 	orr	r10,r12,r10,lsl#8
     71 	add	r4,r4,r5,ror#27			@ E+=ROR(A,27)
     72 	orr	r10,r11,r10,lsl#8
     73 	add	r4,r4,r10			@ E+=X[i]
     74 	eor	r11,r7,r3			@ F_xx_xx
     75 	str	r10,[r14,#-4]!
     76 	and	r11,r6,r11,ror#2
     77 	eor	r11,r11,r3,ror#2		@ F_00_19(B,C,D)
     78 	add	r4,r4,r11			@ E+=F_00_19(B,C,D)
     79 	ldrb	r10,[r1],#4
     80 	ldrb	r11,[r1,#-3]
     81 	ldrb	r12,[r1,#-2]
     82 	add	r3,r8,r3,ror#2			@ E+=K_00_19
     83 	orr	r10,r11,r10,lsl#8
     84 	ldrb	r11,[r1,#-1]
     85 	orr	r10,r12,r10,lsl#8
     86 	add	r3,r3,r4,ror#27			@ E+=ROR(A,27)
     87 	orr	r10,r11,r10,lsl#8
     88 	add	r3,r3,r10			@ E+=X[i]
     89 	eor	r11,r6,r7			@ F_xx_xx
     90 	str	r10,[r14,#-4]!
     91 	and	r11,r5,r11,ror#2
     92 	eor	r11,r11,r7,ror#2		@ F_00_19(B,C,D)
     93 	add	r3,r3,r11			@ E+=F_00_19(B,C,D)
     94 	teq	r14,sp
     95 	bne	.L_00_15		@ [((11+4)*5+2)*3]
     96 	ldrb	r10,[r1],#4
     97 	ldrb	r11,[r1,#-3]
     98 	ldrb	r12,[r1,#-2]
     99 	add	r7,r8,r7,ror#2			@ E+=K_00_19
    100 	orr	r10,r11,r10,lsl#8
    101 	ldrb	r11,[r1,#-1]
    102 	orr	r10,r12,r10,lsl#8
    103 	add	r7,r7,r3,ror#27			@ E+=ROR(A,27)
    104 	orr	r10,r11,r10,lsl#8
    105 	add	r7,r7,r10			@ E+=X[i]
    106 	eor	r11,r5,r6			@ F_xx_xx
    107 	str	r10,[r14,#-4]!
    108 	and	r11,r4,r11,ror#2
    109 	eor	r11,r11,r6,ror#2		@ F_00_19(B,C,D)
    110 	add	r7,r7,r11			@ E+=F_00_19(B,C,D)
    111 	ldr	r10,[r14,#15*4]
    112 	ldr	r11,[r14,#13*4]
    113 	ldr	r12,[r14,#7*4]
    114 	add	r6,r8,r6,ror#2			@ E+=K_xx_xx
    115 	eor	r10,r10,r11
    116 	ldr	r11,[r14,#2*4]
    117 	add	r6,r6,r7,ror#27			@ E+=ROR(A,27)
    118 	eor	r10,r10,r12
    119 	eor	r10,r10,r11
    120 	eor	r11,r4,r5			@ F_xx_xx, but not in 40_59
    121 	mov	r10,r10,ror#31
    122 	add	r6,r6,r10			@ E+=X[i]
    123 	str	r10,[r14,#-4]!
    124 	and	r11,r3,r11,ror#2
    125 	eor	r11,r11,r5,ror#2		@ F_00_19(B,C,D)
    126 	add	r6,r6,r11			@ E+=F_00_19(B,C,D)
    127 	ldr	r10,[r14,#15*4]
    128 	ldr	r11,[r14,#13*4]
    129 	ldr	r12,[r14,#7*4]
    130 	add	r5,r8,r5,ror#2			@ E+=K_xx_xx
    131 	eor	r10,r10,r11
    132 	ldr	r11,[r14,#2*4]
    133 	add	r5,r5,r6,ror#27			@ E+=ROR(A,27)
    134 	eor	r10,r10,r12
    135 	eor	r10,r10,r11
    136 	eor	r11,r3,r4			@ F_xx_xx, but not in 40_59
    137 	mov	r10,r10,ror#31
    138 	add	r5,r5,r10			@ E+=X[i]
    139 	str	r10,[r14,#-4]!
    140 	and	r11,r7,r11,ror#2
    141 	eor	r11,r11,r4,ror#2		@ F_00_19(B,C,D)
    142 	add	r5,r5,r11			@ E+=F_00_19(B,C,D)
    143 	ldr	r10,[r14,#15*4]
    144 	ldr	r11,[r14,#13*4]
    145 	ldr	r12,[r14,#7*4]
    146 	add	r4,r8,r4,ror#2			@ E+=K_xx_xx
    147 	eor	r10,r10,r11
    148 	ldr	r11,[r14,#2*4]
    149 	add	r4,r4,r5,ror#27			@ E+=ROR(A,27)
    150 	eor	r10,r10,r12
    151 	eor	r10,r10,r11
    152 	eor	r11,r7,r3			@ F_xx_xx, but not in 40_59
    153 	mov	r10,r10,ror#31
    154 	add	r4,r4,r10			@ E+=X[i]
    155 	str	r10,[r14,#-4]!
    156 	and	r11,r6,r11,ror#2
    157 	eor	r11,r11,r3,ror#2		@ F_00_19(B,C,D)
    158 	add	r4,r4,r11			@ E+=F_00_19(B,C,D)
    159 	ldr	r10,[r14,#15*4]
    160 	ldr	r11,[r14,#13*4]
    161 	ldr	r12,[r14,#7*4]
    162 	add	r3,r8,r3,ror#2			@ E+=K_xx_xx
    163 	eor	r10,r10,r11
    164 	ldr	r11,[r14,#2*4]
    165 	add	r3,r3,r4,ror#27			@ E+=ROR(A,27)
    166 	eor	r10,r10,r12
    167 	eor	r10,r10,r11
    168 	eor	r11,r6,r7			@ F_xx_xx, but not in 40_59
    169 	mov	r10,r10,ror#31
    170 	add	r3,r3,r10			@ E+=X[i]
    171 	str	r10,[r14,#-4]!
    172 	and	r11,r5,r11,ror#2
    173 	eor	r11,r11,r7,ror#2		@ F_00_19(B,C,D)
    174 	add	r3,r3,r11			@ E+=F_00_19(B,C,D)
    175 
    176 	ldr	r8,.LK_20_39		@ [+15+16*4]
    177 	sub	sp,sp,#25*4
    178 	cmn	sp,#0			@ [+3], clear carry to denote 20_39
    179 .L_20_39_or_60_79:
    180 	ldr	r10,[r14,#15*4]
    181 	ldr	r11,[r14,#13*4]
    182 	ldr	r12,[r14,#7*4]
    183 	add	r7,r8,r7,ror#2			@ E+=K_xx_xx
    184 	eor	r10,r10,r11
    185 	ldr	r11,[r14,#2*4]
    186 	add	r7,r7,r3,ror#27			@ E+=ROR(A,27)
    187 	eor	r10,r10,r12
    188 	eor	r10,r10,r11
    189 	eor	r11,r5,r6			@ F_xx_xx, but not in 40_59
    190 	mov	r10,r10,ror#31
    191 	add	r7,r7,r10			@ E+=X[i]
    192 	str	r10,[r14,#-4]!
    193 	eor	r11,r4,r11,ror#2		@ F_20_39(B,C,D)
    194 	add	r7,r7,r11			@ E+=F_20_39(B,C,D)
    195 	ldr	r10,[r14,#15*4]
    196 	ldr	r11,[r14,#13*4]
    197 	ldr	r12,[r14,#7*4]
    198 	add	r6,r8,r6,ror#2			@ E+=K_xx_xx
    199 	eor	r10,r10,r11
    200 	ldr	r11,[r14,#2*4]
    201 	add	r6,r6,r7,ror#27			@ E+=ROR(A,27)
    202 	eor	r10,r10,r12
    203 	eor	r10,r10,r11
    204 	eor	r11,r4,r5			@ F_xx_xx, but not in 40_59
    205 	mov	r10,r10,ror#31
    206 	add	r6,r6,r10			@ E+=X[i]
    207 	str	r10,[r14,#-4]!
    208 	eor	r11,r3,r11,ror#2		@ F_20_39(B,C,D)
    209 	add	r6,r6,r11			@ E+=F_20_39(B,C,D)
    210 	ldr	r10,[r14,#15*4]
    211 	ldr	r11,[r14,#13*4]
    212 	ldr	r12,[r14,#7*4]
    213 	add	r5,r8,r5,ror#2			@ E+=K_xx_xx
    214 	eor	r10,r10,r11
    215 	ldr	r11,[r14,#2*4]
    216 	add	r5,r5,r6,ror#27			@ E+=ROR(A,27)
    217 	eor	r10,r10,r12
    218 	eor	r10,r10,r11
    219 	eor	r11,r3,r4			@ F_xx_xx, but not in 40_59
    220 	mov	r10,r10,ror#31
    221 	add	r5,r5,r10			@ E+=X[i]
    222 	str	r10,[r14,#-4]!
    223 	eor	r11,r7,r11,ror#2		@ F_20_39(B,C,D)
    224 	add	r5,r5,r11			@ E+=F_20_39(B,C,D)
    225 	ldr	r10,[r14,#15*4]
    226 	ldr	r11,[r14,#13*4]
    227 	ldr	r12,[r14,#7*4]
    228 	add	r4,r8,r4,ror#2			@ E+=K_xx_xx
    229 	eor	r10,r10,r11
    230 	ldr	r11,[r14,#2*4]
    231 	add	r4,r4,r5,ror#27			@ E+=ROR(A,27)
    232 	eor	r10,r10,r12
    233 	eor	r10,r10,r11
    234 	eor	r11,r7,r3			@ F_xx_xx, but not in 40_59
    235 	mov	r10,r10,ror#31
    236 	add	r4,r4,r10			@ E+=X[i]
    237 	str	r10,[r14,#-4]!
    238 	eor	r11,r6,r11,ror#2		@ F_20_39(B,C,D)
    239 	add	r4,r4,r11			@ E+=F_20_39(B,C,D)
    240 	ldr	r10,[r14,#15*4]
    241 	ldr	r11,[r14,#13*4]
    242 	ldr	r12,[r14,#7*4]
    243 	add	r3,r8,r3,ror#2			@ E+=K_xx_xx
    244 	eor	r10,r10,r11
    245 	ldr	r11,[r14,#2*4]
    246 	add	r3,r3,r4,ror#27			@ E+=ROR(A,27)
    247 	eor	r10,r10,r12
    248 	eor	r10,r10,r11
    249 	eor	r11,r6,r7			@ F_xx_xx, but not in 40_59
    250 	mov	r10,r10,ror#31
    251 	add	r3,r3,r10			@ E+=X[i]
    252 	str	r10,[r14,#-4]!
    253 	eor	r11,r5,r11,ror#2		@ F_20_39(B,C,D)
    254 	add	r3,r3,r11			@ E+=F_20_39(B,C,D)
    255 	teq	r14,sp			@ preserve carry
    256 	bne	.L_20_39_or_60_79	@ [+((12+3)*5+2)*4]
    257 	bcs	.L_done			@ [+((12+3)*5+2)*4], spare 300 bytes
    258 
    259 	ldr	r8,.LK_40_59
    260 	sub	sp,sp,#20*4		@ [+2]
    261 .L_40_59:
    262 	ldr	r10,[r14,#15*4]
    263 	ldr	r11,[r14,#13*4]
    264 	ldr	r12,[r14,#7*4]
    265 	add	r7,r8,r7,ror#2			@ E+=K_xx_xx
    266 	eor	r10,r10,r11
    267 	ldr	r11,[r14,#2*4]
    268 	add	r7,r7,r3,ror#27			@ E+=ROR(A,27)
    269 	eor	r10,r10,r12
    270 	eor	r10,r10,r11
    271 	mov	r10,r10,ror#31
    272 	add	r7,r7,r10			@ E+=X[i]
    273 	str	r10,[r14,#-4]!
    274 	and	r11,r4,r5,ror#2
    275 	orr	r12,r4,r5,ror#2
    276 	and	r12,r12,r6,ror#2
    277 	orr	r11,r11,r12			@ F_40_59(B,C,D)
    278 	add	r7,r7,r11			@ E+=F_40_59(B,C,D)
    279 	ldr	r10,[r14,#15*4]
    280 	ldr	r11,[r14,#13*4]
    281 	ldr	r12,[r14,#7*4]
    282 	add	r6,r8,r6,ror#2			@ E+=K_xx_xx
    283 	eor	r10,r10,r11
    284 	ldr	r11,[r14,#2*4]
    285 	add	r6,r6,r7,ror#27			@ E+=ROR(A,27)
    286 	eor	r10,r10,r12
    287 	eor	r10,r10,r11
    288 	mov	r10,r10,ror#31
    289 	add	r6,r6,r10			@ E+=X[i]
    290 	str	r10,[r14,#-4]!
    291 	and	r11,r3,r4,ror#2
    292 	orr	r12,r3,r4,ror#2
    293 	and	r12,r12,r5,ror#2
    294 	orr	r11,r11,r12			@ F_40_59(B,C,D)
    295 	add	r6,r6,r11			@ E+=F_40_59(B,C,D)
    296 	ldr	r10,[r14,#15*4]
    297 	ldr	r11,[r14,#13*4]
    298 	ldr	r12,[r14,#7*4]
    299 	add	r5,r8,r5,ror#2			@ E+=K_xx_xx
    300 	eor	r10,r10,r11
    301 	ldr	r11,[r14,#2*4]
    302 	add	r5,r5,r6,ror#27			@ E+=ROR(A,27)
    303 	eor	r10,r10,r12
    304 	eor	r10,r10,r11
    305 	mov	r10,r10,ror#31
    306 	add	r5,r5,r10			@ E+=X[i]
    307 	str	r10,[r14,#-4]!
    308 	and	r11,r7,r3,ror#2
    309 	orr	r12,r7,r3,ror#2
    310 	and	r12,r12,r4,ror#2
    311 	orr	r11,r11,r12			@ F_40_59(B,C,D)
    312 	add	r5,r5,r11			@ E+=F_40_59(B,C,D)
    313 	ldr	r10,[r14,#15*4]
    314 	ldr	r11,[r14,#13*4]
    315 	ldr	r12,[r14,#7*4]
    316 	add	r4,r8,r4,ror#2			@ E+=K_xx_xx
    317 	eor	r10,r10,r11
    318 	ldr	r11,[r14,#2*4]
    319 	add	r4,r4,r5,ror#27			@ E+=ROR(A,27)
    320 	eor	r10,r10,r12
    321 	eor	r10,r10,r11
    322 	mov	r10,r10,ror#31
    323 	add	r4,r4,r10			@ E+=X[i]
    324 	str	r10,[r14,#-4]!
    325 	and	r11,r6,r7,ror#2
    326 	orr	r12,r6,r7,ror#2
    327 	and	r12,r12,r3,ror#2
    328 	orr	r11,r11,r12			@ F_40_59(B,C,D)
    329 	add	r4,r4,r11			@ E+=F_40_59(B,C,D)
    330 	ldr	r10,[r14,#15*4]
    331 	ldr	r11,[r14,#13*4]
    332 	ldr	r12,[r14,#7*4]
    333 	add	r3,r8,r3,ror#2			@ E+=K_xx_xx
    334 	eor	r10,r10,r11
    335 	ldr	r11,[r14,#2*4]
    336 	add	r3,r3,r4,ror#27			@ E+=ROR(A,27)
    337 	eor	r10,r10,r12
    338 	eor	r10,r10,r11
    339 	mov	r10,r10,ror#31
    340 	add	r3,r3,r10			@ E+=X[i]
    341 	str	r10,[r14,#-4]!
    342 	and	r11,r5,r6,ror#2
    343 	orr	r12,r5,r6,ror#2
    344 	and	r12,r12,r7,ror#2
    345 	orr	r11,r11,r12			@ F_40_59(B,C,D)
    346 	add	r3,r3,r11			@ E+=F_40_59(B,C,D)
    347 	teq	r14,sp
    348 	bne	.L_40_59		@ [+((12+5)*5+2)*4]
    349 
    350 	ldr	r8,.LK_60_79
    351 	sub	sp,sp,#20*4
    352 	cmp	sp,#0			@ set carry to denote 60_79
    353 	b	.L_20_39_or_60_79	@ [+4], spare 300 bytes
    354 .L_done:
    355 	add	sp,sp,#80*4		@ "deallocate" stack frame
    356 	ldmia	r0,{r8,r10,r11,r12,r14}
    357 	add	r3,r8,r3
    358 	add	r4,r10,r4
    359 	add	r5,r11,r5,ror#2
    360 	add	r6,r12,r6,ror#2
    361 	add	r7,r14,r7,ror#2
    362 	stmia	r0,{r3,r4,r5,r6,r7}
    363 	teq	r1,r2
    364 	bne	.Lloop			@ [+18], total 1307
    365 
    366 	ldmia	sp!,{r4-r12,lr}
    367 	tst	lr,#1
    368 	moveq	pc,lr			@ be binary compatible with V4, yet
    369 	.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
    370 .align	2
    371 .LK_00_19:	.word	0x5a827999
    372 .LK_20_39:	.word	0x6ed9eba1
    373 .LK_40_59:	.word	0x8f1bbcdc
    374 .LK_60_79:	.word	0xca62c1d6
    375 .size	sha1_block_data_order,.-sha1_block_data_order
    376 .asciz	"SHA1 block transform for ARMv4, CRYPTOGAMS by <appro (at) openssl.org>"
    377