aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/crypto/aes_asm.S
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-08-31 15:11:51 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-31 15:11:51 -0400
commit7cff82f5f42a938a1b633e121a41d29c81de18bb (patch)
tree80b07a1886e7f4b8caf547e9963245ca4ce75f1b /arch/sparc/crypto/aes_asm.S
parent4e71bb49f256e4efc94a9fdaaa430d906cd88e6b (diff)
sparc64: Avoid code duplication in crypto assembler.
Put the opcode macros in a common header Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/crypto/aes_asm.S')
-rw-r--r--arch/sparc/crypto/aes_asm.S56
1 files changed, 1 insertions, 55 deletions
diff --git a/arch/sparc/crypto/aes_asm.S b/arch/sparc/crypto/aes_asm.S
index 0fadad0c60ad..20860885f068 100644
--- a/arch/sparc/crypto/aes_asm.S
+++ b/arch/sparc/crypto/aes_asm.S
@@ -1,61 +1,7 @@
1#include <linux/linkage.h> 1#include <linux/linkage.h>
2#include <asm/visasm.h> 2#include <asm/visasm.h>
3 3
4#define F3F(x,y,z) (((x)<<30)|((y)<<19)|((z)<<5)) 4#include "opcodes.h"
5
6#define FPD_ENCODE(x) (((x) >> 5) | ((x) & ~(0x20)))
7
8#define RS1(x) (FPD_ENCODE(x) << 14)
9#define RS2(x) (FPD_ENCODE(x) << 0)
10#define RS3(x) (FPD_ENCODE(x) << 9)
11#define RD(x) (FPD_ENCODE(x) << 25)
12#define IMM5(x) ((x) << 9)
13
14#define AES_EROUND01(a,b,c,d) \
15 .word (F3F(2, 0x19, 0)|RS1(a)|RS2(b)|RS3(c)|RD(d));
16#define AES_EROUND23(a,b,c,d) \
17 .word (F3F(2, 0x19, 1)|RS1(a)|RS2(b)|RS3(c)|RD(d));
18#define AES_DROUND01(a,b,c,d) \
19 .word (F3F(2, 0x19, 2)|RS1(a)|RS2(b)|RS3(c)|RD(d));
20#define AES_DROUND23(a,b,c,d) \
21 .word (F3F(2, 0x19, 3)|RS1(a)|RS2(b)|RS3(c)|RD(d));
22#define AES_EROUND01_L(a,b,c,d) \
23 .word (F3F(2, 0x19, 4)|RS1(a)|RS2(b)|RS3(c)|RD(d));
24#define AES_EROUND23_L(a,b,c,d) \
25 .word (F3F(2, 0x19, 5)|RS1(a)|RS2(b)|RS3(c)|RD(d));
26#define AES_DROUND01_L(a,b,c,d) \
27 .word (F3F(2, 0x19, 6)|RS1(a)|RS2(b)|RS3(c)|RD(d));
28#define AES_DROUND23_L(a,b,c,d) \
29 .word (F3F(2, 0x19, 7)|RS1(a)|RS2(b)|RS3(c)|RD(d));
30#define AES_KEXPAND1(a,b,c,d) \
31 .word (F3F(2, 0x19, 8)|RS1(a)|RS2(b)|IMM5(c)|RD(d));
32#define AES_KEXPAND0(a,b,c) \
33 .word (F3F(2, 0x36, 0x130)|RS1(a)|RS2(b)|RD(c));
34#define AES_KEXPAND2(a,b,c) \
35 .word (F3F(2, 0x36, 0x131)|RS1(a)|RS2(b)|RD(c));
36
37#define MOVXTOD_G3_F4 \
38 .word 0x89b02303;
39#define MOVXTOD_G7_F6 \
40 .word 0x8db02307;
41#define MOVXTOD_G3_F0 \
42 .word 0x81b02303;
43#define MOVXTOD_G7_F2 \
44 .word 0x85b02307;
45#define MOVXTOD_O0_F0 \
46 .word 0x81b02308;
47#define MOVXTOD_O5_F0 \
48 .word 0x81b0230d;
49#define MOVXTOD_O5_F2 \
50 .word 0x85b0230d;
51#define MOVXTOD_O5_F4 \
52 .word 0x89b0230d;
53#define MOVXTOD_O5_F6 \
54 .word 0x8db0230d;
55#define MOVXTOD_G3_F60 \
56 .word 0xbbb02303;
57#define MOVXTOD_G7_F62 \
58 .word 0xbfb02307;
59 5
60#define ENCRYPT_TWO_ROUNDS(KEY_BASE, I0, I1, T0, T1) \ 6#define ENCRYPT_TWO_ROUNDS(KEY_BASE, I0, I1, T0, T1) \
61 AES_EROUND01(KEY_BASE + 0, I0, I1, T0) \ 7 AES_EROUND01(KEY_BASE + 0, I0, I1, T0) \