as I known, 6.6.23 has already fixed this, ...
I've now tested this on the lf-6.18.2-1.00 linux-imx kernel without the patches provided by @joanxie. The bug described above still exists in the latest official NXP release.
If there really is a fix, it was never included in the IMX releases.
I have now taken the time to integrate the patches provided in the support thread into the 6.6 kernel based on lf-6.6.52-2.2.2
The first thing that stands out is that the patch was created for a significantly older kernel, as symbols like “CRYPTO_TFM_RES_BAD_KEY_LEN” only exist up to kernel 5.5. Was the patch really created for the 8ULP and the problem described above?
Since the patch was obviously created for kernel 5.5, is the implementation it contains even compatible with the CAAM driver for 6.6.x or 6.18.x?
After implementing the patches in my kernel, I also noticed that the following assignment in the “tb_skcipher_setkey” function needs to be adjusted:
- struct caam_ctx *ctx = crypto_skcipher_ctx(skcipher);
+ struct caam_ctx *ctx = crypto_skcipher_ctx_dma(skcipher);
These changes allow jrdev to be obtained. Otherwise, you get a NULL pointer and thus NULL pointer exceptions in the kernel.
In addition, a function reference for .skipher.op.do_onerequest had to be added in “driver_algs”; otherwise, dm_crypt does not call tb_skcipher_setkey at all.
After all these changes, I can run `dmsetup create`, but I get an ICV error for every I/O operation on the `dev/mapper` device. Therefore, the patch does not seem to be working.
CAAM Errorcode: 0x20000a1a
Do i missing something?
@joanxie could you try the patches on the latest NXP release, or provide an update to the code for LF 6.6.x?
At least I can't get it to work this way.
Also, I’d be interested to know what happens during the CAAM suspension?
It seems as though the shared descriptor created by the skcipher_setkey() function is being lost. Can NXP confirm this?
A "umount" and "dmsetup remove" before suspend, and a new "dmsetup create" works just perfectly, so I assume this is an issue for the objects created in skcipher_setkey().
Is this a hardware bug in the processor, or is it simply a matter of forgetting to save and restore a state in the CAAM in driver-code?