xref: /openbmc/linux/arch/arm64/crypto/sm4-ce-cipher-core.S (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*02436762STianjia Zhang// SPDX-License-Identifier: GPL-2.0
2*02436762STianjia Zhang
3*02436762STianjia Zhang#include <linux/linkage.h>
4*02436762STianjia Zhang#include <asm/assembler.h>
5*02436762STianjia Zhang
6*02436762STianjia Zhang	.irp		b, 0, 1, 2, 3, 4, 5, 6, 7, 8
7*02436762STianjia Zhang	.set		.Lv\b\().4s, \b
8*02436762STianjia Zhang	.endr
9*02436762STianjia Zhang
10*02436762STianjia Zhang	.macro		sm4e, rd, rn
11*02436762STianjia Zhang	.inst		0xcec08400 | .L\rd | (.L\rn << 5)
12*02436762STianjia Zhang	.endm
13*02436762STianjia Zhang
14*02436762STianjia Zhang	/*
15*02436762STianjia Zhang	 * void sm4_ce_do_crypt(const u32 *rk, u32 *out, const u32 *in);
16*02436762STianjia Zhang	 */
17*02436762STianjia Zhang	.text
18*02436762STianjia ZhangSYM_FUNC_START(sm4_ce_do_crypt)
19*02436762STianjia Zhang	ld1		{v8.4s}, [x2]
20*02436762STianjia Zhang	ld1		{v0.4s-v3.4s}, [x0], #64
21*02436762STianjia ZhangCPU_LE(	rev32		v8.16b, v8.16b		)
22*02436762STianjia Zhang	ld1		{v4.4s-v7.4s}, [x0]
23*02436762STianjia Zhang	sm4e		v8.4s, v0.4s
24*02436762STianjia Zhang	sm4e		v8.4s, v1.4s
25*02436762STianjia Zhang	sm4e		v8.4s, v2.4s
26*02436762STianjia Zhang	sm4e		v8.4s, v3.4s
27*02436762STianjia Zhang	sm4e		v8.4s, v4.4s
28*02436762STianjia Zhang	sm4e		v8.4s, v5.4s
29*02436762STianjia Zhang	sm4e		v8.4s, v6.4s
30*02436762STianjia Zhang	sm4e		v8.4s, v7.4s
31*02436762STianjia Zhang	rev64		v8.4s, v8.4s
32*02436762STianjia Zhang	ext		v8.16b, v8.16b, v8.16b, #8
33*02436762STianjia ZhangCPU_LE(	rev32		v8.16b, v8.16b		)
34*02436762STianjia Zhang	st1		{v8.4s}, [x1]
35*02436762STianjia Zhang	ret
36*02436762STianjia ZhangSYM_FUNC_END(sm4_ce_do_crypt)
37