Loading drivers/crypto/talitos.c +7 −30 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include <crypto/algapi.h> #include <crypto/aes.h> #include <crypto/des.h> #include <crypto/internal/des.h> #include <crypto/sha.h> #include <crypto/md5.h> #include <crypto/internal/aead.h> Loading Loading @@ -936,15 +936,9 @@ static int aead_des3_setkey(struct crypto_aead *authenc, if (keys.authkeylen + keys.enckeylen > TALITOS_MAX_KEY_SIZE) goto badkey; if (keys.enckeylen != DES3_EDE_KEY_SIZE) goto badkey; flags = crypto_aead_get_flags(authenc); err = __des3_verify_key(&flags, keys.enckey); if (unlikely(err)) { crypto_aead_set_flags(authenc, flags); err = verify_aead_des3_key(authenc, keys.enckey, keys.enckeylen); if (err) goto out; } if (ctx->keylen) dma_unmap_single(dev, ctx->dma_key, ctx->keylen, DMA_TO_DEVICE); Loading Loading @@ -1517,32 +1511,15 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, static int ablkcipher_des_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { u32 tmp[DES_EXPKEY_WORDS]; if (unlikely(crypto_ablkcipher_get_flags(cipher) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) && !des_ekey(tmp, key)) { crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_WEAK_KEY); return -EINVAL; } return ablkcipher_setkey(cipher, key, keylen); return verify_ablkcipher_des_key(cipher, key) ?: ablkcipher_setkey(cipher, key, keylen); } static int ablkcipher_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { u32 flags; int err; flags = crypto_ablkcipher_get_flags(cipher); err = __des3_verify_key(&flags, key); if (unlikely(err)) { crypto_ablkcipher_set_flags(cipher, flags); return err; } return ablkcipher_setkey(cipher, key, keylen); return verify_ablkcipher_des3_key(cipher, key) ?: ablkcipher_setkey(cipher, key, keylen); } static int ablkcipher_aes_setkey(struct crypto_ablkcipher *cipher, Loading Loading
drivers/crypto/talitos.c +7 −30 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ #include <crypto/algapi.h> #include <crypto/aes.h> #include <crypto/des.h> #include <crypto/internal/des.h> #include <crypto/sha.h> #include <crypto/md5.h> #include <crypto/internal/aead.h> Loading Loading @@ -936,15 +936,9 @@ static int aead_des3_setkey(struct crypto_aead *authenc, if (keys.authkeylen + keys.enckeylen > TALITOS_MAX_KEY_SIZE) goto badkey; if (keys.enckeylen != DES3_EDE_KEY_SIZE) goto badkey; flags = crypto_aead_get_flags(authenc); err = __des3_verify_key(&flags, keys.enckey); if (unlikely(err)) { crypto_aead_set_flags(authenc, flags); err = verify_aead_des3_key(authenc, keys.enckey, keys.enckeylen); if (err) goto out; } if (ctx->keylen) dma_unmap_single(dev, ctx->dma_key, ctx->keylen, DMA_TO_DEVICE); Loading Loading @@ -1517,32 +1511,15 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, static int ablkcipher_des_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { u32 tmp[DES_EXPKEY_WORDS]; if (unlikely(crypto_ablkcipher_get_flags(cipher) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) && !des_ekey(tmp, key)) { crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_WEAK_KEY); return -EINVAL; } return ablkcipher_setkey(cipher, key, keylen); return verify_ablkcipher_des_key(cipher, key) ?: ablkcipher_setkey(cipher, key, keylen); } static int ablkcipher_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { u32 flags; int err; flags = crypto_ablkcipher_get_flags(cipher); err = __des3_verify_key(&flags, key); if (unlikely(err)) { crypto_ablkcipher_set_flags(cipher, flags); return err; } return ablkcipher_setkey(cipher, key, keylen); return verify_ablkcipher_des3_key(cipher, key) ?: ablkcipher_setkey(cipher, key, keylen); } static int ablkcipher_aes_setkey(struct crypto_ablkcipher *cipher, Loading