You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[CRYPTO] twofish: Split out common c code
This patch splits up the twofish crypto routine into a common part ( key setup ) which will be uses by all twofish crypto modules ( generic-c , i586 assembler and x86_64 assembler ) and generic-c part. It also creates a new header file which will be used by all 3 modules. This eliminates all code duplication. Correctness was verified with the tcrypt module and automated test scripts. Signed-off-by: Joachim Fritschi <jfritschi@freenet.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
799111020c
commit
2729bb427f
@@ -131,6 +131,7 @@ config CRYPTO_BLOWFISH
|
||||
config CRYPTO_TWOFISH
|
||||
tristate "Twofish cipher algorithm"
|
||||
depends on CRYPTO
|
||||
select CRYPTO_TWOFISH_COMMON
|
||||
help
|
||||
Twofish cipher algorithm.
|
||||
|
||||
@@ -142,6 +143,13 @@ config CRYPTO_TWOFISH
|
||||
See also:
|
||||
<http://www.schneier.com/twofish.html>
|
||||
|
||||
config CRYPTO_TWOFISH_COMMON
|
||||
tristate
|
||||
depends on CRYPTO
|
||||
help
|
||||
Common parts of the Twofish cipher algorithm shared by the
|
||||
generic c and the assembler implementations.
|
||||
|
||||
config CRYPTO_SERPENT
|
||||
tristate "Serpent cipher algorithm"
|
||||
depends on CRYPTO
|
||||
|
||||
@@ -19,6 +19,7 @@ obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
|
||||
obj-$(CONFIG_CRYPTO_DES) += des.o
|
||||
obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o
|
||||
obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o
|
||||
obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
|
||||
obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o
|
||||
obj-$(CONFIG_CRYPTO_AES) += aes.o
|
||||
obj-$(CONFIG_CRYPTO_CAST5) += cast5.o
|
||||
|
||||
+1
-697
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
#ifndef _CRYPTO_TWOFISH_H
|
||||
#define _CRYPTO_TWOFISH_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define TF_MIN_KEY_SIZE 16
|
||||
#define TF_MAX_KEY_SIZE 32
|
||||
#define TF_BLOCK_SIZE 16
|
||||
|
||||
struct crypto_tfm;
|
||||
|
||||
/* Structure for an expanded Twofish key. s contains the key-dependent
|
||||
* S-boxes composed with the MDS matrix; w contains the eight "whitening"
|
||||
* subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note
|
||||
* that k[i] corresponds to what the Twofish paper calls K[i+8]. */
|
||||
struct twofish_ctx {
|
||||
u32 s[4][256], w[8], k[32];
|
||||
};
|
||||
|
||||
int twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
|
||||
unsigned int key_len, u32 *flags);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user