diff options
Diffstat (limited to 'crypto/des_generic.c')
-rw-r--r-- | crypto/des_generic.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/crypto/des_generic.c b/crypto/des_generic.c index f6cf63f88468..298d464ab7d2 100644 --- a/crypto/des_generic.c +++ b/crypto/des_generic.c | |||
@@ -859,13 +859,10 @@ static void des_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
859 | * property. | 859 | * property. |
860 | * | 860 | * |
861 | */ | 861 | */ |
862 | static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, | 862 | int __des3_ede_setkey(u32 *expkey, u32 *flags, const u8 *key, |
863 | unsigned int keylen) | 863 | unsigned int keylen) |
864 | { | 864 | { |
865 | const u32 *K = (const u32 *)key; | 865 | const u32 *K = (const u32 *)key; |
866 | struct des3_ede_ctx *dctx = crypto_tfm_ctx(tfm); | ||
867 | u32 *expkey = dctx->expkey; | ||
868 | u32 *flags = &tfm->crt_flags; | ||
869 | 866 | ||
870 | if (unlikely(!((K[0] ^ K[2]) | (K[1] ^ K[3])) || | 867 | if (unlikely(!((K[0] ^ K[2]) | (K[1] ^ K[3])) || |
871 | !((K[2] ^ K[4]) | (K[3] ^ K[5]))) && | 868 | !((K[2] ^ K[4]) | (K[3] ^ K[5]))) && |
@@ -880,6 +877,17 @@ static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
880 | 877 | ||
881 | return 0; | 878 | return 0; |
882 | } | 879 | } |
880 | EXPORT_SYMBOL_GPL(__des3_ede_setkey); | ||
881 | |||
882 | static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
883 | unsigned int keylen) | ||
884 | { | ||
885 | struct des3_ede_ctx *dctx = crypto_tfm_ctx(tfm); | ||
886 | u32 *flags = &tfm->crt_flags; | ||
887 | u32 *expkey = dctx->expkey; | ||
888 | |||
889 | return __des3_ede_setkey(expkey, flags, key, keylen); | ||
890 | } | ||
883 | 891 | ||
884 | static void des3_ede_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | 892 | static void des3_ede_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
885 | { | 893 | { |
@@ -945,6 +953,8 @@ static void des3_ede_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
945 | 953 | ||
946 | static struct crypto_alg des_algs[2] = { { | 954 | static struct crypto_alg des_algs[2] = { { |
947 | .cra_name = "des", | 955 | .cra_name = "des", |
956 | .cra_driver_name = "des-generic", | ||
957 | .cra_priority = 100, | ||
948 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 958 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
949 | .cra_blocksize = DES_BLOCK_SIZE, | 959 | .cra_blocksize = DES_BLOCK_SIZE, |
950 | .cra_ctxsize = sizeof(struct des_ctx), | 960 | .cra_ctxsize = sizeof(struct des_ctx), |
@@ -958,6 +968,8 @@ static struct crypto_alg des_algs[2] = { { | |||
958 | .cia_decrypt = des_decrypt } } | 968 | .cia_decrypt = des_decrypt } } |
959 | }, { | 969 | }, { |
960 | .cra_name = "des3_ede", | 970 | .cra_name = "des3_ede", |
971 | .cra_driver_name = "des3_ede-generic", | ||
972 | .cra_priority = 100, | ||
961 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 973 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
962 | .cra_blocksize = DES3_EDE_BLOCK_SIZE, | 974 | .cra_blocksize = DES3_EDE_BLOCK_SIZE, |
963 | .cra_ctxsize = sizeof(struct des3_ede_ctx), | 975 | .cra_ctxsize = sizeof(struct des3_ede_ctx), |