Skip to contentSkip to conversation

crypto: caam/qi,qi2 - set plain_keylen for skcipher descriptors

PATCH In review Vincent Jardin 2 participants 2 messages Sep 28 – Oct 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: caam/qi,qi2 - set plain_keylen for skcipher descriptors

Since the commit 66b9a095f7f9
("crypto: caam - Add support of paes algorithm")

The shared descriptor then loads a zero-length key and the SEC decodes the inlined key bytes as commands.

Test: with CONFIG_CRYPTO_SELFTESTS on LX2160A every skcipher but xts fails:

dpaa2_caam dpseci.0: 40000307: DECO: desc idx 3: Invalid LOAD Command
alg: skcipher: ctr-aes-caam-qi2 encryption failed on test vector 0; expected_error=0, actual_error=-22, cfg="in-place (one sglist)"

caamalg_qi.c is compile-tested only.

Fixes 66b9a095f7f9 ("crypto: caam - Add support of paes algorithm")
---
 drivers/crypto/caam/caamalg_qi.c  | 2 ++
 drivers/crypto/caam/caamalg_qi2.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/crypto/caam/caamalg_qi.c +2 -0
index aa779caacfe5..2f2682c8bcd8 100644
@@ -637,6 +637,8 @@ static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
 	ctx->cdata.keylen = keylen;
 	ctx->cdata.key_virt = key;
 	ctx->cdata.key_inline = true;
+	ctx->cdata.plain_keylen = keylen;
+	ctx->cdata.key_cmd_opt = 0;
 
 	/* skcipher encrypt, decrypt shared descriptors */
 	cnstr_shdsc_skcipher_encap(ctx->sh_desc_enc, &ctx->cdata, ivsize,
drivers/crypto/caam/caamalg_qi2.c +2 -0
index 6b47bcc16a50..d52706931285 100644
@@ -961,6 +961,8 @@ static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
 	ctx->cdata.keylen = keylen;
 	ctx->cdata.key_virt = key;
 	ctx->cdata.key_inline = true;
+	ctx->cdata.plain_keylen = keylen;
+	ctx->cdata.key_cmd_opt = 0;
 
 	/* skcipher_encrypt shared descriptor */
 	flc = &ctx->flc[ENCRYPT];

---
base-commit: 10396a2d6d41d594975b6ece712278570c3c970c
change-id: 20260928-for-upstream-caam-qi-plain-keylen-72e8b611e787

Best regards,

Signature · 1 line
Vincent Jardin <[email protected]>
maintainer
#1 lore raw
Quoted 13 lines · On Mon, Sep 28, 2026 at 04:09:16PM +0200, Vincent Jardin via B4 Relay wrote:

From: Vincent Jardin <[email protected]>

Since the commit 66b9a095f7f9
("crypto: caam - Add support of paes algorithm")

The shared descriptor then loads a zero-length key and the SEC decodes the inlined key bytes as commands.

Test: with CONFIG_CRYPTO_SELFTESTS on LX2160A every skcipher but xts fails:

dpaa2_caam dpseci.0: 40000307: DECO: desc idx 3: Invalid LOAD Command
alg: skcipher: ctr-aes-caam-qi2 encryption failed on test vector 0; expected_error=0, actual_error=-22, cfg="in-place (one sglist)"

Quoted 8 lines

caamalg_qi.c is compile-tested only.

Fixes 66b9a095f7f9 ("crypto: caam - Add support of paes algorithm")
---
 drivers/crypto/caam/caamalg_qi.c  | 2 ++
 drivers/crypto/caam/caamalg_qi2.c | 2 ++
 2 files changed, 4 insertions(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt