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