summaryrefslogtreecommitdiff
path: root/drivers/crypto
AgeCommit message (Collapse)Author
24 hoursMerge branch 'master' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
3 daystreewide: refresh kmalloc_obj() conversionsKees Cook
This is another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci This catches both the set of kmalloc() uses added since the first kmalloc_obj() conversions in v7.0 and adds a large group missed in the first pass due to Coccinelle not interacting well with the cleanup.h scoped_...() family of macros[1]. I worked around this with spatch's "--macro-file" argument to a file with all the scoped_...() macros mapped to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control flow indicator I could find. Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc, riscv, and s390 with no new warnings. Link: https://lore.kernel.org/lkml/202609021314.8A9C0B8@keescook/ [1] Link: https://github.com/coccinelle/coccinelle/blob/master/standard.h [2] Signed-off-by: Kees Cook <kees+treewide@kernel.org>
4 dayscrypto: starfive - handle clock enable failuresJiawen Liu
Return error from failed clock enable. starfive_cryp_probe ignores clk_prepare_enable return for hclk/ahb, then remove/error paths unconditionally clk_disable_unprepare both clocks. Check consecutive clk_prepare_enable(cryp->hclk)/cryp->ahb returns in starfive_cryp_probe. Signed-off-by: Jiawen Liu <1298662399@qq.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: ccree - use crypto_memneq() to compare AEAD tagDavid C.C.M. Gall
cc_aead_complete() compares the computed MAC against the received ICV with memcmp(), which short-circuits on the first differing byte and leaks tag-match length via timing. Use crypto_memneq() instead. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: octeontx - use crypto_memneq() to check HMACDavid C.C.M. Gall
validate_hmac_cipher_null() compares the computed and received HMAC with memcmp(), which short-circuits on the first differing byte and leaks tag-match length via timing. Use crypto_memneq() instead. Because for cipher_null the validated payload is un-encrypted, this valid prefix leak allows for authenticated message forgery. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: octeontx2 - use crypto_memneq() to check HMAC for cipher_null authencDavid C.C.M. Gall
validate_hmac_cipher_null() compares the computed and received HMAC with memcmp(), which short-circuits on the first differing byte and leaks tag-match length via timing. Use crypto_memneq() instead. Because for cipher_null the validated payload is un-encrypted, this valid prefix leak allows for authenticated message forgery. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: qce - simplify control flow in register functionsThorsten Blum
Remove the goto statements and handle errors directly to simplify the control flow in qce_aead_register(), qce_ahash_register(), and qce_skcipher_register(). Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: crypto4xx - pass core_dev to request_irqRosen Penev
Instead of using a get_drvdata function to get the proper struct, just pass the proper thing directly. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: rockchip - pass crypto_info to irq handlerRosen Penev
The irq handler takes the platform device and calls platform_get_drvdata() to recover the driver data. Pass the driver data directly as the devm_request_irq() argument instead, dropping the platform_get_drvdata() call. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: s5p-sss - pass s5p_aes_dev to irq handlerRosen Penev
The threaded irq handler takes the platform device and calls platform_get_drvdata() to recover the driver data. Pass the driver data directly as the devm_request_threaded_irq() argument instead, dropping the platform_get_drvdata() call. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: crypto4xx - get irq and ioremap resource firstRosen Penev
These functions can return -EPROBE_DEFER and require no special setup other than the platform_device which is already provided. Avoids doing extra work when not needed. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: eip93 - Simplify the check for a valid AES keyThomas Huth
eip93_aead_setkey() currently uses aes_expandkey() to check for a valid AES key, but then does not use the crypto_aes_ctx afterwards anymore, i.e. this is just a wasteful way of checking the key length, and thus aes_check_keylen() should be used instead. This also fixes a potential leak of sensitive data via the stack, since this function forgot to zeroize crypto_aes_ctx before returning to the caller. Suggested-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: safexcel - zeroize crypto_aes_ctx with __cleanup(aes_zeroize_ctx)Thomas Huth
The code clears the crypto_aes_ctx in most cases already with memzero_explicit(), but safexcel_skcipher_aesxts_setkey() runs aes_expandkey() twice, and in case the second call fails, the context from the first call is leaked. To fix this issue and to avoid future similar problems, let's use the new __cleanup(aes_zeroize_ctx) mechanism to make sure that we always clear the crypto_aes_ctx in all cases. Acked-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: safexcel - Simplify the check for a valid AES keyThomas Huth
safexcel_aead_setkey() currently uses aes_expandkey() to check for a valid AES key, but then does not use the crypto_aes_ctx afterwards anymore, i.e. this is just a wasteful way of checking the key length, and thus aes_check_keylen() should be used instead. This also fixes a potential leak of sensitive data via the stack, since this function forgot to zeroize crypto_aes_ctx before returning to the caller. Suggested-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Acked-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: qat - zeroize crypto_aes_ctx with __cleanup(aes_zeroize_ctx)Thomas Huth
A recent patch by Giovanni Cabiddu already added a memzero_explicit() for the crypto_aes_ctx in the qat_alg_xts_reverse_key() function, but since we introduced __cleanup(aes_zeroize_ctx) markers in previous commits in many spots of the code already, let's use it here now, too, to have the same code pattern everywhere. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: sa2ul - clear the crypto_aes_ctx when doneThomas Huth
Clear the crypto_aes_ctx structure via __cleanup(aes_zeroize_ctx) when we're done with it to avoid that key data could leak on the stack. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: padlock-aes - clear the crypto_aes_ctx when doneThomas Huth
Clear the crypto_aes_ctx structure via __cleanup(aes_zeroize_ctx) when we're done with it to avoid that key data could leak on the stack. And since __cleanup() (and __free()) should not be mixed with "gotos" in the same function, turn the goto statement here into a proper block of the related if-statement. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
4 dayscrypto: aspeed - clear the crypto_aes_ctx when doneThomas Huth
Declare the gen_aes_key with __cleanup(aes_zeroize_ctx) to avoid that its contents could be leaking via the stack when the function returns. And since it is only required in one branch of the if-statement there, move it to that block, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-24Merge tag 'dmaengine-7.3-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine Pull dmaengine updates from Vinod Koul: "Core: - New API to combine configuration and preparation and users New hardware support: - Mediatek MT8189 SoC uart dma support Updates: - Designware dma driver flatten desc structures and simplify code, interrupt-path groundwork changes, first part of PCI EP DMA support - Updates to zynqmp_dma with runtime PM and device removal improvments - Xilinx dma optimizations for AXIDMA and MCDMA channel management" * tag 'dmaengine-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (73 commits) dmaengine: dw-edma: Mark emulated IRQ as level-triggered dmaengine: idxd: assign all engines to group 0 in IAA defaults dmaengine: qcom_hidma: remove conditional return with no effect dmaengine: qcom-bam-dma: fix autosuspend cleanup during removal dmaengine: fsl-edma: tracing: no ptr dereference during log output dmaengine: dw-edma: Program endpoint function numbers dmaengine: dw-edma-pcie: Add chip flags to match data dmaengine: dw-edma-pcie: Handle optional data blocks dmaengine: dw-edma-pcie: Factor out descriptor block address lookup dmaengine: dw-edma-pcie: Add register offset match flag dmaengine: dw-edma-pcie: Add platform ops to match data dmaengine: dw-edma-pcie: Rename vsec_data to dma_data dmaengine: dw-edma-pcie: Add capability match data dmaengine: dw-edma-pcie: Track non-LL mode in DMA data dmaengine: dw-edma: Add partial channel ownership mode dmaengine: dw-edma: Initialize IRQ data before requesting IRQs dmaengine: dw-edma: Add core quiesce operations dmaengine: dw-edma: Add per-channel interrupt routing control dmaengine: dw-edma: Factor out HDMA interrupt setup helper dmaengine: dw-edma: Defer channel IRQ handling to workqueue ...
2026-08-20Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds
Pull vhost,vdpa,virtio updates from Michael Tsirkin: - transport v3 support in virtio-mmio - suspend support in vduse - fixes, cleanups all over the place * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (54 commits) vduse: Add suspend vduse: do not take rwsem at reset work flush vduse: add F_QUEUE_READY feature vduse: add VDUSE_SET_FEATURES ioctl vduse: add VDUSE_GET_FEATURES ioctl vduse: store control device pointer tools/virtio: Fix control typo in trace agent comment tools/virtio: Fix userspace typo in vringh test comment vhost: reject zero-size IOTLB INVALIDATE vdpa: Remove redundant dev_err() virtio_ring: fix infinite loop in virtnet_poll_cleantx when device is broken vdpa/mlx5: roll back MR update after VQ setup failure MAINTAINERS: remove Gabriel from LiteX and fw-cfg drivers virtio_mem: fix typo in comment vdpa/solidrun: fix typos in snet_ctrl comments virtio: fix article before virtio in dma-buf comment vhost: fix inaccurate kdoc in iotlb helpers virtio: rtc: time out alarm requests vdpa/mlx5: fix wrong MLX5_ADDR_OF struct type in alloc_inout() vdpa: octeon_ep: add missing MODULE_DEVICE_TABLE() ...
2026-08-20Merge tag 'bitmap-for-7.3' of https://github.com/norov/linuxLinus Torvalds
Pull bitmap updates from Yury Norov: "The usual set of fixes, cleanups and performance improvements together with a couple of new tests: - bitmap_find_next_zero_area_off() optimization (Sunyi) - bitmap_find_next_zero_area_off(): return size when no zero area is found (Yury) - bitmap vs IDA vs Maple Tree performance test (Yury) - get rid of cpumap_print_to_pagebuf() (Yury) - use nr_node_ids in __nodemask_pr_numnodes() (Li RongQing) - bitops: make the *_bit_le functions use unsigned long (Benjamin) - bitmap scatter & gather test fix (Christophe) - use __ASSEMBLER__ in bitmap header files (Thomas)" * tag 'bitmap-for-7.3' of https://github.com/norov/linux: (25 commits) lib: test bitmap vs IDA vs Maple Tree performance for region allocations bitmap: Return size when no zero area is found media: s5p-mfc: Treat bitmap size as allocation failure crypto: ccp: Treat bitmap size as allocation failure powerpc/msi: Treat bitmap size as allocation failure ARM: dma-mapping: Treat bitmap size as allocation failure bitmap: drop bitmap_next_set_region() nodemask: reduce bitmap width to nr_node_ids in __nodemask_pr_numnodes() bitmap: Properly initialise destination bitmap for scatter & gather test lib/bitmap-str: get rid of cpumap_print_to_pagebuf() perf: Use sysfs_emit() for cpumask show callbacks PCI/sysfs: Use sysfs_emit() for cpumask show callbacks RDMA/hfi1: Use sysfs_emit() for cpumask show helper hwtracing: hisi_ptt: Use sysfs_emit() for cpumask show fpga: dfl-fme-perf: Use sysfs_emit() for cpumask show devfreq: Use sysfs_emit() for cpumask show callbacks cpu: Use sysfs_emit() for cpumask show callback x86/events: Use sysfs_emit() for cpumask show callbacks powerpc: Use sysfs_emit() for cpumask show callbacks arm: Use sysfs_emit() for cpumask show callbacks ...
2026-08-19Merge tag 'v7.3-p1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 Pull crypto update from Herbert Xu: "API: - Add af_alg_restrict sysctl and white list - Fix potential suspend/resume races in hwrng Algorithms: - Optimize vli additive operations using compiler builtins in ecc Drivers: - Remove unsafe/deprecated algorithms from qce - Mark qce as BROKEN - Add runtime PM and interconnect bandwidth scaling support to qce - Remove crypto_rng from qcom, sun8i and caam - Fix SG list issues in iaa - Fix SEV init path bugs in ccp" * tag 'v7.3-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (122 commits) crypto: lskcipher - propagate errors from unaligned crypt crypto: keembay - use crypto_memneq() to compare CCM AEAD tags crypto: keembay - use crypto_memneq() to compare GCM AEAD tags crypto: sa2ul - use crypto_memneq() to compare AEAD tag hwrng: drivers - use named initializers for acpi_device_id crypto: qce - fix CCM AAD buffer underallocation crypto: iaa - unmap dst before software fallback on decompress crypto: iaa - use bounce buffer for multi-sg decompress input crypto: iaa - avoid counting fallback decompression bytes crypto: iaa - fall back to software for multi-entry scatterlists hwrng: core - Stop/start hwrng_fillfn() kthread before/after suspend-resume crypto: hisilicon/sec2 - fix CCM algorithm long packet failure crypto: eip93 - use struct_size() and flexible array for ring allocation crypto: krb5 - use kfree_sensitive() for derived key buffers crypto: af_alg - Stop after finding name in allowlist crypto: af_alg - Replace 'bool privileged' with flags crypto: af_alg - Make cbc(paes) privileged-only hwrng: imx-rngc - Disable clock on registration failure crypto: qat - remove dead ADF_HEX code crypto: qce - simplify qce_handle_request ...
2026-08-19crypto: virtio - fix missing le64_to_cpu() conversionsBen Dooks
There are two cases of sending a __le64 type to a print function so fix this by adding le64_to_cpu() which fixes the following (prototype) sparse warnings: drivers/crypto/virtio/virtio_crypto_skcipher_algs.c:234:17: warning: incorrect type in argument 3 (different base types) drivers/crypto/virtio/virtio_crypto_skcipher_algs.c:234:17: expected unsigned long long drivers/crypto/virtio/virtio_crypto_skcipher_algs.c:234:17: got restricted __le64 [usertype] session_id drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:196:17: warning: incorrect type in argument 3 (different base types) drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:196:17: expected unsigned long long drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:196:17: got restricted __le64 [usertype] session_id Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Message-ID: <20260622150322.526375-1-ben.dooks@codethink.co.uk> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2026-08-19crypto: virtio - bound the akcipher result lengthBryam Vargas
virtio_crypto_dataq_akcipher_callback() sets the result length from the device-reported response length without bounding it to the destination buffer, which was allocated for the original request length. sg_copy_from_buffer() then reads that many bytes from the destination buffer; a backend reporting a larger length over-reads adjacent kernel heap into the caller's scatterlist (an out-of-bounds read). Clamp the reported length to the originally requested destination length. A conforming device reports no more than that, so valid results are unaffected. Fixes: a36bd0ad9fbf ("virtio-crypto: adjust dst_len at ops callback") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me> Message-ID: <20260622-b4-disp-3a2c09a8-v2-1-d1a809281db4@proton.me> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2026-08-17Merge tag 'vfs-7.3-rc1.kthread' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs Pull kthread vfs updates from Christian Brauner: "This stops kernel threads from sharing filesystem state with userspace. This work is about 3 cycles old and has been in -next for about that time. When the kernel boots init_task creates PID 1 and then kthreadd. From that point every kthread and PID 1 share the same fs_struct. That is why pivot_root() has to rewrite the fs_struct of all kthreads. The rewriting exists so that kthreads can use init's filesystem state when they want to. It also means userspace can move the ground out from under the kernel. PID 1 now gets a completely separate fs_struct. All kthreads are anchored in a private SB_KERNMOUNT instance of nullfs that cannot be mounted on and cannot be used to follow other mounts. Userspace init can no longer affect kthread filesystem state and kthreads can no longer affect userspace fs state without explicit opting in to that. Path lookup from a kthread now fails by default. It makes it deliberately hard to offload security sensitive operations into init's filesystem state from a kthread. Places that legitimately need to look something up there opt in through the new scoped_with_init_fs() which temporarily overrides the caller's fs_struct with init's. usermodehelpers remain the only kernel tasks that genuinely share init's filesystem state, since they execute random binaries in the root filesystem (excellent...). The visible result is that /proc/2/root is a nullfs with an empty mountinfo while /proc/1/root is the real root" * tag 'vfs-7.3-rc1.kthread' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (26 commits) initramfs_test: use test init/exit hooks to override init fs fs: stop rewriting paths for PF_EXITING | PF_DUMPCORE fs: stop rewriting kthread fs structs fs: start all kthreads in nullfs nullfs: make nullfs multi-instance devtmpfs: create private mount namespace fs: add umh argument to struct kernel_clone_args fs: stop sharing fs_struct between init_task and pid 1 af_unix: use scoped_with_init_fs() for coredump socket lookup initramfs: use scoped_with_init_fs() for rootfs unpacking pnfs/blocklayout: use scoped_with_init_fs() for SCSI device lookup ksmbd: use scoped_with_init_fs() for VFS path operations ksmbd: use scoped_with_init_fs() for filesystem info path lookup ksmbd: use scoped_with_init_fs() for share path resolution fs: use scoped_with_init_fs() for kernel_read_file_from_path_initns() coredump: use scoped_with_init_fs() for coredump path resolution btrfs: use scoped_with_init_fs() for update_dev_time() scsi: target: use scoped_with_init_fs() for APTPL metadata scsi: target: use scoped_with_init_fs() for ALUA metadata crypto: ccp: use scoped_with_init_fs() for SEV file access ...
2026-08-15crypto: keembay - use crypto_memneq() to compare CCM AEAD tagsDavid C.C.M. Gall
Use crypto_memneq() for constant-time comparison. The CCM path in ocs-aes.c verifes the received authentication tag with memcmp(), which returns early on the first mismatched byte. This leaks valid-prefix length and allows for valid tag forgery which violates the INT-CTXT guarantee of AEAD. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: keembay - use crypto_memneq() to compare GCM AEAD tagsDavid C.C.M. Gall
Use crypto_memneq() for constant-time comparison. The GCM path in keembay-ocs-aes-core.c verifes the received authentication tag with memcmp(), which returns early on the first mismatched byte. This leaks valid-prefix length and allows for valid tag forgery which violates the INT-CTXT guarantee of AEAD. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: sa2ul - use crypto_memneq() to compare AEAD tagDavid C.C.M. Gall
Use crypto_memneq() for a constant-time comparison. sa_aead_dma_in_callback() compares the computed authentication tag against the received tag with memcmp(), which short-circuits on the first differing byte. An attacker who can submit decrypt requests and observe completion latency could recover the expected tag byte by byte. Valid tag forgery for AEAD breaks the INT-CTXT guarantee. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall <david.ccm.gall@googlemail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: qce - fix CCM AAD buffer underallocationMd Sadre Alam
The AAD buffer allocated in qce_aead_ccm_prepare_buf_assoclen() can be smaller than the length later programmed into the DMA scatterlist. The allocation size is currently calculated as: ALIGN(assoclen, 16) + MAX_CCM_ADATA_HEADER_LEN while the DMA length is set to: ALIGN(assoclen + adata_header_len, 16) Since ALIGN() does not distribute over addition, the allocation can be smaller than the DMA length. For example, when assoclen = 32 and adata_header_len = 2: allocation = ALIGN(32, 16) + 6 = 38 DMA length = ALIGN(32 + 2, 16) = 48 As a result, the QCE hardware can read beyond the allocated buffer while computing the CBC-MAC over the associated data. The extra bytes are folded into the authentication tag, resulting in an incorrect tag and causing CCM self-test failures such as: alg: aead: ccm-aes-qce encryption test failed (wrong result) on test vector 8 Fix the allocation by adding the maximum possible AAD header length before alignment: ALIGN(assoclen + MAX_CCM_ADATA_HEADER_LEN, 16) This guarantees that the allocated buffer is large enough for the fully padded AAD data for all supported header sizes. Cc: stable@vger.kernel.org Fixes: 9363efb4181c ("crypto: qce - Add support for AEAD algorithms") Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: iaa - unmap dst before software fallback on decompressVinicius Costa Gomes
On a hardware analytics error, decompress retries through the software fallback, which writes req->dst with the CPU while it is still mapped DMA_FROM_DEVICE. With SWIOTLB active the later dma_unmap_sg() copies the stale bounce buffer over req->dst, corrupting the result. Unmap before the fallback runs. The async path unmaps inline; the sync path signals the retry with -EAGAIN so iaa_comp_adecompress() runs the fallback after unmapping. Fixes: 2ec6761df889 ("crypto: iaa - Add support for deflate-iaa compression algorithm") Cc: stable@vger.kernel.org Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: iaa - use bounce buffer for multi-sg decompress inputGiovanni Cabiddu
Since commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmalloc"), zswap passes the raw zsmalloc SG list directly to crypto drivers, so a compressed object spanning multiple pages reaches IAA as a multi-entry source. Such requests currently fall back to software decompression. As IAA hardware requires a single DMA source buffer, linearize small multi-entry sources into a pre-allocated bounce page and submit that to the hardware instead of falling back to software. Keep the software fallback only for multi-entry destinations. This recovers most of the performance lost by using the software fallback. Store the bounce-page state in the acomp request context alongside the existing compression CRC, free it through a shared source-unmap helper, and back the pages with a small module-wide mempool so the path remains available in reclaim-driven callers. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: iaa - avoid counting fallback decompression bytesGiovanni Cabiddu
When decompression falls back to deflate-generic after an analytics error, the request no longer completes through IAA. Move decompression byte accounting into the successful IAA completion path in both the synchronous and asynchronous flows so decomp_bytes only reflects bytes actually processed by IAA. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: iaa - fall back to software for multi-entry scatterlistsGiovanni Cabiddu
IAA cannot process source or destination scatterlists with more than one entry directly. Instead of failing these requests, route them through a separate deflate acomp transform and keep the request alive in software. The IAA driver has never handled multi-entry scatterlists, but the limitation was latent until commit e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmalloc") made zswap pass the raw zsmalloc SG list directly to crypto drivers, so objects spanning multiple pages now reach IAA as multi-entry sources and would otherwise fail decompression. Fallback to the generic DEFLATE implementation for scatterlists with more than one entry. After the multi-entry cases fall back early, simplify the DMA mapping path to a single scatterlist entry and fall back on mapping failure as well. Add counters to track the number of requests processed by the software implementation on the compression direction. Fixes: 2ec6761df889 ("crypto: iaa - Add support for deflate-iaa compression algorithm") Fixes: e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmalloc") Cc: stable@vger.kernel.org Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: hisilicon/sec2 - fix CCM algorithm long packet failureZhushuai Yin
In the CCM B0 block the message-length field Q spans L bytes, where L (cl in the driver) is derived from the cipher IV flags byte as c_ivin[0] + 1. set_aead_auth_iv() hardcoded writing only the last 2 bytes of a_ivin with cryptlen, implicitly assuming cl = 2. When cl = 3 (a shorter nonce yielding a 3-byte length field) and the packet is longer than 65535 bytes, cryptlen no longer fits in 2 bytes. The dropped high byte made the auth IV built by the driver differ from the one consumed by the hardware, so the software/hardware comparison failed and the CCM request errored out. Write the last cl bytes of a_ivin in a loop driven by the IV's CL value, so the length-field width always matches the algorithm configuration instead of assuming a fixed 2-byte field. Fixes: c16a70c1f253 ("crypto: hisilicon/sec - add new algorithm mode for AEAD") Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-15crypto: eip93 - use struct_size() and flexible array for ring allocationRosen Penev
Embed the single ring as a flexible array member in eip93_device instead of allocating it separately. This simplifies the probe path and uses struct_size() for a single allocation. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10Merge tag 'v7.2-p3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 Pull crypto fixes from Herbert Xu: - Fix lockdep warning regression in rhashtable - Fix default authsize in rfc4309 - Fix gcm cryptlen calculation in tegra - Fix qce registration error-path bug - Fix incorrect use of sg_dma_len before mapping in starfive - Allow cbc(paes) to be used with af_alg * tag 'v7.2-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: af_alg - Allow cbc(paes) crypto: starfive - use scatterlist length before DMA mapping crypto: qce - fix error path in devm_qce_register_algs rhashtable: fix false-positive lockdep splat on rhltable destruction crypto: tegra - fix rctx->cryptlen calculation in tegra_gcm_do_one_req() crypto: ccm - Set rfc4309 maxauthsize from child
2026-08-10crypto: qat - remove dead ADF_HEX codeAhsan Atta
The ADF_HEX value type is defined in the adf_cfg_val_type enum and handled in adf_cfg_add_key_value_param(), but no caller in the tree uses it. Remove the unused ADF_HEX enum value and its dead handling code. Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework") Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com> Signed-off-by: Ahsan Atta <ahsan.atta@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: qce - simplify qce_handle_requestThorsten Blum
Simplify the for loop's control flow and return the results directly. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: qce - simplify devm_qce_register_algsThorsten Blum
Drop the redundant ret = -ENODEV initialization. Use a while loop and reuse the local index variable i on the error path. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: caam - simplify probe resource and IRQ handlingRosen Penev
Convert the interrupt acquisition from irq_of_parse_and_map() to platform_get_irq(), which resolves the IRQ from the device's interrupts property via of_irq_get(). Flip the error check from testing for zero to testing for a negative errno, and drop the now-unused caam_jr_irq_dispose_mapping() callback and its devm_add_action_or_reset() cleanup, since platform_get_irq() manages the mapping internally. Replace the open-coded platform_get_resource() plus devm_ioremap() sequence with devm_platform_ioremap_resource(), which fetches the resource, requests the region and maps it in one call. Each fsl,sec-*-job-ring node has a distinct 0x10000 reg region and interrupts property, so the region reservation added by devm_ioremap_resource() is exclusive and does not introduce overlap failures. Assisted-by: opencode:hy3-free Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: amcc - fix racy teardown with devm_request_irqRosen Penev
The driver uses devm_request_irq() for the IRQ, but cleans up the tasklet and DMA rings inside the remove function. Since devres frees the IRQ only after the remove function returns, a window exists where a pending hardware interrupt can reschedule the tasklet after it has been killed, leading to use-after-free of the descriptor rings. Fix by switching to plain request_irq() and adding the corresponding free_irq() calls in the remove function and the probe error path before tasklet_kill(), ensuring the IRQ is fully torn down before the tasklet is killed. Rename goto error path to err_tasklet as that's more descriptive. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: cesa - clear cesa_dev on _removeRosen Penev
This is already done on probe failure. cesa_dev should be set to NULL as the driver checks that it is not and errors saying that only one device is authorized. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: qce - Add runtime PM and interconnect bandwidth scaling supportUdit Tiwari
The Qualcomm Crypto Engine (QCE) driver currently lacks support for runtime power management (PM) and interconnect bandwidth control. As a result, the hardware remains fully powered and clocks stay enabled even when the device is idle. Additionally, static interconnect bandwidth votes are held indefinitely, preventing the system from reclaiming unused bandwidth. Address this by enabling runtime PM and dynamic interconnect bandwidth scaling to allow the system to suspend the device when idle and scale interconnect usage based on actual demand. Improve overall system efficiency by reducing power usage and optimizing interconnect resource allocation. Signed-off-by: Udit Tiwari <udit.tiwari@oss.qualcomm.com> Tested-by: Pankaj Patil <pankaj.patil@oss.qualcomm.com> Signed-off-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: talitos - Use platform_get_irq() to retrieve interruptRosen Penev
Remove the need to call irq_dispose_mapping as needed by irq_of_parse_and_map(). Simplify the function as a result. No need for gotos anymore. Add a missing free_irq. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: atmel-ecc - drop redundant return variableThorsten Blum
In atmel_ecdh_generate_public_key(), drop the redundant return variable and return -EINVAL and 0 directly. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-08-10crypto: atmel-ecc - simplify control flow in atmel_ecdh_set_secretThorsten Blum
Free the public key directly on I2C transaction failure and remove the free_public_key label to simplify the code. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-07-31Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6Herbert Xu
Merge crypto tree to pick up the af_alg cbc(paes) patch. In the merge commit add cbc(paes) to the algorithm white-list.
2026-07-30crypto: drivers - remove conditional return with no effectSang-Heon Jeon
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly. This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci. Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-07-30crypto: octeontx - simplify get_{eng,ucode}_type_str helpersThorsten Blum
Remove the local variables, add default cases, and return the strings directly. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-07-30crypto: qce - drop redundant variable in qce_skcipher_doneThorsten Blum
Remove the local ret variable and return the result directly. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>