Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/atlas/blob/master/sha256_clean.s # atlas aien-dev/atlas Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `atlas / sha256_clean.s` 319 lines ยท 5516 bytes Raw Blame History 1 .arch armv8-a 2 .file "sha256_clean.c" 3 .text 4 .align 2 5 .p2align 4,,11 6 .global sha256_transform 7 .type sha256_transform, %function 8 sha256_transform: 9 stp x29, x30, [sp, -320]! 10 sub x4, x1, #4 11 mov x1, 1 12 mov x29, sp 13 add x12, sp, 64 14 stp x19, x20, [sp, 16] 15 stp x21, x22, [sp, 32] 16 stp x23, x24, [sp, 48] 17 .p2align 3,,7 18 .L2: 19 add x3, x12, x1, lsl 2 20 ldr w2, [x4, x1, lsl 2] 21 add x1, x1, 1 22 rev w2, w2 23 str w2, [x3, -4] 24 cmp x1, 17 25 bne .L2 26 ldr w5, [sp, 64] 27 add x4, sp, 68 28 ldp w13, w11, [sp, 100] 29 add x15, sp, 260 30 ldp w10, w9, [sp, 108] 31 ldp w8, w3, [sp, 116] 32 ldr w7, [sp, 124] 33 .p2align 3,,7 34 .L3: 35 add w6, w5, w13 36 ldr w5, [x4] 37 mov w13, w11 38 ror w2, w3, 19 39 eor w2, w2, w3, ror 17 40 mov w11, w10 41 eor w2, w2, w3, lsr 10 42 ror w1, w5, 18 43 eor w1, w1, w5, ror 7 44 mov w10, w9 45 eor w1, w1, w5, lsr 3 46 mov w9, w8 47 add w1, w1, w2 48 mov w8, w3 49 add x4, x4, 4 50 mov w3, w7 51 add w7, w1, w6 52 str w7, [x4, 56] 53 cmp x4, x15 54 bne .L3 55 ldp w20, w19, [x0] 56 adrp x13, .LANCHOR0 57 ldp w30, w18, [x0, 8] 58 add x13, x13, :lo12:.LANCHOR0 59 ldp w17, w16, [x0, 16] 60 mov w5, w20 61 ldp w15, w14, [x0, 24] 62 mov w8, w19 63 mov w6, w30 64 mov w11, w18 65 mov w4, w17 66 mov w10, w16 67 mov w9, w15 68 mov w21, w14 69 mov x7, 1 70 b .L4 71 .p2align 2,,3 72 .L5: 73 mov w9, w10 74 mov w6, w8 75 mov w10, w4 76 mov w8, w5 77 mov w4, w3 78 mov w5, w2 79 .L4: 80 lsl x1, x7, 2 81 ror w22, w4, 6 82 add x23, x13, x1 83 add x1, x12, x1 84 and w3, w4, w10 85 eor w22, w22, w4, ror 11 86 bic w2, w9, w4 87 eor w22, w22, w4, ror 25 88 ldr w24, [x1, -4] 89 eor w2, w2, w3 90 ldr w23, [x23, -4] 91 eor w3, w8, w6 92 add w2, w22, w2 93 ror w1, w5, 13 94 and w3, w3, w5 95 and w22, w8, w6 96 eor w1, w1, w5, ror 2 97 add w23, w23, w24 98 eor w3, w3, w22 99 eor w1, w1, w5, ror 22 100 add w2, w2, w23 101 add w1, w1, w3 102 add w2, w2, w21 103 add x7, x7, 1 104 add w3, w2, w11 105 mov w21, w9 106 add w2, w2, w1 107 mov w11, w6 108 cmp x7, 65 109 bne .L5 110 add w20, w20, w2 111 add w19, w19, w5 112 add w30, w30, w8 113 add w18, w18, w6 114 add w17, w17, w3 115 add w16, w16, w4 116 add w15, w15, w10 117 add w14, w14, w9 118 stp w20, w19, [x0] 119 stp w30, w18, [x0, 8] 120 stp w17, w16, [x0, 16] 121 stp w15, w14, [x0, 24] 122 ldp x19, x20, [sp, 16] 123 ldp x21, x22, [sp, 32] 124 ldp x23, x24, [sp, 48] 125 ldp x29, x30, [sp], 320 126 ret 127 .size sha256_transform, .-sha256_transform 128 .align 2 129 .p2align 4,,11 130 .global sha256_compute 131 .type sha256_compute, %function 132 sha256_compute: 133 stp x29, x30, [sp, -64]! 134 mov x5, 58983 135 mov x4, 62322 136 mov x29, sp 137 stp x21, x22, [sp, 32] 138 mov x22, x3 139 mov x3, 21119 140 str x23, [sp, 48] 141 mov x23, x1 142 mov x1, 55723 143 movk x5, 0x6a09, lsl 16 144 movk x4, 0x3c6e, lsl 16 145 movk x3, 0x510e, lsl 16 146 movk x1, 0x1f83, lsl 16 147 movk x5, 0xae85, lsl 32 148 movk x4, 0xf53a, lsl 32 149 movk x3, 0x688c, lsl 32 150 movk x1, 0xcd19, lsl 32 151 stp x19, x20, [sp, 16] 152 movk x5, 0xbb67, lsl 48 153 movk x4, 0xa54f, lsl 48 154 movk x3, 0x9b05, lsl 48 155 movk x1, 0x5be0, lsl 48 156 stp x5, x4, [x22] 157 mov x19, x0 158 stp x3, x1, [x22, 16] 159 mov x21, x2 160 cmp x23, 63 161 bls .L21 162 sub x20, x23, #64 163 and x20, x20, -64 164 add x20, x20, 64 165 add x20, x0, x20 166 .p2align 3,,7 167 .L12: 168 mov x1, x19 169 mov x0, x22 170 add x19, x19, 64 171 bl sha256_transform 172 cmp x19, x20 173 bne .L12 174 and x2, x23, 63 175 .L11: 176 mov x0, x21 177 add x4, x21, 128 178 .p2align 3,,7 179 .L13: 180 strb wzr, [x0], 1 181 cmp x0, x4 182 bne .L13 183 cbz x2, .L14 184 mov x0, 0 185 .p2align 3,,7 186 .L15: 187 ldrb w1, [x20, x0] 188 strb w1, [x21, x0] 189 add x0, x0, 1 190 cmp x0, x2 191 bne .L15 192 mov w1, -128 193 strb w1, [x21, x0] 194 mov w19, 2 195 mov w1, 120 196 cmp x0, 55 197 bls .L17 198 .L18: 199 lsl x23, x23, 3 200 add x1, x21, w1, uxtw 201 mov w0, 56 202 .p2align 3,,7 203 .L19: 204 lsr x2, x23, x0 205 sub w0, w0, #8 206 strb w2, [x1], 1 207 cmn w0, #8 208 bne .L19 209 mov x0, x22 210 mov x1, x21 211 bl sha256_transform 212 cmp w19, 2 213 beq .L29 214 ldp x19, x20, [sp, 16] 215 ldp x21, x22, [sp, 32] 216 ldr x23, [sp, 48] 217 ldp x29, x30, [sp], 64 218 ret 219 .L14: 220 mov w0, -128 221 strb w0, [x21] 222 .L17: 223 mov w1, 56 224 mov w19, 1 225 b .L18 226 .L29: 227 ldp x19, x20, [sp, 16] 228 add x1, x21, 64 229 ldp x21, x22, [sp, 32] 230 ldr x23, [sp, 48] 231 ldp x29, x30, [sp], 64 232 b sha256_transform 233 .L21: 234 mov x20, x0 235 mov x2, x23 236 b .L11 237 .size sha256_compute, .-sha256_compute 238 .align 2 239 .p2align 4,,11 240 .global sha256_256bytes 241 .type sha256_256bytes, %function 242 sha256_256bytes: 243 mov x3, x2 244 mov x2, x1 245 mov x1, 256 246 b sha256_compute 247 .size sha256_256bytes, .-sha256_256bytes 248 .section .rodata 249 .align 3 250 .set .LANCHOR0,. + 0 251 .type K, %object 252 .size K, 256 253 K: 254 .word `1116352408` 255 .word `1899447441` 256 .word -`1245643825` 257 .word -`373957723` 258 .word `961987163` 259 .word `1508970993` 260 .word -`1841331548` 261 .word -`1424204075` 262 .word -`670586216` 263 .word `310598401` 264 .word `607225278` 265 .word `1426881987` 266 .word `1925078388` 267 .word -`2132889090` 268 .word -`1680079193` 269 .word -`1046744716` 270 .word -`459576895` 271 .word -`272742522` 272 .word `264347078` 273 .word `604807628` 274 .word `770255983` 275 .word `1249150122` 276 .word `1555081692` 277 .word `1996064986` 278 .word -`1740746414` 279 .word -`1473132947` 280 .word -`1341970488` 281 .word -`1084653625` 282 .word -`958395405` 283 .word -`710438585` 284 .word `113926993` 285 .word `338241895` 286 .word `666307205` 287 .word `773529912` 288 .word `1294757372` 289 .word `1396182291` 290 .word `1695183700` 291 .word `1986661051` 292 .word -`2117940946` 293 .word -`1838011259` 294 .word -`1564481375` 295 .word -`1474664885` 296 .word -`1035236496` 297 .word -`949202525` 298 .word -`778901479` 299 .word -`694614492` 300 .word -`200395387` 301 .word `275423344` 302 .word `430227734` 303 .word `506948616` 304 .word `659060556` 305 .word `883997877` 306 .word `958139571` 307 .word `1322822218` 308 .word `1537002063` 309 .word `1747873779` 310 .word `1955562222` 311 .word `2024104815` 312 .word -`2067236844` 313 .word -`1933114872` 314 .word -`1866530822` 315 .word -`1538233109` 316 .word -`1090935817` 317 .word -`965641998` 318 .ident "GCC: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0" 319 .section .note.GNU-stack,"",@progbits