Skip to contentSkip to conversation

Add support for more AES modes in TI DTHEv2

PATCH Superseded T Pratham 3 participants 11 messages Nov 11, 2025 – Nov 21, 2025

Subsystems (4)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

T Pratham

author maintainer
#0 lore raw

v6 cover Add support for more AES modes in TI DTHEv2

DTHEv2 is a new cryptography engine introduced in TI AM62L SoC. The features of DTHEv2 and details of AES modes supported were detailed in [1]. Additional hardware details available in SoC TRM [2].

This patch series adds support for the following AES modes:
- AES-XTS
- AES-CTR
- AES-GCM
- AES-CCM

The driver is tested using full kernel crypto selftests (CRYPTO_SELFTESTS_FULL) which all pass successfully [3].

---
[1]: [PATCH v7 0/2] Add support for Texas Instruments DTHEv2 Crypto Engine

[2]: Section 14.6.3 (DMA Control Registers -> DMASS_DTHE)

[3]: DTHEv2 AES Engine kernel self-tests logs

Change log:
v6:
- Removed memory alloc calls on the data path (CTR padding in aes_run), replaced with scatterlist chaining for added a pad buffer. Added two accompanying helpers dthe_chain_pad_sg() and dthe_unchain_padded_sg().
- Replaced GFP_KERNEL to GFP_ATOMIC in AEAD src and dst scatterlist prep functions to avoid deadlock in data path.
- Added fallback to software in AEADs on failure.
v5:
- Simplified AES-XTS fallback allocation, directly using xts(aes) for alg_name
- Changed fallback to sync and allocated on stack
v4:
- Return -EINVAL in AES-XTS when cryptlen = 0
- Added software fallback for AES-XTS when ciphertext stealing is required (cryptlen is not multiple of AES_BLOCK_SIZE)
- Changed DTHE_MAX_KEYSIZE definition to use AES_MAX_KEY_SIZE instead of AES_KEYSIZE_256
- In AES-CTR, also pad dst scatterlist when padding src scatterlist
- Changed polling for TAG ready to use readl_relaxed_poll_timeout()
- Used crypto API functions to access struct members instead of directly accessing them (crypto_aead_tfm and aead_request_flags)
- Allocated padding buffers in AEAD algos on the stack.
- Changed helper functions dthe_aead_prep_* to return ERR_PTR on error
- Changed some error labels in dthe_aead_run to improve clarity
- Moved iv_in[] declaration from middle of the function to the top
- Corrected setting CCM M value in the hardware register
- Added checks for CCM L value input in the algorithm from IV.
- Added more fallback cases for CCM where hardware has limitations
v3:
- Added header files to remove implicit declaration error.
- Corrected assignment of src_nents and dst_nents in dthe_aead_run (Ran the lkp kernel test bot script locally to ensure no more such errors are present)
v2:
- Corrected assignment of variable unpadded_cryptlen in dthe_aead_run.
- Removed some if conditions which are always false, and documented the cases in comments.
- Moved polling of TAG ready register to a separate function and returning -ETIMEDOUT on poll timeout.
- Corrected comments to adhere to kernel coding guidelines.

Link to previous version:

v5: https://lore.kernel.org/all/[email protected]/
v4: https://lore.kernel.org/all/[email protected]/
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
---

T Pratham (4):
crypto: ti - Add support for AES-XTS in DTHEv2 driver
crypto: ti - Add support for AES-CTR in DTHEv2 driver
crypto: ti - Add support for AES-GCM in DTHEv2 driver
crypto: ti - Add support for AES-CCM in DTHEv2 driver

 drivers/crypto/ti/Kconfig         |   5 +
 drivers/crypto/ti/dthev2-aes.c    | 964 +++++++++++++++++++++++++++++-
 drivers/crypto/ti/dthev2-common.c |  19 +
 drivers/crypto/ti/dthev2-common.h |  33 +-
 4 files changed, 1004 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v6 1/4 crypto: ti - Add support for AES-XTS in DTHEv2 driver

Add support for XTS mode of operation for AES algorithm in the AES Engine of the DTHEv2 hardware cryptographic engine.

---
 drivers/crypto/ti/Kconfig         |   1 +
 drivers/crypto/ti/dthev2-aes.c    | 137 ++++++++++++++++++++++++++++--
 drivers/crypto/ti/dthev2-common.h |  10 ++-
 3 files changed, 141 insertions(+), 7 deletions(-)
