crypto: caam - Remove broken arc4 support
[ Upstream commiteeedb61837
] The arc4 algorithm requires storing state in the request context in order to allow more than one encrypt/decrypt operation. As this driver does not seem to do that, it means that using it for more than one operation is broken. Fixes:eaed71a44a
("crypto: caam - add ecb(*) support") Link: https://lore.kernel.org/linux-crypto/CAMj1kXGvMe_A_iQ43Pmygg9xaAM-RLy=_M=v+eg--8xNmv9P+w@mail.gmail.com Link: https://lore.kernel.org/linux-crypto/20200702101947.682-1-ardb@kernel.org Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
64563d1dca
commit
e0a684edf6
|
@ -818,12 +818,6 @@ static int ctr_skcipher_setkey(struct crypto_skcipher *skcipher,
|
||||||
return skcipher_setkey(skcipher, key, keylen, ctx1_iv_off);
|
return skcipher_setkey(skcipher, key, keylen, ctx1_iv_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int arc4_skcipher_setkey(struct crypto_skcipher *skcipher,
|
|
||||||
const u8 *key, unsigned int keylen)
|
|
||||||
{
|
|
||||||
return skcipher_setkey(skcipher, key, keylen, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int des_skcipher_setkey(struct crypto_skcipher *skcipher,
|
static int des_skcipher_setkey(struct crypto_skcipher *skcipher,
|
||||||
const u8 *key, unsigned int keylen)
|
const u8 *key, unsigned int keylen)
|
||||||
{
|
{
|
||||||
|
@ -2058,21 +2052,6 @@ static struct caam_skcipher_alg driver_algs[] = {
|
||||||
},
|
},
|
||||||
.caam.class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_ECB,
|
.caam.class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_ECB,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.skcipher = {
|
|
||||||
.base = {
|
|
||||||
.cra_name = "ecb(arc4)",
|
|
||||||
.cra_driver_name = "ecb-arc4-caam",
|
|
||||||
.cra_blocksize = ARC4_BLOCK_SIZE,
|
|
||||||
},
|
|
||||||
.setkey = arc4_skcipher_setkey,
|
|
||||||
.encrypt = skcipher_encrypt,
|
|
||||||
.decrypt = skcipher_decrypt,
|
|
||||||
.min_keysize = ARC4_MIN_KEY_SIZE,
|
|
||||||
.max_keysize = ARC4_MAX_KEY_SIZE,
|
|
||||||
},
|
|
||||||
.caam.class1_alg_type = OP_ALG_ALGSEL_ARC4 | OP_ALG_AAI_ECB,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct caam_aead_alg driver_aeads[] = {
|
static struct caam_aead_alg driver_aeads[] = {
|
||||||
|
@ -3533,7 +3512,6 @@ int caam_algapi_init(struct device *ctrldev)
|
||||||
struct caam_drv_private *priv = dev_get_drvdata(ctrldev);
|
struct caam_drv_private *priv = dev_get_drvdata(ctrldev);
|
||||||
int i = 0, err = 0;
|
int i = 0, err = 0;
|
||||||
u32 aes_vid, aes_inst, des_inst, md_vid, md_inst, ccha_inst, ptha_inst;
|
u32 aes_vid, aes_inst, des_inst, md_vid, md_inst, ccha_inst, ptha_inst;
|
||||||
u32 arc4_inst;
|
|
||||||
unsigned int md_limit = SHA512_DIGEST_SIZE;
|
unsigned int md_limit = SHA512_DIGEST_SIZE;
|
||||||
bool registered = false, gcm_support;
|
bool registered = false, gcm_support;
|
||||||
|
|
||||||
|
@ -3553,8 +3531,6 @@ int caam_algapi_init(struct device *ctrldev)
|
||||||
CHA_ID_LS_DES_SHIFT;
|
CHA_ID_LS_DES_SHIFT;
|
||||||
aes_inst = cha_inst & CHA_ID_LS_AES_MASK;
|
aes_inst = cha_inst & CHA_ID_LS_AES_MASK;
|
||||||
md_inst = (cha_inst & CHA_ID_LS_MD_MASK) >> CHA_ID_LS_MD_SHIFT;
|
md_inst = (cha_inst & CHA_ID_LS_MD_MASK) >> CHA_ID_LS_MD_SHIFT;
|
||||||
arc4_inst = (cha_inst & CHA_ID_LS_ARC4_MASK) >>
|
|
||||||
CHA_ID_LS_ARC4_SHIFT;
|
|
||||||
ccha_inst = 0;
|
ccha_inst = 0;
|
||||||
ptha_inst = 0;
|
ptha_inst = 0;
|
||||||
|
|
||||||
|
@ -3575,7 +3551,6 @@ int caam_algapi_init(struct device *ctrldev)
|
||||||
md_inst = mdha & CHA_VER_NUM_MASK;
|
md_inst = mdha & CHA_VER_NUM_MASK;
|
||||||
ccha_inst = rd_reg32(&priv->ctrl->vreg.ccha) & CHA_VER_NUM_MASK;
|
ccha_inst = rd_reg32(&priv->ctrl->vreg.ccha) & CHA_VER_NUM_MASK;
|
||||||
ptha_inst = rd_reg32(&priv->ctrl->vreg.ptha) & CHA_VER_NUM_MASK;
|
ptha_inst = rd_reg32(&priv->ctrl->vreg.ptha) & CHA_VER_NUM_MASK;
|
||||||
arc4_inst = rd_reg32(&priv->ctrl->vreg.afha) & CHA_VER_NUM_MASK;
|
|
||||||
|
|
||||||
gcm_support = aesa & CHA_VER_MISC_AES_GCM;
|
gcm_support = aesa & CHA_VER_MISC_AES_GCM;
|
||||||
}
|
}
|
||||||
|
@ -3598,10 +3573,6 @@ int caam_algapi_init(struct device *ctrldev)
|
||||||
if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES))
|
if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Skip ARC4 algorithms if not supported by device */
|
|
||||||
if (!arc4_inst && alg_sel == OP_ALG_ALGSEL_ARC4)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check support for AES modes not available
|
* Check support for AES modes not available
|
||||||
* on LP devices.
|
* on LP devices.
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include <crypto/akcipher.h>
|
#include <crypto/akcipher.h>
|
||||||
#include <crypto/scatterwalk.h>
|
#include <crypto/scatterwalk.h>
|
||||||
#include <crypto/skcipher.h>
|
#include <crypto/skcipher.h>
|
||||||
#include <crypto/arc4.h>
|
|
||||||
#include <crypto/internal/skcipher.h>
|
#include <crypto/internal/skcipher.h>
|
||||||
#include <crypto/internal/hash.h>
|
#include <crypto/internal/hash.h>
|
||||||
#include <crypto/internal/rsa.h>
|
#include <crypto/internal/rsa.h>
|
||||||
|
|
Loading…
Reference in New Issue