OLD | NEW |
1 #if defined(__aarch64__) | 1 #if defined(__aarch64__) |
2 #include <openssl/arm_arch.h> | 2 #include "arm_arch.h" |
3 | 3 |
4 #if __ARM_MAX_ARCH__>=7 | 4 #if __ARM_MAX_ARCH__>=7 |
5 .text | 5 .text |
6 #if !defined(__clang__) | 6 #if !defined(__clang__) |
7 .arch armv8-a+crypto | 7 .arch armv8-a+crypto |
8 #endif | 8 #endif |
9 .align 5 | 9 .align 5 |
10 .Lrcon: | 10 .Lrcon: |
11 .long 0x01,0x01,0x01,0x01 | 11 .long 0x01,0x01,0x01,0x01 |
12 .long 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d // rotate-n-splat | 12 .long 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d // rotate-n-splat |
13 .long 0x1b,0x1b,0x1b,0x1b | 13 .long 0x1b,0x1b,0x1b,0x1b |
14 | 14 |
15 .globl aes_v8_set_encrypt_key | 15 .globl aes_v8_set_encrypt_key |
16 .hidden aes_v8_set_encrypt_key | |
17 .type aes_v8_set_encrypt_key,%function | 16 .type aes_v8_set_encrypt_key,%function |
18 .align 5 | 17 .align 5 |
19 aes_v8_set_encrypt_key: | 18 aes_v8_set_encrypt_key: |
20 .Lenc_key: | 19 .Lenc_key: |
21 stp x29,x30,[sp,#-16]! | 20 stp x29,x30,[sp,#-16]! |
22 add x29,sp,#0 | 21 add x29,sp,#0 |
23 mov x3,#-1 | 22 mov x3,#-1 |
24 cmp x0,#0 | 23 cmp x0,#0 |
25 b.eq .Lenc_key_abort | 24 b.eq .Lenc_key_abort |
26 cmp x2,#0 | 25 cmp x2,#0 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 str w12,[x2] | 173 str w12,[x2] |
175 mov x3,#0 | 174 mov x3,#0 |
176 | 175 |
177 .Lenc_key_abort: | 176 .Lenc_key_abort: |
178 mov x0,x3 // return value | 177 mov x0,x3 // return value |
179 ldr x29,[sp],#16 | 178 ldr x29,[sp],#16 |
180 ret | 179 ret |
181 .size aes_v8_set_encrypt_key,.-aes_v8_set_encrypt_key | 180 .size aes_v8_set_encrypt_key,.-aes_v8_set_encrypt_key |
182 | 181 |
183 .globl aes_v8_set_decrypt_key | 182 .globl aes_v8_set_decrypt_key |
184 .hidden aes_v8_set_decrypt_key | |
185 .type aes_v8_set_decrypt_key,%function | 183 .type aes_v8_set_decrypt_key,%function |
186 .align 5 | 184 .align 5 |
187 aes_v8_set_decrypt_key: | 185 aes_v8_set_decrypt_key: |
188 stp x29,x30,[sp,#-16]! | 186 stp x29,x30,[sp,#-16]! |
189 add x29,sp,#0 | 187 add x29,sp,#0 |
190 bl .Lenc_key | 188 bl .Lenc_key |
191 | 189 |
192 cmp x0,#0 | 190 cmp x0,#0 |
193 b.ne .Ldec_key_abort | 191 b.ne .Ldec_key_abort |
194 | 192 |
(...skipping 19 matching lines...) Expand all Loading... |
214 ld1 {v0.4s},[x2] | 212 ld1 {v0.4s},[x2] |
215 aesimc v0.16b,v0.16b | 213 aesimc v0.16b,v0.16b |
216 st1 {v0.4s},[x0] | 214 st1 {v0.4s},[x0] |
217 | 215 |
218 eor x0,x0,x0 // return value | 216 eor x0,x0,x0 // return value |
219 .Ldec_key_abort: | 217 .Ldec_key_abort: |
220 ldp x29,x30,[sp],#16 | 218 ldp x29,x30,[sp],#16 |
221 ret | 219 ret |
222 .size aes_v8_set_decrypt_key,.-aes_v8_set_decrypt_key | 220 .size aes_v8_set_decrypt_key,.-aes_v8_set_decrypt_key |
223 .globl aes_v8_encrypt | 221 .globl aes_v8_encrypt |
224 .hidden aes_v8_encrypt | |
225 .type aes_v8_encrypt,%function | 222 .type aes_v8_encrypt,%function |
226 .align 5 | 223 .align 5 |
227 aes_v8_encrypt: | 224 aes_v8_encrypt: |
228 ldr w3,[x2,#240] | 225 ldr w3,[x2,#240] |
229 ld1 {v0.4s},[x2],#16 | 226 ld1 {v0.4s},[x2],#16 |
230 ld1 {v2.16b},[x0] | 227 ld1 {v2.16b},[x0] |
231 sub w3,w3,#2 | 228 sub w3,w3,#2 |
232 ld1 {v1.4s},[x2],#16 | 229 ld1 {v1.4s},[x2],#16 |
233 | 230 |
234 .Loop_enc: | 231 .Loop_enc: |
235 aese v2.16b,v0.16b | 232 aese v2.16b,v0.16b |
236 aesmc v2.16b,v2.16b | 233 aesmc v2.16b,v2.16b |
237 ld1 {v0.4s},[x2],#16 | 234 ld1 {v0.4s},[x2],#16 |
238 subs w3,w3,#2 | 235 subs w3,w3,#2 |
239 aese v2.16b,v1.16b | 236 aese v2.16b,v1.16b |
240 aesmc v2.16b,v2.16b | 237 aesmc v2.16b,v2.16b |
241 ld1 {v1.4s},[x2],#16 | 238 ld1 {v1.4s},[x2],#16 |
242 b.gt .Loop_enc | 239 b.gt .Loop_enc |
243 | 240 |
244 aese v2.16b,v0.16b | 241 aese v2.16b,v0.16b |
245 aesmc v2.16b,v2.16b | 242 aesmc v2.16b,v2.16b |
246 ld1 {v0.4s},[x2] | 243 ld1 {v0.4s},[x2] |
247 aese v2.16b,v1.16b | 244 aese v2.16b,v1.16b |
248 eor v2.16b,v2.16b,v0.16b | 245 eor v2.16b,v2.16b,v0.16b |
249 | 246 |
250 st1 {v2.16b},[x1] | 247 st1 {v2.16b},[x1] |
251 ret | 248 ret |
252 .size aes_v8_encrypt,.-aes_v8_encrypt | 249 .size aes_v8_encrypt,.-aes_v8_encrypt |
253 .globl aes_v8_decrypt | 250 .globl aes_v8_decrypt |
254 .hidden aes_v8_decrypt | |
255 .type aes_v8_decrypt,%function | 251 .type aes_v8_decrypt,%function |
256 .align 5 | 252 .align 5 |
257 aes_v8_decrypt: | 253 aes_v8_decrypt: |
258 ldr w3,[x2,#240] | 254 ldr w3,[x2,#240] |
259 ld1 {v0.4s},[x2],#16 | 255 ld1 {v0.4s},[x2],#16 |
260 ld1 {v2.16b},[x0] | 256 ld1 {v2.16b},[x0] |
261 sub w3,w3,#2 | 257 sub w3,w3,#2 |
262 ld1 {v1.4s},[x2],#16 | 258 ld1 {v1.4s},[x2],#16 |
263 | 259 |
264 .Loop_dec: | 260 .Loop_dec: |
265 aesd v2.16b,v0.16b | 261 aesd v2.16b,v0.16b |
266 aesimc v2.16b,v2.16b | 262 aesimc v2.16b,v2.16b |
267 ld1 {v0.4s},[x2],#16 | 263 ld1 {v0.4s},[x2],#16 |
268 subs w3,w3,#2 | 264 subs w3,w3,#2 |
269 aesd v2.16b,v1.16b | 265 aesd v2.16b,v1.16b |
270 aesimc v2.16b,v2.16b | 266 aesimc v2.16b,v2.16b |
271 ld1 {v1.4s},[x2],#16 | 267 ld1 {v1.4s},[x2],#16 |
272 b.gt .Loop_dec | 268 b.gt .Loop_dec |
273 | 269 |
274 aesd v2.16b,v0.16b | 270 aesd v2.16b,v0.16b |
275 aesimc v2.16b,v2.16b | 271 aesimc v2.16b,v2.16b |
276 ld1 {v0.4s},[x2] | 272 ld1 {v0.4s},[x2] |
277 aesd v2.16b,v1.16b | 273 aesd v2.16b,v1.16b |
278 eor v2.16b,v2.16b,v0.16b | 274 eor v2.16b,v2.16b,v0.16b |
279 | 275 |
280 st1 {v2.16b},[x1] | 276 st1 {v2.16b},[x1] |
281 ret | 277 ret |
282 .size aes_v8_decrypt,.-aes_v8_decrypt | 278 .size aes_v8_decrypt,.-aes_v8_decrypt |
283 .globl aes_v8_cbc_encrypt | 279 .globl aes_v8_cbc_encrypt |
284 .hidden aes_v8_cbc_encrypt | |
285 .type aes_v8_cbc_encrypt,%function | 280 .type aes_v8_cbc_encrypt,%function |
286 .align 5 | 281 .align 5 |
287 aes_v8_cbc_encrypt: | 282 aes_v8_cbc_encrypt: |
288 stp x29,x30,[sp,#-16]! | 283 stp x29,x30,[sp,#-16]! |
289 add x29,sp,#0 | 284 add x29,sp,#0 |
290 subs x2,x2,#16 | 285 subs x2,x2,#16 |
291 mov x8,#16 | 286 mov x8,#16 |
292 b.lo .Lcbc_abort | 287 b.lo .Lcbc_abort |
293 csel x8,xzr,x8,eq | 288 csel x8,xzr,x8,eq |
294 | 289 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 orr v6.16b,v19.16b,v19.16b | 560 orr v6.16b,v19.16b,v19.16b |
566 st1 {v5.16b},[x1],#16 | 561 st1 {v5.16b},[x1],#16 |
567 | 562 |
568 .Lcbc_done: | 563 .Lcbc_done: |
569 st1 {v6.16b},[x4] | 564 st1 {v6.16b},[x4] |
570 .Lcbc_abort: | 565 .Lcbc_abort: |
571 ldr x29,[sp],#16 | 566 ldr x29,[sp],#16 |
572 ret | 567 ret |
573 .size aes_v8_cbc_encrypt,.-aes_v8_cbc_encrypt | 568 .size aes_v8_cbc_encrypt,.-aes_v8_cbc_encrypt |
574 .globl aes_v8_ctr32_encrypt_blocks | 569 .globl aes_v8_ctr32_encrypt_blocks |
575 .hidden aes_v8_ctr32_encrypt_blocks | |
576 .type aes_v8_ctr32_encrypt_blocks,%function | 570 .type aes_v8_ctr32_encrypt_blocks,%function |
577 .align 5 | 571 .align 5 |
578 aes_v8_ctr32_encrypt_blocks: | 572 aes_v8_ctr32_encrypt_blocks: |
579 stp x29,x30,[sp,#-16]! | 573 stp x29,x30,[sp,#-16]! |
580 add x29,sp,#0 | 574 add x29,sp,#0 |
581 ldr w5,[x3,#240] | 575 ldr w5,[x3,#240] |
582 | 576 |
583 ldr w8, [x4, #12] | 577 ldr w8, [x4, #12] |
584 ld1 {v0.4s},[x4] | 578 ld1 {v0.4s},[x4] |
585 | 579 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 eor v3.16b,v3.16b,v1.16b | 741 eor v3.16b,v3.16b,v1.16b |
748 st1 {v2.16b},[x1],#16 | 742 st1 {v2.16b},[x1],#16 |
749 b.eq .Lctr32_done | 743 b.eq .Lctr32_done |
750 st1 {v3.16b},[x1] | 744 st1 {v3.16b},[x1] |
751 | 745 |
752 .Lctr32_done: | 746 .Lctr32_done: |
753 ldr x29,[sp],#16 | 747 ldr x29,[sp],#16 |
754 ret | 748 ret |
755 .size aes_v8_ctr32_encrypt_blocks,.-aes_v8_ctr32_encrypt_blocks | 749 .size aes_v8_ctr32_encrypt_blocks,.-aes_v8_ctr32_encrypt_blocks |
756 #endif | 750 #endif |
757 #endif | 751 #endif |
OLD | NEW |