Merge tag 'for-linus-20190706' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / arch / arm64 / crypto / sm4-ce-core.S
blobaf3bfbc3f4d4d44ec2b5129d2073abd94075af27
1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/linkage.h>
4 #include <asm/assembler.h>
6         .irp            b, 0, 1, 2, 3, 4, 5, 6, 7, 8
7         .set            .Lv\b\().4s, \b
8         .endr
10         .macro          sm4e, rd, rn
11         .inst           0xcec08400 | .L\rd | (.L\rn << 5)
12         .endm
14         /*
15          * void sm4_ce_do_crypt(const u32 *rk, u32 *out, const u32 *in);
16          */
17         .text
18 ENTRY(sm4_ce_do_crypt)
19         ld1             {v8.4s}, [x2]
20         ld1             {v0.4s-v3.4s}, [x0], #64
21 CPU_LE( rev32           v8.16b, v8.16b          )
22         ld1             {v4.4s-v7.4s}, [x0]
23         sm4e            v8.4s, v0.4s
24         sm4e            v8.4s, v1.4s
25         sm4e            v8.4s, v2.4s
26         sm4e            v8.4s, v3.4s
27         sm4e            v8.4s, v4.4s
28         sm4e            v8.4s, v5.4s
29         sm4e            v8.4s, v6.4s
30         sm4e            v8.4s, v7.4s
31         rev64           v8.4s, v8.4s
32         ext             v8.16b, v8.16b, v8.16b, #8
33 CPU_LE( rev32           v8.16b, v8.16b          )
34         st1             {v8.4s}, [x1]
35         ret
36 ENDPROC(sm4_ce_do_crypt)