Commit 0e1cbe97 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

crypto: cpt/des - switch to new verification routines

Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a628c5a1
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/algapi.h> #include <crypto/algapi.h>
#include <crypto/authenc.h> #include <crypto/authenc.h>
#include <crypto/des.h> #include <crypto/internal/des.h>
#include <crypto/xts.h> #include <crypto/xts.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -322,31 +322,15 @@ static int cvm_cfb_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, ...@@ -322,31 +322,15 @@ static int cvm_cfb_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
static int cvm_cbc_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, static int cvm_cbc_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
u32 keylen) u32 keylen)
{ {
u32 flags = crypto_ablkcipher_get_flags(cipher); return verify_ablkcipher_des3_key(cipher, key) ?:
int err; cvm_setkey(cipher, key, keylen, DES3_CBC);
err = __des3_verify_key(&flags, key);
if (unlikely(err)) {
crypto_ablkcipher_set_flags(cipher, flags);
return err;
}
return cvm_setkey(cipher, key, keylen, DES3_CBC);
} }
static int cvm_ecb_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, static int cvm_ecb_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
u32 keylen) u32 keylen)
{ {
u32 flags = crypto_ablkcipher_get_flags(cipher); return verify_ablkcipher_des3_key(cipher, key) ?:
int err; cvm_setkey(cipher, key, keylen, DES3_ECB);
err = __des3_verify_key(&flags, key);
if (unlikely(err)) {
crypto_ablkcipher_set_flags(cipher, flags);
return err;
}
return cvm_setkey(cipher, key, keylen, DES3_ECB);
} }
static int cvm_enc_dec_init(struct crypto_tfm *tfm) static int cvm_enc_dec_init(struct crypto_tfm *tfm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment