Skip to content

Commit

Permalink
[CRYPTO] aes: Move common defines into a header file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sebastianas authored and herbertx committed Jan 10, 2008
1 parent f1901f1 commit 89e1265
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
7 changes: 1 addition & 6 deletions arch/s390/crypto/aes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
*
*/

#include <crypto/aes.h>
#include <crypto/algapi.h>
#include <linux/module.h>
#include <linux/init.h>
#include "crypt_s390.h"

#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32

/* data block size for all key lengths */
#define AES_BLOCK_SIZE 16

#define AES_KEYLEN_128 1
#define AES_KEYLEN_192 2
#define AES_KEYLEN_256 4
Expand Down
4 changes: 1 addition & 3 deletions arch/x86/crypto/aes_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*/

#include <asm/byteorder.h>
#include <crypto/aes.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
Expand All @@ -48,9 +49,6 @@
asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src);

#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32
#define AES_BLOCK_SIZE 16
#define AES_KS_LENGTH 4 * AES_BLOCK_SIZE
#define RC_LENGTH 29

Expand Down
6 changes: 1 addition & 5 deletions arch/x86/crypto/aes_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,14 @@
*/

#include <asm/byteorder.h>
#include <crypto/aes.h>
#include <linux/bitops.h>
#include <linux/crypto.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>

#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32

#define AES_BLOCK_SIZE 16

/*
* #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
*/
Expand Down
6 changes: 1 addition & 5 deletions crypto/aes_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,14 @@
s/RIJNDAEL(d_key)/D_KEY/g
*/

#include <crypto/aes.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/crypto.h>
#include <asm/byteorder.h>

#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32

#define AES_BLOCK_SIZE 16

/*
* #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
*/
Expand Down
1 change: 1 addition & 0 deletions drivers/crypto/geode-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/crypto.h>
#include <linux/spinlock.h>
#include <crypto/algapi.h>
#include <crypto/aes.h>

#include <asm/io.h>
#include <asm/delay.h>
Expand Down
4 changes: 1 addition & 3 deletions drivers/crypto/padlock-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
*/

#include <crypto/algapi.h>
#include <crypto/aes.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
Expand All @@ -53,9 +54,6 @@
#include <asm/byteorder.h>
#include "padlock.h"

#define AES_MIN_KEY_SIZE 16 /* in uint8_t units */
#define AES_MAX_KEY_SIZE 32 /* ditto */
#define AES_BLOCK_SIZE 16 /* ditto */
#define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */
#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))

Expand Down
15 changes: 15 additions & 0 deletions include/crypto/aes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Common values for AES algorithms
*/

#ifndef _CRYPTO_AES_H
#define _CRYPTO_AES_H

#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32
#define AES_KEYSIZE_128 16
#define AES_KEYSIZE_192 24
#define AES_KEYSIZE_256 32
#define AES_BLOCK_SIZE 16

#endif

0 comments on commit 89e1265

Please sign in to comment.