crypto: blowfish - rename C-version to blowfish_generic
Rename blowfish to blowfish_generic so that assembler versions of blowfish cipher can autoload. Module alias 'blowfish' is added. Also fix checkpatch warnings. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
52ba867c8c
commit
3f2a5d2d42
2 changed files with 8 additions and 5 deletions
|
@ -60,7 +60,7 @@ obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o
|
||||||
obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
|
obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
|
||||||
obj-$(CONFIG_CRYPTO_DES) += des_generic.o
|
obj-$(CONFIG_CRYPTO_DES) += des_generic.o
|
||||||
obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
|
obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
|
||||||
obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o
|
obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o
|
||||||
obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o
|
obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o
|
||||||
obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
|
obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
|
||||||
obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
|
obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
#define GET32_0(x) (((x) >> (24)) & (0xff))
|
#define GET32_0(x) (((x) >> (24)) & (0xff))
|
||||||
|
|
||||||
#define bf_F(x) (((S[GET32_0(x)] + S[256 + GET32_1(x)]) ^ \
|
#define bf_F(x) (((S[GET32_0(x)] + S[256 + GET32_1(x)]) ^ \
|
||||||
S[512 + GET32_2(x)]) + S[768 + GET32_3(x)])
|
S[512 + GET32_2(x)]) + S[768 + GET32_3(x)])
|
||||||
|
|
||||||
#define ROUND(a, b, n) b ^= P[n]; a ^= bf_F (b)
|
#define ROUND(a, b, n) ({ b ^= P[n]; a ^= bf_F(b); })
|
||||||
|
|
||||||
static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
|
static void bf_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
|
||||||
{
|
{
|
||||||
|
@ -108,6 +108,8 @@ static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
|
||||||
|
|
||||||
static struct crypto_alg alg = {
|
static struct crypto_alg alg = {
|
||||||
.cra_name = "blowfish",
|
.cra_name = "blowfish",
|
||||||
|
.cra_driver_name = "blowfish-generic",
|
||||||
|
.cra_priority = 100,
|
||||||
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
|
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
|
||||||
.cra_blocksize = BF_BLOCK_SIZE,
|
.cra_blocksize = BF_BLOCK_SIZE,
|
||||||
.cra_ctxsize = sizeof(struct bf_ctx),
|
.cra_ctxsize = sizeof(struct bf_ctx),
|
||||||
|
@ -118,8 +120,8 @@ static struct crypto_alg alg = {
|
||||||
.cia_min_keysize = BF_MIN_KEY_SIZE,
|
.cia_min_keysize = BF_MIN_KEY_SIZE,
|
||||||
.cia_max_keysize = BF_MAX_KEY_SIZE,
|
.cia_max_keysize = BF_MAX_KEY_SIZE,
|
||||||
.cia_setkey = blowfish_setkey,
|
.cia_setkey = blowfish_setkey,
|
||||||
.cia_encrypt = bf_encrypt,
|
.cia_encrypt = bf_encrypt,
|
||||||
.cia_decrypt = bf_decrypt } }
|
.cia_decrypt = bf_decrypt } }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init blowfish_mod_init(void)
|
static int __init blowfish_mod_init(void)
|
||||||
|
@ -137,3 +139,4 @@ module_exit(blowfish_mod_fini);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_DESCRIPTION("Blowfish Cipher Algorithm");
|
MODULE_DESCRIPTION("Blowfish Cipher Algorithm");
|
||||||
|
MODULE_ALIAS("blowfish");
|
Loading…
Reference in a new issue