drivers/crypto/ti/Kconfig +1 -0
index d4f91c1e0cb55..a3692ceec49bc 100644
@@ -6,6 +6,7 @@ config CRYPTO_DEV_TI_DTHEV2
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ECB
 	select CRYPTO_CBC
+	select CRYPTO_XTS
 	help
 	  This enables support for the TI DTHE V2 hw cryptography engine
 	  which can be found on TI K3 SOCs. Selecting this enables use
drivers/crypto/ti/dthev2-aes.c +131 -6

204 lines not on this page · raw message

drivers/crypto/ti/dthev2-common.h +9 -1
index 68c94acda8aaa..c7a06a4c353ff 100644
@@ -27,10 +27,16 @@
 
 #define DTHE_REG_SIZE		4
 #define DTHE_DMA_TIMEOUT_MS	2000
+/*
+ * Size of largest possible key (of all algorithms) to be stored in dthe_tfm_ctx
+ * This is currently the keysize of XTS-AES-256 which is 512 bits (64 bytes)
+ */
+#define DTHE_MAX_KEYSIZE	(AES_MAX_KEY_SIZE * 2)
 
 enum dthe_aes_mode {
 	DTHE_AES_ECB = 0,
 	DTHE_AES_CBC,
+	DTHE_AES_XTS,
 };
 
 /* Driver specific struct definitions */
@@ -73,12 +79,14 @@ struct dthe_list {
  * @keylen: AES key length
  * @key: AES key
  * @aes_mode: AES mode
+ * @skcipher_fb: Fallback crypto skcipher handle for AES-XTS mode
  */
 struct dthe_tfm_ctx {
 	struct dthe_data *dev_data;
 	unsigned int keylen;
-	u32 key[AES_KEYSIZE_256 / sizeof(u32)];
+	u32 key[DTHE_MAX_KEYSIZE / sizeof(u32)];
 	enum dthe_aes_mode aes_mode;
+	struct crypto_sync_skcipher *skcipher_fb;
 };
 
 /**
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

Re: [PATCH v6 1/4] crypto: ti - Add support for AES-XTS in DTHEv2 driver

Quoted 4 lines · T Pratham

Add support for XTS mode of operation for AES algorithm in the AES Engine of the DTHEv2 hardware cryptographic engine.

Hi Herbert,

I noticed after pulling your tree that this patch was already merged. You can safely ignore this patch in this series as no changes were made to this.

Signature · 2 lines
Regards
T Pratham <[email protected]>
author maintainer
#3 lore raw

PATCH v6 2/4 crypto: ti - Add support for AES-CTR in DTHEv2 driver

In reply to T Pratham

Add support for CTR mode of operation for AES algorithm in the AES Engine of the DTHEv2 hardware cryptographic engine.

---
 drivers/crypto/ti/Kconfig         |   1 +
 drivers/crypto/ti/dthev2-aes.c    | 139 ++++++++++++++++++++++++++++--
 drivers/crypto/ti/dthev2-common.c |  19 ++++
 drivers/crypto/ti/dthev2-common.h |  15 ++++
 4 files changed, 165 insertions(+), 9 deletions(-)
drivers/crypto/ti/Kconfig +1 -0
index a3692ceec49bc..6027e12de279d 100644
@@ -6,6 +6,7 @@ config CRYPTO_DEV_TI_DTHEV2
 	select CRYPTO_SKCIPHER
 	select CRYPTO_ECB
 	select CRYPTO_CBC
+	select CRYPTO_CTR
 	select CRYPTO_XTS
 	help
 	  This enables support for the TI DTHE V2 hw cryptography engine
drivers/crypto/ti/dthev2-aes.c +130 -9

227 lines not on this page · raw message

drivers/crypto/ti/dthev2-common.c +19 -0
index c39d37933b9ee..a2ad79bec105a 100644
@@ -48,6 +48,25 @@ struct dthe_data *dthe_get_dev(struct dthe_tfm_ctx *ctx)
 	return dev_data;
 }
 
+struct scatterlist *dthe_copy_sg(struct scatterlist *dst,
+				 struct scatterlist *src,
+				 int buflen)
+{
+	struct scatterlist *from_sg, *to_sg;
+	int sglen;
+
+	for (to_sg = dst, from_sg = src; buflen && from_sg; buflen -= sglen) {
+		sglen = from_sg->length;
+		if (sglen > buflen)
+			sglen = buflen;
+		sg_set_buf(to_sg, sg_virt(from_sg), sglen);
+		from_sg = sg_next(from_sg);
+		to_sg = sg_next(to_sg);
+	}
+
+	return to_sg;
+}
+
 static int dthe_dma_init(struct dthe_data *dev_data)
 {
 	int ret;
drivers/crypto/ti/dthev2-common.h +15 -0
index c7a06a4c353ff..f12b94d64e134 100644
@@ -36,6 +36,7 @@
 enum dthe_aes_mode {
 	DTHE_AES_ECB = 0,
 	DTHE_AES_CBC,
+	DTHE_AES_CTR,
 	DTHE_AES_XTS,
 };
 
@@ -103,6 +104,20 @@ struct dthe_aes_req_ctx {
 
 struct dthe_data *dthe_get_dev(struct dthe_tfm_ctx *ctx);
 
+/**
+ * dthe_copy_sg - Copy sg entries from src to dst
+ * @dst: Destination sg to be filled
+ * @src: Source sg to be copied from
+ * @buflen: Number of bytes to be copied
+ *
+ * Description:
+ *   Copy buflen bytes of data from src to dst.
+ *
+ **/
+struct scatterlist *dthe_copy_sg(struct scatterlist *dst,
+				 struct scatterlist *src,
+				 int buflen);
+
 int dthe_register_aes_algs(void);
 void dthe_unregister_aes_algs(void);
 
Signature · 1 line
2.43.0
maintainer
#4 lore raw

Re: [PATCH v6 2/4] crypto: ti - Add support for AES-CTR in DTHEv2 driver

Quoted 5 lines · T Pratham
drivers/crypto/ti/dthev2-aes.c +0 -0
@@ -270,12 +326,17 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq)
 	struct scatterlist *src = req->src;
 	struct scatterlist *dst = req->dst;
 

