提交 43a942d2 编写于 作者: C Christophe Leroy 提交者: Herbert Xu

crypto: talitos - Fix ctr(aes) on SEC1

While ctr(aes) requires the use of a special descriptor on SEC2 (see
commit 70d355cc ("crypto: talitos - fix ctr-aes-talitos")), that
special descriptor doesn't work on SEC1, see commit e738c5f1
("powerpc/8xx: Add DT node for using the SEC engine of the MPC885").

However, the common nonsnoop descriptor works properly on SEC1 for
ctr(aes).

Add a second template for ctr(aes) that will be registered
only on SEC1.

Fixes: 70d355cc ("crypto: talitos - fix ctr-aes-talitos")
Signed-off-by: NChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 416b8467
...@@ -2765,6 +2765,22 @@ static struct talitos_alg_template driver_algs[] = { ...@@ -2765,6 +2765,22 @@ static struct talitos_alg_template driver_algs[] = {
DESC_HDR_SEL0_AESU | DESC_HDR_SEL0_AESU |
DESC_HDR_MODE0_AESU_CTR, DESC_HDR_MODE0_AESU_CTR,
}, },
{ .type = CRYPTO_ALG_TYPE_SKCIPHER,
.alg.skcipher = {
.base.cra_name = "ctr(aes)",
.base.cra_driver_name = "ctr-aes-talitos",
.base.cra_blocksize = 1,
.base.cra_flags = CRYPTO_ALG_ASYNC |
CRYPTO_ALG_ALLOCATES_MEMORY,
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_BLOCK_SIZE,
.setkey = skcipher_aes_setkey,
},
.desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
DESC_HDR_SEL0_AESU |
DESC_HDR_MODE0_AESU_CTR,
},
{ .type = CRYPTO_ALG_TYPE_SKCIPHER, { .type = CRYPTO_ALG_TYPE_SKCIPHER,
.alg.skcipher = { .alg.skcipher = {
.base.cra_name = "ecb(des)", .base.cra_name = "ecb(des)",
...@@ -3182,6 +3198,12 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, ...@@ -3182,6 +3198,12 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
t_alg->algt.alg.skcipher.setkey ?: skcipher_setkey; t_alg->algt.alg.skcipher.setkey ?: skcipher_setkey;
t_alg->algt.alg.skcipher.encrypt = skcipher_encrypt; t_alg->algt.alg.skcipher.encrypt = skcipher_encrypt;
t_alg->algt.alg.skcipher.decrypt = skcipher_decrypt; t_alg->algt.alg.skcipher.decrypt = skcipher_decrypt;
if (!strcmp(alg->cra_name, "ctr(aes)") && !has_ftr_sec1(priv) &&
DESC_TYPE(t_alg->algt.desc_hdr_template) !=
DESC_TYPE(DESC_HDR_TYPE_AESU_CTR_NONSNOOP)) {
devm_kfree(dev, t_alg);
return ERR_PTR(-ENOTSUPP);
}
break; break;
case CRYPTO_ALG_TYPE_AEAD: case CRYPTO_ALG_TYPE_AEAD:
alg = &t_alg->algt.alg.aead.base; alg = &t_alg->algt.alg.aead.base;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册