aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Siewior <sebastian@breakpoint.cc>2007-10-17 11:18:57 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-01-10 16:16:04 -0500
commit89e12654312dddbbdbf17b5adc95b22cb672f947 (patch)
treeb6c90424ece4dae2178c3b3843e37ebf41c8286b
parentf1901f1fc710ec0fc482a7c98ee4552874139f39 (diff)
[CRYPTO] aes: Move common defines into a header file
This three defines are used in all AES related hardware. Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--arch/s390/crypto/aes_s390.c7
-rw-r--r--arch/x86/crypto/aes_32.c4
-rw-r--r--arch/x86/crypto/aes_64.c6
-rw-r--r--crypto/aes_generic.c6
-rw-r--r--drivers/crypto/geode-aes.c1
-rw-r--r--drivers/crypto/padlock-aes.c4
-rw-r--r--include/crypto/aes.h15
7 files changed, 21 insertions, 22 deletions
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 512669691ad0..812511bbb540 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -16,17 +16,12 @@
16 * 16 *
17 */ 17 */
18 18
19#include <crypto/aes.h>
19#include <crypto/algapi.h> 20#include <crypto/algapi.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include "crypt_s390.h" 23#include "crypt_s390.h"
23 24
24#define AES_MIN_KEY_SIZE 16
25#define AES_MAX_KEY_SIZE 32
26
27/* data block size for all key lengths */
28#define AES_BLOCK_SIZE 16
29
30#define AES_KEYLEN_128 1 25#define AES_KEYLEN_128 1
31#define AES_KEYLEN_192 2 26#define AES_KEYLEN_192 2
32#define AES_KEYLEN_256 4 27#define AES_KEYLEN_256 4
diff --git a/arch/x86/crypto/aes_32.c b/arch/x86/crypto/aes_32.c
index 49aad9397f10..9b0ab50394b0 100644
--- a/arch/x86/crypto/aes_32.c
+++ b/arch/x86/crypto/aes_32.c
@@ -38,6 +38,7 @@
38 */ 38 */
39 39
40#include <asm/byteorder.h> 40#include <asm/byteorder.h>
41#include <crypto/aes.h>
41#include <linux/kernel.h> 42#include <linux/kernel.h>
42#include <linux/module.h> 43#include <linux/module.h>
43#include <linux/init.h> 44#include <linux/init.h>
@@ -48,9 +49,6 @@
48asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 49asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
49asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 50asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
50 51
51#define AES_MIN_KEY_SIZE 16
52#define AES_MAX_KEY_SIZE 32
53#define AES_BLOCK_SIZE 16
54#define AES_KS_LENGTH 4 * AES_BLOCK_SIZE 52#define AES_KS_LENGTH 4 * AES_BLOCK_SIZE
55#define RC_LENGTH 29 53#define RC_LENGTH 29
56 54
diff --git a/arch/x86/crypto/aes_64.c b/arch/x86/crypto/aes_64.c
index 5cdb13ea5cc2..0b38a4cd2ce1 100644
--- a/arch/x86/crypto/aes_64.c
+++ b/arch/x86/crypto/aes_64.c
@@ -54,6 +54,7 @@
54*/ 54*/
55 55
56#include <asm/byteorder.h> 56#include <asm/byteorder.h>
57#include <crypto/aes.h>
57#include <linux/bitops.h> 58#include <linux/bitops.h>
58#include <linux/crypto.h> 59#include <linux/crypto.h>
59#include <linux/errno.h> 60#include <linux/errno.h>
@@ -61,11 +62,6 @@
61#include <linux/module.h> 62#include <linux/module.h>
62#include <linux/types.h> 63#include <linux/types.h>
63 64
64#define AES_MIN_KEY_SIZE 16
65#define AES_MAX_KEY_SIZE 32
66
67#define AES_BLOCK_SIZE 16
68
69/* 65/*
70 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) 66 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
71 */ 67 */
diff --git a/crypto/aes_generic.c b/crypto/aes_generic.c
index 9401dca85e87..6683260475f9 100644
--- a/crypto/aes_generic.c
+++ b/crypto/aes_generic.c
@@ -52,6 +52,7 @@
52 s/RIJNDAEL(d_key)/D_KEY/g 52 s/RIJNDAEL(d_key)/D_KEY/g
53*/ 53*/
54 54
55#include <crypto/aes.h>
55#include <linux/module.h> 56#include <linux/module.h>
56#include <linux/init.h> 57#include <linux/init.h>
57#include <linux/types.h> 58#include <linux/types.h>
@@ -59,11 +60,6 @@
59#include <linux/crypto.h> 60#include <linux/crypto.h>
60#include <asm/byteorder.h> 61#include <asm/byteorder.h>
61 62
62#define AES_MIN_KEY_SIZE 16
63#define AES_MAX_KEY_SIZE 32
64
65#define AES_BLOCK_SIZE 16
66
67/* 63/*
68 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) 64 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
69 */ 65 */
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index fa4c9904346f..5008a1cddffb 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -13,6 +13,7 @@
13#include <linux/crypto.h> 13#include <linux/crypto.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <crypto/algapi.h> 15#include <crypto/algapi.h>
16#include <crypto/aes.h>
16 17
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/delay.h> 19#include <asm/delay.h>
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 5f7e71810489..c33334ac987e 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -44,6 +44,7 @@
44 */ 44 */
45 45
46#include <crypto/algapi.h> 46#include <crypto/algapi.h>
47#include <crypto/aes.h>
47#include <linux/module.h> 48#include <linux/module.h>
48#include <linux/init.h> 49#include <linux/init.h>
49#include <linux/types.h> 50#include <linux/types.h>
@@ -53,9 +54,6 @@
53#include <asm/byteorder.h> 54#include <asm/byteorder.h>
54#include "padlock.h" 55#include "padlock.h"
55 56
56#define AES_MIN_KEY_SIZE 16 /* in uint8_t units */
57#define AES_MAX_KEY_SIZE 32 /* ditto */
58#define AES_BLOCK_SIZE 16 /* ditto */
59#define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */ 57#define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */
60#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) 58#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
61 59
diff --git a/include/crypto/aes.h b/include/crypto/aes.h
new file mode 100644
index 000000000000..9ff842fc6b89
--- /dev/null
+++ b/include/crypto/aes.h
@@ -0,0 +1,15 @@
1/*
2 * Common values for AES algorithms
3 */
4
5#ifndef _CRYPTO_AES_H
6#define _CRYPTO_AES_H
7
8#define AES_MIN_KEY_SIZE 16
9#define AES_MAX_KEY_SIZE 32
10#define AES_KEYSIZE_128 16
11#define AES_KEYSIZE_192 24
12#define AES_KEYSIZE_256 32
13#define AES_BLOCK_SIZE 16
14
15#endif