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