Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: picoxcell/des - switch to new verification routines

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ard Biesheuvel and committed by
Herbert Xu
0157fb26 304daa4f

+8 -16
+8 -16
drivers/crypto/picoxcell_crypto.c
··· 6 6 #include <crypto/aes.h> 7 7 #include <crypto/algapi.h> 8 8 #include <crypto/authenc.h> 9 - #include <crypto/des.h> 9 + #include <crypto/internal/des.h> 10 10 #include <crypto/md5.h> 11 11 #include <crypto/sha.h> 12 12 #include <crypto/internal/skcipher.h> ··· 736 736 static int spacc_des_setkey(struct crypto_ablkcipher *cipher, const u8 *key, 737 737 unsigned int len) 738 738 { 739 - struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); 740 - struct spacc_ablk_ctx *ctx = crypto_tfm_ctx(tfm); 741 - u32 tmp[DES_EXPKEY_WORDS]; 739 + struct spacc_ablk_ctx *ctx = crypto_ablkcipher_ctx(cipher); 740 + int err; 742 741 743 - if (unlikely(!des_ekey(tmp, key)) && 744 - (crypto_ablkcipher_get_flags(cipher) & 745 - CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) { 746 - tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY; 747 - return -EINVAL; 748 - } 742 + err = verify_ablkcipher_des_key(cipher, key); 743 + if (err) 744 + return err; 749 745 750 746 memcpy(ctx->key, key, len); 751 747 ctx->key_len = len; ··· 757 761 unsigned int len) 758 762 { 759 763 struct spacc_ablk_ctx *ctx = crypto_ablkcipher_ctx(cipher); 760 - u32 flags; 761 764 int err; 762 765 763 - flags = crypto_ablkcipher_get_flags(cipher); 764 - err = __des3_verify_key(&flags, key); 765 - if (unlikely(err)) { 766 - crypto_ablkcipher_set_flags(cipher, flags); 766 + err = verify_ablkcipher_des3_key(cipher, key); 767 + if (err) 767 768 return err; 768 - } 769 769 770 770 memcpy(ctx->key, key, len); 771 771 ctx->key_len = len;