drivers/crypto/ti/dthev2-aes.c static int dthe_aes_run(struct crypto_engine *engine, void *areq) · line 337

Quoted 10 lines
drivers/crypto/ti/dthev2-aes.c +4 -1
+	struct scatterlist src_pad[2], dst_pad[2];
+
 	int src_nents = sg_nents_for_len(src, len);
-	int dst_nents;
+	int dst_nents = sg_nents_for_len(dst, len);
 
 	int src_mapped_nents;
 	int dst_mapped_nents;
 
+	u8 pad_buf[AES_BLOCK_SIZE] = {0};

You can't put stack memory into an SG list since the ability to DMA to the stack is not guaranteed.

I suggest that you place the buffer into the request object instead. The request object is designed to allow DMA and you can allocate as much memory as you like by setting reqsize.

Cheers,

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
author maintainer
#5 lore raw

PATCH v6 3/4 crypto: ti - Add support for AES-GCM in DTHEv2 driver

In reply to T Pratham

AES-GCM is an AEAD algorithm supporting both encryption and authentication of data. This patch introduces support for AES-GCM as the first AEAD algorithm supported by the DTHEv2 driver.

---
 drivers/crypto/ti/Kconfig         |   2 +
 drivers/crypto/ti/dthev2-aes.c    | 591 +++++++++++++++++++++++++++++-
 drivers/crypto/ti/dthev2-common.h |   9 +-
 3 files changed, 600 insertions(+), 2 deletions(-)
drivers/crypto/ti/Kconfig +2 -0
index 6027e12de279d..221e483737439 100644
@@ -8,6 +8,8 @@ config CRYPTO_DEV_TI_DTHEV2
 	select CRYPTO_CBC
 	select CRYPTO_CTR
 	select CRYPTO_XTS
+	select CRYPTO_GCM
+	select SG_SPLIT
 	help
 	  This enables support for the TI DTHE V2 hw cryptography engine
 	  which can be found on TI K3 SOCs. Selecting this enables use
drivers/crypto/ti/dthev2-aes.c +590 -1

644 lines not on this page · raw message

drivers/crypto/ti/dthev2-common.h +8 -1
index f12b94d64e134..7c54291359bf5 100644
@@ -38,6 +38,7 @@ enum dthe_aes_mode {
 	DTHE_AES_CBC,
 	DTHE_AES_CTR,
 	DTHE_AES_XTS,
+	DTHE_AES_GCM,
 };
 
 /* Driver specific struct definitions */
