diff options
author | Mathias Krause <minipli@googlemail.com> | 2010-11-28 19:35:39 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-11-28 19:35:39 -0500 |
commit | 559ad0ff1368baea14dbc3207d55b02bd69bda4b (patch) | |
tree | c1f329dd3b3084e0df26cc6436586265f79bf838 /arch/x86 | |
parent | c762be637503b833012457087133c1292fd6056d (diff) |
crypto: aesni-intel - Fixed build error on x86-32
Exclude AES-GCM code for x86-32 due to heavy usage of 64-bit registers
not available on x86-32.
While at it, fixed unregister order in aesni_exit().
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/crypto/aesni-intel_asm.S | 5 | ||||
-rw-r--r-- | arch/x86/crypto/aesni-intel_glue.c | 26 |
2 files changed, 17 insertions, 14 deletions
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index f592e03dc375..d528fde219d2 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/linkage.h> | 32 | #include <linux/linkage.h> |
33 | #include <asm/inst.h> | 33 | #include <asm/inst.h> |
34 | 34 | ||
35 | #ifdef __x86_64__ | ||
35 | .data | 36 | .data |
36 | POLY: .octa 0xC2000000000000000000000000000001 | 37 | POLY: .octa 0xC2000000000000000000000000000001 |
37 | TWOONE: .octa 0x00000001000000000000000000000001 | 38 | TWOONE: .octa 0x00000001000000000000000000000001 |
@@ -84,6 +85,7 @@ enc: .octa 0x2 | |||
84 | #define arg8 STACK_OFFSET+16(%r14) | 85 | #define arg8 STACK_OFFSET+16(%r14) |
85 | #define arg9 STACK_OFFSET+24(%r14) | 86 | #define arg9 STACK_OFFSET+24(%r14) |
86 | #define arg10 STACK_OFFSET+32(%r14) | 87 | #define arg10 STACK_OFFSET+32(%r14) |
88 | #endif | ||
87 | 89 | ||
88 | 90 | ||
89 | #define STATE1 %xmm0 | 91 | #define STATE1 %xmm0 |
@@ -130,6 +132,7 @@ enc: .octa 0x2 | |||
130 | #endif | 132 | #endif |
131 | 133 | ||
132 | 134 | ||
135 | #ifdef __x86_64__ | ||
133 | /* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0) | 136 | /* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0) |
134 | * | 137 | * |
135 | * | 138 | * |
@@ -1255,7 +1258,7 @@ _return_T_done_encrypt: | |||
1255 | pop %r13 | 1258 | pop %r13 |
1256 | pop %r12 | 1259 | pop %r12 |
1257 | ret | 1260 | ret |
1258 | 1261 | #endif | |
1259 | 1262 | ||
1260 | 1263 | ||
1261 | _key_expansion_128: | 1264 | _key_expansion_128: |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 8a3b80075216..e1e60c7d5813 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -97,7 +97,6 @@ asmlinkage void aesni_cbc_dec(struct crypto_aes_ctx *ctx, u8 *out, | |||
97 | #ifdef CONFIG_X86_64 | 97 | #ifdef CONFIG_X86_64 |
98 | asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out, | 98 | asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out, |
99 | const u8 *in, unsigned int len, u8 *iv); | 99 | const u8 *in, unsigned int len, u8 *iv); |
100 | #endif | ||
101 | 100 | ||
102 | /* asmlinkage void aesni_gcm_enc() | 101 | /* asmlinkage void aesni_gcm_enc() |
103 | * void *ctx, AES Key schedule. Starts on a 16 byte boundary. | 102 | * void *ctx, AES Key schedule. Starts on a 16 byte boundary. |
@@ -149,6 +148,7 @@ aesni_rfc4106_gcm_ctx *aesni_rfc4106_gcm_ctx_get(struct crypto_aead *tfm) | |||
149 | PTR_ALIGN((u8 *) | 148 | PTR_ALIGN((u8 *) |
150 | crypto_tfm_ctx(crypto_aead_tfm(tfm)), AESNI_ALIGN); | 149 | crypto_tfm_ctx(crypto_aead_tfm(tfm)), AESNI_ALIGN); |
151 | } | 150 | } |
151 | #endif | ||
152 | 152 | ||
153 | static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx) | 153 | static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx) |
154 | { | 154 | { |
@@ -822,6 +822,7 @@ static struct crypto_alg ablk_xts_alg = { | |||
822 | }; | 822 | }; |
823 | #endif | 823 | #endif |
824 | 824 | ||
825 | #ifdef CONFIG_X86_64 | ||
825 | static int rfc4106_init(struct crypto_tfm *tfm) | 826 | static int rfc4106_init(struct crypto_tfm *tfm) |
826 | { | 827 | { |
827 | struct cryptd_aead *cryptd_tfm; | 828 | struct cryptd_aead *cryptd_tfm; |
@@ -1237,6 +1238,7 @@ static struct crypto_alg __rfc4106_alg = { | |||
1237 | }, | 1238 | }, |
1238 | }, | 1239 | }, |
1239 | }; | 1240 | }; |
1241 | #endif | ||
1240 | 1242 | ||
1241 | static int __init aesni_init(void) | 1243 | static int __init aesni_init(void) |
1242 | { | 1244 | { |
@@ -1264,6 +1266,10 @@ static int __init aesni_init(void) | |||
1264 | goto blk_ctr_err; | 1266 | goto blk_ctr_err; |
1265 | if ((err = crypto_register_alg(&ablk_ctr_alg))) | 1267 | if ((err = crypto_register_alg(&ablk_ctr_alg))) |
1266 | goto ablk_ctr_err; | 1268 | goto ablk_ctr_err; |
1269 | if ((err = crypto_register_alg(&__rfc4106_alg))) | ||
1270 | goto __aead_gcm_err; | ||
1271 | if ((err = crypto_register_alg(&rfc4106_alg))) | ||
1272 | goto aead_gcm_err; | ||
1267 | #ifdef HAS_CTR | 1273 | #ifdef HAS_CTR |
1268 | if ((err = crypto_register_alg(&ablk_rfc3686_ctr_alg))) | 1274 | if ((err = crypto_register_alg(&ablk_rfc3686_ctr_alg))) |
1269 | goto ablk_rfc3686_ctr_err; | 1275 | goto ablk_rfc3686_ctr_err; |
@@ -1281,19 +1287,9 @@ static int __init aesni_init(void) | |||
1281 | if ((err = crypto_register_alg(&ablk_xts_alg))) | 1287 | if ((err = crypto_register_alg(&ablk_xts_alg))) |
1282 | goto ablk_xts_err; | 1288 | goto ablk_xts_err; |
1283 | #endif | 1289 | #endif |
1284 | err = crypto_register_alg(&__rfc4106_alg); | ||
1285 | if (err) | ||
1286 | goto __aead_gcm_err; | ||
1287 | err = crypto_register_alg(&rfc4106_alg); | ||
1288 | if (err) | ||
1289 | goto aead_gcm_err; | ||
1290 | return err; | 1290 | return err; |
1291 | 1291 | ||
1292 | aead_gcm_err: | ||
1293 | crypto_unregister_alg(&__rfc4106_alg); | ||
1294 | __aead_gcm_err: | ||
1295 | #ifdef HAS_XTS | 1292 | #ifdef HAS_XTS |
1296 | crypto_unregister_alg(&ablk_xts_alg); | ||
1297 | ablk_xts_err: | 1293 | ablk_xts_err: |
1298 | #endif | 1294 | #endif |
1299 | #ifdef HAS_PCBC | 1295 | #ifdef HAS_PCBC |
@@ -1309,6 +1305,10 @@ ablk_lrw_err: | |||
1309 | crypto_unregister_alg(&ablk_rfc3686_ctr_alg); | 1305 | crypto_unregister_alg(&ablk_rfc3686_ctr_alg); |
1310 | ablk_rfc3686_ctr_err: | 1306 | ablk_rfc3686_ctr_err: |
1311 | #endif | 1307 | #endif |
1308 | crypto_unregister_alg(&rfc4106_alg); | ||
1309 | aead_gcm_err: | ||
1310 | crypto_unregister_alg(&__rfc4106_alg); | ||
1311 | __aead_gcm_err: | ||
1312 | crypto_unregister_alg(&ablk_ctr_alg); | 1312 | crypto_unregister_alg(&ablk_ctr_alg); |
1313 | ablk_ctr_err: | 1313 | ablk_ctr_err: |
1314 | crypto_unregister_alg(&blk_ctr_alg); | 1314 | crypto_unregister_alg(&blk_ctr_alg); |
@@ -1331,8 +1331,6 @@ aes_err: | |||
1331 | 1331 | ||
1332 | static void __exit aesni_exit(void) | 1332 | static void __exit aesni_exit(void) |
1333 | { | 1333 | { |
1334 | crypto_unregister_alg(&__rfc4106_alg); | ||
1335 | crypto_unregister_alg(&rfc4106_alg); | ||
1336 | #ifdef HAS_XTS | 1334 | #ifdef HAS_XTS |
1337 | crypto_unregister_alg(&ablk_xts_alg); | 1335 | crypto_unregister_alg(&ablk_xts_alg); |
1338 | #endif | 1336 | #endif |
@@ -1346,6 +1344,8 @@ static void __exit aesni_exit(void) | |||
1346 | #ifdef HAS_CTR | 1344 | #ifdef HAS_CTR |
1347 | crypto_unregister_alg(&ablk_rfc3686_ctr_alg); | 1345 | crypto_unregister_alg(&ablk_rfc3686_ctr_alg); |
1348 | #endif | 1346 | #endif |
1347 | crypto_unregister_alg(&rfc4106_alg); | ||
1348 | crypto_unregister_alg(&__rfc4106_alg); | ||
1349 | crypto_unregister_alg(&ablk_ctr_alg); | 1349 | crypto_unregister_alg(&ablk_ctr_alg); |
1350 | crypto_unregister_alg(&blk_ctr_alg); | 1350 | crypto_unregister_alg(&blk_ctr_alg); |
1351 | #endif | 1351 | #endif |