diff options
Diffstat (limited to 'arch/x86_64/crypto/aes-x86_64-asm.S')
-rw-r--r-- | arch/x86_64/crypto/aes-x86_64-asm.S | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/arch/x86_64/crypto/aes-x86_64-asm.S b/arch/x86_64/crypto/aes-x86_64-asm.S index 483cbb23ab8d..26b40de4d0b0 100644 --- a/arch/x86_64/crypto/aes-x86_64-asm.S +++ b/arch/x86_64/crypto/aes-x86_64-asm.S | |||
@@ -15,6 +15,10 @@ | |||
15 | 15 | ||
16 | .text | 16 | .text |
17 | 17 | ||
18 | #include <asm/asm-offsets.h> | ||
19 | |||
20 | #define BASE crypto_tfm_ctx_offset | ||
21 | |||
18 | #define R1 %rax | 22 | #define R1 %rax |
19 | #define R1E %eax | 23 | #define R1E %eax |
20 | #define R1X %ax | 24 | #define R1X %ax |
@@ -46,19 +50,19 @@ | |||
46 | #define R10 %r10 | 50 | #define R10 %r10 |
47 | #define R11 %r11 | 51 | #define R11 %r11 |
48 | 52 | ||
49 | #define prologue(FUNC,BASE,B128,B192,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11) \ | 53 | #define prologue(FUNC,KEY,B128,B192,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11) \ |
50 | .global FUNC; \ | 54 | .global FUNC; \ |
51 | .type FUNC,@function; \ | 55 | .type FUNC,@function; \ |
52 | .align 8; \ | 56 | .align 8; \ |
53 | FUNC: movq r1,r2; \ | 57 | FUNC: movq r1,r2; \ |
54 | movq r3,r4; \ | 58 | movq r3,r4; \ |
55 | leaq BASE+52(r8),r9; \ | 59 | leaq BASE+KEY+52(r8),r9; \ |
56 | movq r10,r11; \ | 60 | movq r10,r11; \ |
57 | movl (r7),r5 ## E; \ | 61 | movl (r7),r5 ## E; \ |
58 | movl 4(r7),r1 ## E; \ | 62 | movl 4(r7),r1 ## E; \ |
59 | movl 8(r7),r6 ## E; \ | 63 | movl 8(r7),r6 ## E; \ |
60 | movl 12(r7),r7 ## E; \ | 64 | movl 12(r7),r7 ## E; \ |
61 | movl (r8),r10 ## E; \ | 65 | movl BASE(r8),r10 ## E; \ |
62 | xorl -48(r9),r5 ## E; \ | 66 | xorl -48(r9),r5 ## E; \ |
63 | xorl -44(r9),r1 ## E; \ | 67 | xorl -44(r9),r1 ## E; \ |
64 | xorl -40(r9),r6 ## E; \ | 68 | xorl -40(r9),r6 ## E; \ |
@@ -128,8 +132,8 @@ FUNC: movq r1,r2; \ | |||
128 | movl r3 ## E,r1 ## E; \ | 132 | movl r3 ## E,r1 ## E; \ |
129 | movl r4 ## E,r2 ## E; | 133 | movl r4 ## E,r2 ## E; |
130 | 134 | ||
131 | #define entry(FUNC,BASE,B128,B192) \ | 135 | #define entry(FUNC,KEY,B128,B192) \ |
132 | prologue(FUNC,BASE,B128,B192,R2,R8,R7,R9,R1,R3,R4,R6,R10,R5,R11) | 136 | prologue(FUNC,KEY,B128,B192,R2,R8,R7,R9,R1,R3,R4,R6,R10,R5,R11) |
133 | 137 | ||
134 | #define return epilogue(R8,R2,R9,R7,R5,R6,R3,R4,R11) | 138 | #define return epilogue(R8,R2,R9,R7,R5,R6,R3,R4,R11) |
135 | 139 | ||
@@ -147,9 +151,9 @@ FUNC: movq r1,r2; \ | |||
147 | #define decrypt_final(TAB,OFFSET) \ | 151 | #define decrypt_final(TAB,OFFSET) \ |
148 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) | 152 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) |
149 | 153 | ||
150 | /* void aes_encrypt(void *ctx, u8 *out, const u8 *in) */ | 154 | /* void aes_enc_blk(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */ |
151 | 155 | ||
152 | entry(aes_encrypt,0,enc128,enc192) | 156 | entry(aes_enc_blk,0,enc128,enc192) |
153 | encrypt_round(aes_ft_tab,-96) | 157 | encrypt_round(aes_ft_tab,-96) |
154 | encrypt_round(aes_ft_tab,-80) | 158 | encrypt_round(aes_ft_tab,-80) |
155 | enc192: encrypt_round(aes_ft_tab,-64) | 159 | enc192: encrypt_round(aes_ft_tab,-64) |
@@ -166,9 +170,9 @@ enc128: encrypt_round(aes_ft_tab,-32) | |||
166 | encrypt_final(aes_fl_tab,112) | 170 | encrypt_final(aes_fl_tab,112) |
167 | return | 171 | return |
168 | 172 | ||
169 | /* void aes_decrypt(void *ctx, u8 *out, const u8 *in) */ | 173 | /* void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in) */ |
170 | 174 | ||
171 | entry(aes_decrypt,240,dec128,dec192) | 175 | entry(aes_dec_blk,240,dec128,dec192) |
172 | decrypt_round(aes_it_tab,-96) | 176 | decrypt_round(aes_it_tab,-96) |
173 | decrypt_round(aes_it_tab,-80) | 177 | decrypt_round(aes_it_tab,-80) |
174 | dec192: decrypt_round(aes_it_tab,-64) | 178 | dec192: decrypt_round(aes_it_tab,-64) |