@@ -78,16 +79,22 @@ struct dthe_list {
  * struct dthe_tfm_ctx - Transform ctx struct containing ctx for all sub-components of DTHE V2
  * @dev_data: Device data struct pointer
  * @keylen: AES key length
+ * @authsize: Authentication size for modes with authentication
  * @key: AES key
  * @aes_mode: AES mode
+ * @aead_fb: Fallback crypto aead handle
  * @skcipher_fb: Fallback crypto skcipher handle for AES-XTS mode
  */
 struct dthe_tfm_ctx {
 	struct dthe_data *dev_data;
 	unsigned int keylen;
+	unsigned int authsize;
 	u32 key[DTHE_MAX_KEYSIZE / sizeof(u32)];
 	enum dthe_aes_mode aes_mode;
-	struct crypto_sync_skcipher *skcipher_fb;
+	union {
+		struct crypto_sync_aead *aead_fb;
+		struct crypto_sync_skcipher *skcipher_fb;
+	};
 };
 
 /**
Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver

kernel test robot noticed the following build errors:

Hi Pratham,

kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-crypto-2.6/master]
[also build test ERROR on linus/master v6.18-rc5]
[cannot apply to herbert-cryptodev-2.6/master next-20251113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/T-Pratham/crypto-ti-Add-support-for-AES-XTS-in-DTHEv2-driver/20251111-192827
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git master
patch link:    https://lore.kernel.org/r/20251111112137.976121-4-t-pratham%40ti.com
patch subject: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver
config: arm-randconfig-003-20251114 (https://download.01.org/0day-ci/archive/20251114/[email protected]/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 0bba1e76581bad04e7d7f09f5115ae5e2989e0d9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251114/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/crypto/ti/dthev2-aes.c:573:17: error: call to undeclared function 'crypto_alloc_sync_aead'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                        ^
   drivers/crypto/ti/dthev2-aes.c:573:17: note: did you mean 'crypto_alloc_aead'?
   include/crypto/aead.h:181:21: note: 'crypto_alloc_aead' declared here
     181 | struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
         |                     ^
>> drivers/crypto/ti/dthev2-aes.c:573:15: error: incompatible integer to pointer conversion assigning to 'struct crypto_sync_aead *' from 'int' [-Wint-conversion]
     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     574 |                                               CRYPTO_ALG_NEED_FALLBACK);
         |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/crypto/ti/dthev2-aes.c:588:2: error: call to undeclared function 'crypto_free_sync_aead'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     588 |         crypto_free_sync_aead(ctx->aead_fb);
         |         ^
   drivers/crypto/ti/dthev2-aes.c:588:2: note: did you mean 'crypto_free_aead'?
   include/crypto/aead.h:194:20: note: 'crypto_free_aead' declared here
     194 | static inline void crypto_free_aead(struct crypto_aead *tfm)
         |                    ^
>> drivers/crypto/ti/dthev2-aes.c:831:2: error: call to undeclared function 'crypto_sync_aead_clear_flags'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     831 |         crypto_sync_aead_clear_flags(ctx->aead_fb, CRYPTO_TFM_REQ_MASK);
         |         ^
   drivers/crypto/ti/dthev2-aes.c:831:2: note: did you mean 'crypto_aead_clear_flags'?
   include/crypto/aead.h:298:20: note: 'crypto_aead_clear_flags' declared here
     298 | static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
         |                    ^
>> drivers/crypto/ti/dthev2-aes.c:832:2: error: call to undeclared function 'crypto_sync_aead_set_flags'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     832 |         crypto_sync_aead_set_flags(ctx->aead_fb,
         |         ^
>> drivers/crypto/ti/dthev2-aes.c:836:9: error: call to undeclared function 'crypto_sync_aead_setkey'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     836 |         return crypto_sync_aead_setkey(ctx->aead_fb, key, keylen);
         |                ^
   drivers/crypto/ti/dthev2-aes.c:836:9: note: did you mean 'crypto_aead_setkey'?
   include/crypto/aead.h:319:5: note: 'crypto_aead_setkey' declared here
     319 | int crypto_aead_setkey(struct crypto_aead *tfm,
         |     ^
>> drivers/crypto/ti/dthev2-aes.c:846:9: error: call to undeclared function 'crypto_sync_aead_setauthsize'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     846 |         return crypto_sync_aead_setauthsize(ctx->aead_fb, authsize);
         |                ^
   drivers/crypto/ti/dthev2-aes.c:846:9: note: did you mean 'crypto_aead_setauthsize'?
   include/crypto/aead.h:332:5: note: 'crypto_aead_setauthsize' declared here
     332 | int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
         |     ^
>> drivers/crypto/ti/dthev2-aes.c:854:2: error: call to undeclared function 'SYNC_AEAD_REQUEST_ON_STACK'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |         ^
>> drivers/crypto/ti/dthev2-aes.c:854:29: error: use of undeclared identifier 'subreq'
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |                                    ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:856:28: error: use of undeclared identifier 'subreq'
     856 |         aead_request_set_callback(subreq, req->base.flags,
         |                                   ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:858:25: error: use of undeclared identifier 'subreq'
     858 |         aead_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv);
         |                                ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:859:22: error: use of undeclared identifier 'subreq'
     859 |         aead_request_set_ad(subreq, req->assoclen);
         |                             ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:861:41: error: use of undeclared identifier 'subreq'
     861 |         return rctx->enc ? crypto_aead_encrypt(subreq) :
         |                                                ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:862:23: error: use of undeclared identifier 'subreq'
     862 |                 crypto_aead_decrypt(subreq);
         |                                     ^~~~~~

14 errors generated.

vim +/crypto_alloc_sync_aead +573 drivers/crypto/ti/dthev2-aes.c

563
564 static int dthe_aead_init_tfm(struct crypto_aead *tfm)
565 {
566 struct dthe_tfm_ctx *ctx = crypto_aead_ctx(tfm);
567 struct dthe_data *dev_data = dthe_get_dev(ctx);
568
569 ctx->dev_data = dev_data;
570
571 const char *alg_name = crypto_tfm_alg_name(crypto_aead_tfm(tfm));
572

 > 573		ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
   574						      CRYPTO_ALG_NEED_FALLBACK);
   575		if (IS_ERR(ctx->aead_fb)) {
   576			dev_err(dev_data->dev, "fallback driver %s couldn't be loaded\n",
   577				alg_name);
   578			return PTR_ERR(ctx->aead_fb);
   579		}
   580	
   581		return 0;
   582	}
   583	
   584	static void dthe_aead_exit_tfm(struct crypto_aead *tfm)
   585	{
   586		struct dthe_tfm_ctx *ctx = crypto_aead_ctx(tfm);
   587	
 > 588		crypto_free_sync_aead(ctx->aead_fb);

589 }
590

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer Applied
#7 lore raw

Re: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver

Quoted 6 lines · kernel test robot

Hi Pratham,

kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-crypto-2.6/master] [also build test ERROR on linus/master v6.18-rc5]

Applied to incorrect tree. The patch depends on [1] which has been merged in cryptodev-2.6/master

Quoted 1 line

[cannot apply to herbert-cryptodev-2.6/master next-20251113]

This is maybe due to the first patch in the series, which was already present in the tree?

Quoted 67 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:573:17: error: call to undeclared function 'crypto_alloc_sync_aead'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                        ^
   drivers/crypto/ti/dthev2-aes.c:573:17: note: did you mean 'crypto_alloc_aead'?
   include/crypto/aead.h:181:21: note: 'crypto_alloc_aead' declared here
     181 | struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
         |                     ^
Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:573:15: error: incompatible integer to pointer conversion assigning to 'struct crypto_sync_aead *' from 'int' [-Wint-conversion]

     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     574 |                                               CRYPTO_ALG_NEED_FALLBACK);
         |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:588:2: error: call to undeclared function 'crypto_free_sync_aead'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     588 |         crypto_free_sync_aead(ctx->aead_fb);
         |         ^

drivers/crypto/ti/dthev2-aes.c:588:2: note: did you mean 'crypto_free_aead'? include/crypto/aead.h:194:20: note: 'crypto_free_aead' declared here
194 | static inline void crypto_free_aead(struct crypto_aead *tfm)
| ^

Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:831:2: error: call to undeclared function 'crypto_sync_aead_clear_flags'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     831 |         crypto_sync_aead_clear_flags(ctx->aead_fb, CRYPTO_TFM_REQ_MASK);
         |         ^

drivers/crypto/ti/dthev2-aes.c:831:2: note: did you mean 'crypto_aead_clear_flags'? include/crypto/aead.h:298:20: note: 'crypto_aead_clear_flags' declared here
298 | static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
| ^

Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:832:2: error: call to undeclared function 'crypto_sync_aead_set_flags'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     832 |         crypto_sync_aead_set_flags(ctx->aead_fb,
         |         ^
Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:836:9: error: call to undeclared function 'crypto_sync_aead_setkey'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     836 |         return crypto_sync_aead_setkey(ctx->aead_fb, key, keylen);
         |                ^

drivers/crypto/ti/dthev2-aes.c:836:9: note: did you mean 'crypto_aead_setkey'? include/crypto/aead.h:319:5: note: 'crypto_aead_setkey' declared here
319 | int crypto_aead_setkey(struct crypto_aead *tfm,
| ^

Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:846:9: error: call to undeclared function 'crypto_sync_aead_setauthsize'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     846 |         return crypto_sync_aead_setauthsize(ctx->aead_fb, authsize);
         |                ^
   drivers/crypto/ti/dthev2-aes.c:846:9: note: did you mean 'crypto_aead_setauthsize'?
   include/crypto/aead.h:332:5: note: 'crypto_aead_setauthsize' declared here
     332 | int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
         |     ^
Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:854:2: error: call to undeclared function 'SYNC_AEAD_REQUEST_ON_STACK'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |         ^
Quoted 1 line
Quoted 1 line

drivers/crypto/ti/dthev2-aes.c:854:29: error: use of undeclared identifier 'subreq'

     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |                                    ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:856:28: error: use of undeclared identifier 'subreq'
     856 |         aead_request_set_callback(subreq, req->base.flags,
         |                                   ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:858:25: error: use of undeclared identifier 'subreq'
     858 |         aead_request_set_crypt(subreq, req->src, req->dst, req->cryptlen, req->iv);
         |                                ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:859:22: error: use of undeclared identifier 'subreq'
     859 |         aead_request_set_ad(subreq, req->assoclen);
         |                             ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:861:41: error: use of undeclared identifier 'subreq'
     861 |         return rctx->enc ? crypto_aead_encrypt(subreq) :
         |                                                ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:862:23: error: use of undeclared identifier 'subreq'
     862 |                 crypto_aead_decrypt(subreq);
         |                                     ^~~~~~
Quoted 2 lines

14 errors generated.

All the errors are due to the patch [1] not being present in the applied tree. It should be fine when applied to cryptodev-2.6/master.

[1]:
https://lore.kernel.org/linux-crypto/[email protected]/

Signature · 2 lines
Regards
T Pratham <[email protected]>
#8 lore raw

Re: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver

In reply to T Pratham
kernel test robot noticed the following build warnings:

Hi Pratham,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-crypto-2.6/master]
[also build test WARNING on linus/master v6.18-rc5]
[cannot apply to herbert-cryptodev-2.6/master next-20251113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/T-Pratham/crypto-ti-Add-support-for-AES-XTS-in-DTHEv2-driver/20251111-192827
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git master
patch link:    https://lore.kernel.org/r/20251111112137.976121-4-t-pratham%40ti.com
patch subject: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver
config: s390-randconfig-002-20251114 (https://download.01.org/0day-ci/archive/20251114/[email protected]/config)
compiler: s390-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251114/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_init_tfm':
drivers/crypto/ti/dthev2-aes.c:573:24: error: implicit declaration of function 'crypto_alloc_sync_aead'; did you mean 'crypto_alloc_aead'? [-Werror=implicit-function-declaration]

     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                        ^~~~~~~~~~~~~~~~~~~~~~
         |                        crypto_alloc_aead
>> drivers/crypto/ti/dthev2-aes.c:573:22: warning: assignment to 'struct crypto_sync_aead *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                      ^
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_exit_tfm':
   drivers/crypto/ti/dthev2-aes.c:588:9: error: implicit declaration of function 'crypto_free_sync_aead'; did you mean 'crypto_free_aead'? [-Werror=implicit-function-declaration]
     588 |         crypto_free_sync_aead(ctx->aead_fb);
         |         ^~~~~~~~~~~~~~~~~~~~~
         |         crypto_free_aead
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_setkey':
   drivers/crypto/ti/dthev2-aes.c:831:9: error: implicit declaration of function 'crypto_sync_aead_clear_flags'; did you mean 'crypto_aead_clear_flags'? [-Werror=implicit-function-declaration]
     831 |         crypto_sync_aead_clear_flags(ctx->aead_fb, CRYPTO_TFM_REQ_MASK);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |         crypto_aead_clear_flags
   drivers/crypto/ti/dthev2-aes.c:832:9: error: implicit declaration of function 'crypto_sync_aead_set_flags'; did you mean 'crypto_aead_set_flags'? [-Werror=implicit-function-declaration]
     832 |         crypto_sync_aead_set_flags(ctx->aead_fb,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |         crypto_aead_set_flags
   drivers/crypto/ti/dthev2-aes.c:836:16: error: implicit declaration of function 'crypto_sync_aead_setkey'; did you mean 'crypto_aead_setkey'? [-Werror=implicit-function-declaration]
     836 |         return crypto_sync_aead_setkey(ctx->aead_fb, key, keylen);
         |                ^~~~~~~~~~~~~~~~~~~~~~~
         |                crypto_aead_setkey
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_setauthsize':
   drivers/crypto/ti/dthev2-aes.c:846:16: error: implicit declaration of function 'crypto_sync_aead_setauthsize'; did you mean 'crypto_aead_setauthsize'? [-Werror=implicit-function-declaration]
     846 |         return crypto_sync_aead_setauthsize(ctx->aead_fb, authsize);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                crypto_aead_setauthsize
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_do_fallback':
   drivers/crypto/ti/dthev2-aes.c:854:9: error: implicit declaration of function 'SYNC_AEAD_REQUEST_ON_STACK'; did you mean 'SYNC_SKCIPHER_REQUEST_ON_STACK'? [-Werror=implicit-function-declaration]
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |         SYNC_SKCIPHER_REQUEST_ON_STACK
   drivers/crypto/ti/dthev2-aes.c:854:36: error: 'subreq' undeclared (first use in this function)
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |                                    ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:854:36: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/crypto/ti/dthev2-aes.c:863:1: warning: control reaches end of non-void function [-Wreturn-type]
     863 | }
         | ^

cc1: some warnings being treated as errors

vim +573 drivers/crypto/ti/dthev2-aes.c

563
564 static int dthe_aead_init_tfm(struct crypto_aead *tfm)
565 {
566 struct dthe_tfm_ctx *ctx = crypto_aead_ctx(tfm);
567 struct dthe_data *dev_data = dthe_get_dev(ctx);
568
569 ctx->dev_data = dev_data;
570
571 const char *alg_name = crypto_tfm_alg_name(crypto_aead_tfm(tfm));
572

 > 573		ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,

574 CRYPTO_ALG_NEED_FALLBACK);
575 if (IS_ERR(ctx->aead_fb)) {
576 dev_err(dev_data->dev, "fallback driver %s couldn't be loaded\n",
577 alg_name);
578 return PTR_ERR(ctx->aead_fb);
579 }
580
581 return 0;
582 }
583

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

Re: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver

In reply to T Pratham
kernel test robot noticed the following build errors:

Hi Pratham,

kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-crypto-2.6/master]
[also build test ERROR on linus/master v6.18-rc5]
[cannot apply to herbert-cryptodev-2.6/master next-20251114] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/T-Pratham/crypto-ti-Add-support-for-AES-XTS-in-DTHEv2-driver/20251111-192827
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git master
patch link:    https://lore.kernel.org/r/20251111112137.976121-4-t-pratham%40ti.com
patch subject: [PATCH v6 3/4] crypto: ti - Add support for AES-GCM in DTHEv2 driver
config: s390-randconfig-002-20251114 (https://download.01.org/0day-ci/archive/20251114/[email protected]/config)
compiler: s390-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251114/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_init_tfm':

>> drivers/crypto/ti/dthev2-aes.c:573:24: error: implicit declaration of function 'crypto_alloc_sync_aead'; did you mean 'crypto_alloc_aead'? [-Werror=implicit-function-declaration]
     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                        ^~~~~~~~~~~~~~~~~~~~~~
         |                        crypto_alloc_aead
   drivers/crypto/ti/dthev2-aes.c:573:22: warning: assignment to 'struct crypto_sync_aead *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     573 |         ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
         |                      ^
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_exit_tfm':
>> drivers/crypto/ti/dthev2-aes.c:588:9: error: implicit declaration of function 'crypto_free_sync_aead'; did you mean 'crypto_free_aead'? [-Werror=implicit-function-declaration]
     588 |         crypto_free_sync_aead(ctx->aead_fb);
         |         ^~~~~~~~~~~~~~~~~~~~~
         |         crypto_free_aead
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_setkey':
>> drivers/crypto/ti/dthev2-aes.c:831:9: error: implicit declaration of function 'crypto_sync_aead_clear_flags'; did you mean 'crypto_aead_clear_flags'? [-Werror=implicit-function-declaration]
     831 |         crypto_sync_aead_clear_flags(ctx->aead_fb, CRYPTO_TFM_REQ_MASK);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |         crypto_aead_clear_flags
>> drivers/crypto/ti/dthev2-aes.c:832:9: error: implicit declaration of function 'crypto_sync_aead_set_flags'; did you mean 'crypto_aead_set_flags'? [-Werror=implicit-function-declaration]
     832 |         crypto_sync_aead_set_flags(ctx->aead_fb,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |         crypto_aead_set_flags
>> drivers/crypto/ti/dthev2-aes.c:836:16: error: implicit declaration of function 'crypto_sync_aead_setkey'; did you mean 'crypto_aead_setkey'? [-Werror=implicit-function-declaration]
     836 |         return crypto_sync_aead_setkey(ctx->aead_fb, key, keylen);
         |                ^~~~~~~~~~~~~~~~~~~~~~~
         |                crypto_aead_setkey
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_setauthsize':
>> drivers/crypto/ti/dthev2-aes.c:846:16: error: implicit declaration of function 'crypto_sync_aead_setauthsize'; did you mean 'crypto_aead_setauthsize'? [-Werror=implicit-function-declaration]
     846 |         return crypto_sync_aead_setauthsize(ctx->aead_fb, authsize);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                crypto_aead_setauthsize
   drivers/crypto/ti/dthev2-aes.c: In function 'dthe_aead_do_fallback':
>> drivers/crypto/ti/dthev2-aes.c:854:9: error: implicit declaration of function 'SYNC_AEAD_REQUEST_ON_STACK'; did you mean 'SYNC_SKCIPHER_REQUEST_ON_STACK'? [-Werror=implicit-function-declaration]
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |         SYNC_SKCIPHER_REQUEST_ON_STACK
>> drivers/crypto/ti/dthev2-aes.c:854:36: error: 'subreq' undeclared (first use in this function)
     854 |         SYNC_AEAD_REQUEST_ON_STACK(subreq, ctx->aead_fb);
         |                                    ^~~~~~
   drivers/crypto/ti/dthev2-aes.c:854:36: note: each undeclared identifier is reported only once for each function it appears in
   drivers/crypto/ti/dthev2-aes.c:863:1: warning: control reaches end of non-void function [-Wreturn-type]
     863 | }
         | ^

cc1: some warnings being treated as errors

vim +573 drivers/crypto/ti/dthev2-aes.c

563
564 static int dthe_aead_init_tfm(struct crypto_aead *tfm)
565 {
566 struct dthe_tfm_ctx *ctx = crypto_aead_ctx(tfm);
567 struct dthe_data *dev_data = dthe_get_dev(ctx);
568
569 ctx->dev_data = dev_data;
570
571 const char *alg_name = crypto_tfm_alg_name(crypto_aead_tfm(tfm));
572

 > 573		ctx->aead_fb = crypto_alloc_sync_aead(alg_name, 0,
   574						      CRYPTO_ALG_NEED_FALLBACK);
   575		if (IS_ERR(ctx->aead_fb)) {
   576			dev_err(dev_data->dev, "fallback driver %s couldn't be loaded\n",
   577				alg_name);
   578			return PTR_ERR(ctx->aead_fb);
   579		}
   580	
   581		return 0;
   582	}
   583	
   584	static void dthe_aead_exit_tfm(struct crypto_aead *tfm)
   585	{
   586		struct dthe_tfm_ctx *ctx = crypto_aead_ctx(tfm);
   587	
 > 588		crypto_free_sync_aead(ctx->aead_fb);

589 }
590

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#10 lore raw

PATCH v6 4/4 crypto: ti - Add support for AES-CCM in DTHEv2 driver

In reply to T Pratham

AES-CCM is an AEAD algorithm supporting both encryption and authentication of data. This patch introduces support for AES-CCM AEAD algorithm in the DTHEv2 driver.

---
 drivers/crypto/ti/Kconfig         |   1 +
 drivers/crypto/ti/dthev2-aes.c    | 129 ++++++++++++++++++++++++++----
 drivers/crypto/ti/dthev2-common.h |   1 +
 3 files changed, 115 insertions(+), 16 deletions(-)
drivers/crypto/ti/Kconfig +1 -0
index 221e483737439..1a3a571ac8cef 100644
@@ -9,6 +9,7 @@ config CRYPTO_DEV_TI_DTHEV2
 	select CRYPTO_CTR
 	select CRYPTO_XTS
 	select CRYPTO_GCM
+	select CRYPTO_CCM
 	select SG_SPLIT
 	help
 	  This enables support for the TI DTHE V2 hw cryptography engine
drivers/crypto/ti/dthev2-aes.c +113 -16

206 lines not on this page · raw message

drivers/crypto/ti/dthev2-common.h +1 -0
index 7c54291359bf5..3b8d30b3408a0 100644
@@ -39,6 +39,7 @@ enum dthe_aes_mode {
 	DTHE_AES_CTR,
 	DTHE_AES_XTS,
 	DTHE_AES_GCM,
+	DTHE_AES_CCM,
 };
 
 /* Driver specific struct definitions */
Signature · 1 line
2.43.0