Commit 0e89640b authored by Mark Brown's avatar Mark Brown Committed by Herbert Xu
Browse files

crypto: arm64 - Use modern annotations for assembly functions



In an effort to clarify and simplify the annotation of assembly functions
in the kernel new macros have been introduced. These replace ENTRY and
ENDPROC and also add a new annotation for static functions which previously
had no ENTRY equivalent. Update the annotations in the crypto code to the
new macros.

There are a small number of files imported from OpenSSL where the assembly
is generated using perl programs, these are not currently annotated at all
and have not been modified.

Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3907ccfa
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
	 * void ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes,
	 *			     u32 *macp, u8 const rk[], u32 rounds);
	 */
ENTRY(ce_aes_ccm_auth_data)
SYM_FUNC_START(ce_aes_ccm_auth_data)
	ldr	w8, [x3]			/* leftover from prev round? */
	ld1	{v0.16b}, [x0]			/* load mac */
	cbz	w8, 1f
@@ -81,13 +81,13 @@ ENTRY(ce_aes_ccm_auth_data)
	st1	{v0.16b}, [x0]
10:	str	w8, [x3]
	ret
ENDPROC(ce_aes_ccm_auth_data)
SYM_FUNC_END(ce_aes_ccm_auth_data)

	/*
	 * void ce_aes_ccm_final(u8 mac[], u8 const ctr[], u8 const rk[],
	 * 			 u32 rounds);
	 */
ENTRY(ce_aes_ccm_final)
SYM_FUNC_START(ce_aes_ccm_final)
	ld1	{v3.4s}, [x2], #16		/* load first round key */
	ld1	{v0.16b}, [x0]			/* load mac */
	cmp	w3, #12				/* which key size? */
@@ -121,7 +121,7 @@ ENTRY(ce_aes_ccm_final)
	eor	v0.16b, v0.16b, v1.16b		/* en-/decrypt the mac */
	st1	{v0.16b}, [x0]			/* store result */
	ret
ENDPROC(ce_aes_ccm_final)
SYM_FUNC_END(ce_aes_ccm_final)

	.macro	aes_ccm_do_crypt,enc
	ldr	x8, [x6, #8]			/* load lower ctr */
@@ -212,10 +212,10 @@ CPU_LE( rev x8, x8 )
	 * 			   u8 const rk[], u32 rounds, u8 mac[],
	 * 			   u8 ctr[]);
	 */
ENTRY(ce_aes_ccm_encrypt)
SYM_FUNC_START(ce_aes_ccm_encrypt)
	aes_ccm_do_crypt	1
ENDPROC(ce_aes_ccm_encrypt)
SYM_FUNC_END(ce_aes_ccm_encrypt)

ENTRY(ce_aes_ccm_decrypt)
SYM_FUNC_START(ce_aes_ccm_decrypt)
	aes_ccm_do_crypt	0
ENDPROC(ce_aes_ccm_decrypt)
SYM_FUNC_END(ce_aes_ccm_decrypt)
+8 −8
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@

	.arch		armv8-a+crypto

ENTRY(__aes_ce_encrypt)
SYM_FUNC_START(__aes_ce_encrypt)
	sub		w3, w3, #2
	ld1		{v0.16b}, [x2]
	ld1		{v1.4s}, [x0], #16
@@ -34,9 +34,9 @@ ENTRY(__aes_ce_encrypt)
	eor		v0.16b, v0.16b, v3.16b
	st1		{v0.16b}, [x1]
	ret
ENDPROC(__aes_ce_encrypt)
SYM_FUNC_END(__aes_ce_encrypt)

ENTRY(__aes_ce_decrypt)
SYM_FUNC_START(__aes_ce_decrypt)
	sub		w3, w3, #2
	ld1		{v0.16b}, [x2]
	ld1		{v1.4s}, [x0], #16
@@ -62,23 +62,23 @@ ENTRY(__aes_ce_decrypt)
	eor		v0.16b, v0.16b, v3.16b
	st1		{v0.16b}, [x1]
	ret
ENDPROC(__aes_ce_decrypt)
SYM_FUNC_END(__aes_ce_decrypt)

/*
 * __aes_ce_sub() - use the aese instruction to perform the AES sbox
 *                  substitution on each byte in 'input'
 */
ENTRY(__aes_ce_sub)
SYM_FUNC_START(__aes_ce_sub)
	dup		v1.4s, w0
	movi		v0.16b, #0
	aese		v0.16b, v1.16b
	umov		w0, v0.s[0]
	ret
ENDPROC(__aes_ce_sub)
SYM_FUNC_END(__aes_ce_sub)

ENTRY(__aes_ce_invert)
SYM_FUNC_START(__aes_ce_invert)
	ld1		{v0.4s}, [x1]
	aesimc		v1.16b, v0.16b
	st1		{v1.4s}, [x0]
	ret
ENDPROC(__aes_ce_invert)
SYM_FUNC_END(__aes_ce_invert)
+2 −2
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
#include <linux/linkage.h>
#include <asm/assembler.h>

#define AES_ENTRY(func)		ENTRY(ce_ ## func)
#define AES_ENDPROC(func)	ENDPROC(ce_ ## func)
#define AES_ENTRY(func)		SYM_FUNC_START(ce_ ## func)
#define AES_ENDPROC(func)	SYM_FUNC_END(ce_ ## func)

	.arch		armv8-a+crypto

+4 −4
Original line number Diff line number Diff line
@@ -122,11 +122,11 @@ CPU_BE( rev w7, w7 )
	ret
	.endm

ENTRY(__aes_arm64_encrypt)
SYM_FUNC_START(__aes_arm64_encrypt)
	do_crypt	fround, crypto_ft_tab, crypto_ft_tab + 1, 2
ENDPROC(__aes_arm64_encrypt)
SYM_FUNC_END(__aes_arm64_encrypt)

	.align		5
ENTRY(__aes_arm64_decrypt)
SYM_FUNC_START(__aes_arm64_decrypt)
	do_crypt	iround, crypto_it_tab, crypto_aes_inv_sbox, 0
ENDPROC(__aes_arm64_decrypt)
SYM_FUNC_END(__aes_arm64_decrypt)
+8 −8
Original line number Diff line number Diff line
@@ -22,26 +22,26 @@
#define ST5(x...) x
#endif

aes_encrypt_block4x:
SYM_FUNC_START_LOCAL(aes_encrypt_block4x)
	encrypt_block4x	v0, v1, v2, v3, w3, x2, x8, w7
	ret
ENDPROC(aes_encrypt_block4x)
SYM_FUNC_END(aes_encrypt_block4x)

aes_decrypt_block4x:
SYM_FUNC_START_LOCAL(aes_decrypt_block4x)
	decrypt_block4x	v0, v1, v2, v3, w3, x2, x8, w7
	ret
ENDPROC(aes_decrypt_block4x)
SYM_FUNC_END(aes_decrypt_block4x)

#if MAX_STRIDE == 5
aes_encrypt_block5x:
SYM_FUNC_START_LOCAL(aes_encrypt_block5x)
	encrypt_block5x	v0, v1, v2, v3, v4, w3, x2, x8, w7
	ret
ENDPROC(aes_encrypt_block5x)
SYM_FUNC_END(aes_encrypt_block5x)

aes_decrypt_block5x:
SYM_FUNC_START_LOCAL(aes_decrypt_block5x)
	decrypt_block5x	v0, v1, v2, v3, v4, w3, x2, x8, w7
	ret
ENDPROC(aes_decrypt_block5x)
SYM_FUNC_END(aes_decrypt_block5x)
#endif

	/*
Loading