arch/sparc/crypto/camellia_asm.S

Source file repositories/reference/linux-study-clean/arch/sparc/crypto/camellia_asm.S

File Facts

System
Linux kernel
Corpus path
arch/sparc/crypto/camellia_asm.S
Extension
.S
Size
13853 bytes
Lines
564
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: arch/sparc
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/linkage.h>
#include <asm/opcodes.h>
#include <asm/visasm.h>

#define CAMELLIA_6ROUNDS(KEY_BASE, I0, I1) \
	CAMELLIA_F(KEY_BASE +  0, I1, I0, I1) \
	CAMELLIA_F(KEY_BASE +  2, I0, I1, I0) \
	CAMELLIA_F(KEY_BASE +  4, I1, I0, I1) \
	CAMELLIA_F(KEY_BASE +  6, I0, I1, I0) \
	CAMELLIA_F(KEY_BASE +  8, I1, I0, I1) \
	CAMELLIA_F(KEY_BASE + 10, I0, I1, I0)

#define CAMELLIA_6ROUNDS_FL_FLI(KEY_BASE, I0, I1) \
	CAMELLIA_6ROUNDS(KEY_BASE, I0, I1) \
	CAMELLIA_FL(KEY_BASE + 12, I0, I0) \
	CAMELLIA_FLI(KEY_BASE + 14, I1, I1)

	.data

	.align	8
SIGMA:	.xword	0xA09E667F3BCC908B
	.xword	0xB67AE8584CAA73B2
	.xword	0xC6EF372FE94F82BE
	.xword	0x54FF53A5F1D36F1C
	.xword	0x10E527FADE682D1D
	.xword	0xB05688C2B3E6C1FD

	.text

	.align	32
ENTRY(camellia_sparc64_key_expand)
	/* %o0=in_key, %o1=encrypt_key, %o2=key_len, %o3=decrypt_key */
	VISEntry
	ld	[%o0 + 0x00], %f0	! i0, k[0]
	ld	[%o0 + 0x04], %f1	! i1, k[1]
	ld	[%o0 + 0x08], %f2	! i2, k[2]
	ld	[%o0 + 0x0c], %f3	! i3, k[3]
	std	%f0, [%o1 + 0x00]	! k[0, 1]
	fsrc2	%f0, %f28
	std	%f2, [%o1 + 0x08]	! k[2, 3]
	cmp	%o2, 16
	be	10f
	 fsrc2	%f2, %f30

	ld	[%o0 + 0x10], %f0
	ld	[%o0 + 0x14], %f1
	std	%f0, [%o1 + 0x20]	! k[8, 9]
	cmp	%o2, 24
	fone	%f10
	be,a	1f
	 fxor	%f10, %f0, %f2
	ld	[%o0 + 0x18], %f2
	ld	[%o0 + 0x1c], %f3
1:
	std	%f2, [%o1 + 0x28]	! k[10, 11]
	fxor	%f28, %f0, %f0
	fxor	%f30, %f2, %f2

10:
	sethi	%hi(SIGMA), %g3
	or	%g3, %lo(SIGMA), %g3
	ldd	[%g3 + 0x00], %f16
	ldd	[%g3 + 0x08], %f18
	ldd	[%g3 + 0x10], %f20
	ldd	[%g3 + 0x18], %f22
	ldd	[%g3 + 0x20], %f24
	ldd	[%g3 + 0x28], %f26
	CAMELLIA_F(16, 2, 0, 2)
	CAMELLIA_F(18, 0, 2, 0)
	fxor	%f28, %f0, %f0

Annotation

Implementation Notes