]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
5 days agocrypto: xilinx - Fix inconsistant indentation
Harsh Jain [Tue, 27 Jan 2026 07:01:55 +0000 (12:31 +0530)] 
crypto: xilinx - Fix inconsistant indentation

Fix smatch inconsistant code warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601251908.baMDVVgW-lkp@intel.com/
Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
5 days agocrypto: rng - Use unregister_rngs in register_rngs
Thorsten Blum [Mon, 26 Jan 2026 17:50:18 +0000 (18:50 +0100)] 
crypto: rng - Use unregister_rngs in register_rngs

Replace the for loop with a call to crypto_unregister_rngs(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
5 days agocrypto: atmel - Use unregister_{aeads,ahashes,skciphers}
Thorsten Blum [Mon, 26 Jan 2026 17:47:03 +0000 (18:47 +0100)] 
crypto: atmel - Use unregister_{aeads,ahashes,skciphers}

Replace multiple for loops with calls to crypto_unregister_aeads(),
crypto_unregister_ahashes(), and crypto_unregister_skciphers().

Remove the definition of atmel_tdes_unregister_algs() because it is
equivalent to calling crypto_unregister_skciphers() directly, and the
function parameter 'struct atmel_tdes_dev *' is unused anyway.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
5 days agohwrng: optee - simplify OP-TEE context match
Rouven Czerwinski [Mon, 26 Jan 2026 10:11:25 +0000 (11:11 +0100)] 
hwrng: optee - simplify OP-TEE context match

Simplify the TEE implementor ID match by returning the boolean
expression directly instead of going through an if/else.

Signed-off-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
5 days agocrypto: ccp - Add sysfs attribute for boot integrity
Mario Limonciello [Fri, 23 Jan 2026 03:34:53 +0000 (21:34 -0600)] 
crypto: ccp - Add sysfs attribute for boot integrity

The boot integrity attribute represents that the CPU or APU is used for the
hardware root of trust in the boot process.  This bit only represents the
CPU/APU and some vendors have other hardware root of trust implementations
specific to their designs.

Link: https://github.com/fwupd/fwupd/pull/9825
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agodt-bindings: crypto: atmel,at91sam9g46-sha: add microchip,lan9691-sha
Robert Marko [Thu, 15 Jan 2026 11:37:30 +0000 (12:37 +0100)] 
dt-bindings: crypto: atmel,at91sam9g46-sha: add microchip,lan9691-sha

Document Microchip LAN969x SHA compatible.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agodt-bindings: crypto: atmel,at91sam9g46-aes: add microchip,lan9691-aes
Robert Marko [Thu, 15 Jan 2026 11:37:29 +0000 (12:37 +0100)] 
dt-bindings: crypto: atmel,at91sam9g46-aes: add microchip,lan9691-aes

Document Microchip LAN969x AES compatible.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agodt-bindings: crypto: qcom,inline-crypto-engine: document the Milos ICE
Luca Weiss [Mon, 12 Jan 2026 13:53:14 +0000 (14:53 +0100)] 
dt-bindings: crypto: qcom,inline-crypto-engine: document the Milos ICE

Document the Inline Crypto Engine (ICE) on the Milos SoC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: caam - fix netdev memory leak in dpaa2_caam_probe
Jianpeng Chang [Tue, 20 Jan 2026 01:55:24 +0000 (09:55 +0800)] 
crypto: caam - fix netdev memory leak in dpaa2_caam_probe

When commit 0e1a4d427f58 ("crypto: caam: Unembed net_dev structure in
dpaa2") converted embedded net_device to dynamically allocated pointers,
it added cleanup in dpaa2_dpseci_disable() but missed adding cleanup in
dpaa2_dpseci_free() for error paths.

This causes memory leaks when dpaa2_dpseci_dpio_setup() fails during probe
due to DPIO devices not being ready yet. The kernel's deferred probe
mechanism handles the retry successfully, but the netdevs allocated during
the failed probe attempt are never freed, resulting in kmemleak reports
showing multiple leaked netdev-related allocations all traced back to
dpaa2_caam_probe().

Fix this by preserving the CPU mask of allocated netdevs during setup and
using it for cleanup in dpaa2_dpseci_free(). This approach ensures that
only the CPUs that actually had netdevs allocated will be cleaned up,
avoiding potential issues with CPU hotplug scenarios.

Fixes: 0e1a4d427f58 ("crypto: caam: Unembed net_dev structure in dpaa2")
Signed-off-by: Jianpeng Chang <jianpeng.chang.cn@windriver.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/qm - increase wait time for mailbox
Weili Qian [Sat, 17 Jan 2026 10:18:06 +0000 (18:18 +0800)] 
crypto: hisilicon/qm - increase wait time for mailbox

The device requires more time to process queue stop and function stop
mailbox commands compared to other mailbox commands . In the current
driver, the mailbox processing wait time for queue stop and function
stop is less than the device timeout, which may cause the driver to
incorrectly assume that the mailbox processing has failed. Therefore,
the driver wait time for queue stop and function stop should be set to
be greater than the device timeout.  And PF and VF communication
relies on mailbox, the communication wait time should also be modified.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/qm - obtain the mailbox configuration at one time
Weili Qian [Sat, 17 Jan 2026 10:18:05 +0000 (18:18 +0800)] 
crypto: hisilicon/qm - obtain the mailbox configuration at one time

The malibox needs to be triggered by a 128bit atomic operation.
The reason is that the PF and VFs of the device share the mmio memory
of the mailbox, and the mutex cannot lock mailbox operations in
different functions, especially when passing through VFs to
virtual machines.

Currently, the write operation to the mailbox is already a 128-bit
atomic write. The read operation also needs to be modified to a
128-bit atomic read. Since there is no general 128-bit IO memory
access API in the current ARM64 architecture, and the stp and ldp
instructions do not guarantee atomic access to device memory, they
cannot be extracted as a general API. Therefore, the 128-bit atomic
read and write operations need to be implemented in the driver.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/qm - remove unnecessary code in qm_mb_write()
Weili Qian [Sat, 17 Jan 2026 10:18:04 +0000 (18:18 +0800)] 
crypto: hisilicon/qm - remove unnecessary code in qm_mb_write()

Since the HiSilicon accelerator is used only on the
ARM64 architectures, the implementations for other
architectures are not needed, so remove the unnecessary code.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/qm - move the barrier before writing to the mailbox register
Chenghai Huang [Sat, 17 Jan 2026 10:18:03 +0000 (18:18 +0800)] 
crypto: hisilicon/qm - move the barrier before writing to the mailbox register

Before sending the data via the mailbox to the hardware, to ensure
that the data accessed by the hardware is the most up-to-date,
a write barrier should be added before writing to the mailbox register.
The current memory barrier is placed after writing to the register,
the barrier order should be modified to be before writing to the register.

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/trng - support tfms sharing the device
Weili Qian [Sat, 17 Jan 2026 07:18:21 +0000 (15:18 +0800)] 
crypto: hisilicon/trng - support tfms sharing the device

Since the number of devices is limited, and the number
of tfms may exceed the number of devices, to ensure that
tfms can be successfully allocated, support tfms
sharing the same device.

Fixes: e4d9d10ef4be ("crypto: hisilicon/trng - add support for PRNG")
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: hisilicon/zip - add lz4 algorithm for hisi_zip
Chenghai Huang [Sat, 17 Jan 2026 02:34:35 +0000 (10:34 +0800)] 
crypto: hisilicon/zip - add lz4 algorithm for hisi_zip

Add the "hisi-lz4-acomp" algorithm by the crypto acomp. When the
8th bit of the capability register is 1, the lz4 algorithm will
register to crypto acomp, and the window length is configured to
16K by default.

Since the "hisi-lz4-acomp" currently only support compression
direction, decompression is completed by the soft lz4 algorithm.

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: s390/paes - Refuse clear key material by default
Harald Freudenberger [Thu, 15 Jan 2026 12:00:26 +0000 (13:00 +0100)] 
crypto: s390/paes - Refuse clear key material by default

This patch exploits the new xflag PKEY_XFLAG_NOCLEARKEY from the pkey
layer. So now by default all the paes algorithms refuse the use of
clear key material ("clear key tokens") in the setkey function with
-EINVAL.

With a new kernel module parameter "clrkey" this behavior can be
controlled. By default clrkey is 'N' but for testing purpose on module
load a true value (1, 'Y') may be given to accept clear key tokens.

Note that during selftest clear keys are always used and thus the
xflag PKEY_XFLAG_NOCLEARKEY is NOT set as long as the algorithm is in
a larval state indicated by crypto_skcipher_tested() returning false.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: s390/phmac - Refuse clear key material by default
Harald Freudenberger [Thu, 15 Jan 2026 12:00:25 +0000 (13:00 +0100)] 
crypto: s390/phmac - Refuse clear key material by default

This patch exploits the new xflag PKEY_XFLAG_NOCLEARKEY from the pkey
layer. So now by default the phmac refuses the use of clear key
material ("clear key tokens") in the setkey function with
-EINVAL.

With a new kernel module parameter "clrkey" this behavior can be
controlled. By default clrkey is 'N' but for testing purpose on module
load a true value (1, 'Y') may be given to accept clear key tokens.

Note that during selftest clear keys are always used and thus the
xflag PKEY_XFLAG_NOCLEARKEY is NOT set as long as the algorithm is in
a larval state indicated by crypto_ahash_tested() returning false.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agos390/pkey: Support new xflag PKEY_XFLAG_NOCLEARKEY
Harald Freudenberger [Thu, 15 Jan 2026 12:00:24 +0000 (13:00 +0100)] 
s390/pkey: Support new xflag PKEY_XFLAG_NOCLEARKEY

Introduce a new xflag PKEY_XFLAG_NOCLEARKEY which when given refuses
the conversion of "clear key tokens" to protected key material.

Some algorithms (PAES, PHMAC) have the need to construct "clear key
tokens" to be used during selftest. But in general these algorithms
should only support clear key material for testing purpose. So now the
algorithm implementation can signal via xflag PKEY_XFLAG_NOCLEARKEY
that a conversion of clear key material to protected key is not
acceptable and thus the pkey layer (usually one of the handler
modules) refuses clear key material with -EINVAL.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: skcipher - Add new helper function crypto_skcipher_tested
Harald Freudenberger [Thu, 15 Jan 2026 12:00:23 +0000 (13:00 +0100)] 
crypto: skcipher - Add new helper function crypto_skcipher_tested

Add a new helper function crypto_skcipher_tested() which evaluates
the CRYPTO_ALG_TESTED flag from the tfm base cra_flags field.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: stm32 - Replace min_t(size_t) with just min()
Thorsten Blum [Tue, 13 Jan 2026 08:31:28 +0000 (09:31 +0100)] 
crypto: stm32 - Replace min_t(size_t) with just min()

In most cases, min_t(size_t) and explicit casting are unnecessary
because the values ->hw_blocksize, ->payload_{in,out}, and ->header_in
are already of type 'size_t'. Use the simpler min() macro instead.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: virtio - Replace package id with numa node id
Bibo Mao [Tue, 13 Jan 2026 03:05:56 +0000 (11:05 +0800)] 
crypto: virtio - Replace package id with numa node id

With multiple virtio crypto devices supported with different NUMA
nodes, when crypto session is created, it will search virtio crypto
device with the same numa node of current CPU.

Here API topology_physical_package_id() is replaced with cpu_to_node()
since package id is physical concept, and one package id have multiple
memory numa id.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: virtio - Remove duplicated virtqueue_kick in virtio_crypto_skcipher_crypt_req
Bibo Mao [Tue, 13 Jan 2026 03:05:55 +0000 (11:05 +0800)] 
crypto: virtio - Remove duplicated virtqueue_kick in virtio_crypto_skcipher_crypt_req

With function virtio_crypto_skcipher_crypt_req(), there is already
virtqueue_kick() call with spinlock held in function
__virtio_crypto_skcipher_do_req(). Remove duplicated virtqueue_kick()
function call here.

Fixes: d79b5d0bbf2e ("crypto: virtio - support crypto engine framework")
Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
11 days agocrypto: virtio - Add spinlock protection with virtqueue notification
Bibo Mao [Tue, 13 Jan 2026 03:05:54 +0000 (11:05 +0800)] 
crypto: virtio - Add spinlock protection with virtqueue notification

When VM boots with one virtio-crypto PCI device and builtin backend,
run openssl benchmark command with multiple processes, such as
  openssl speed -evp aes-128-cbc -engine afalg  -seconds 10 -multi 32

openssl processes will hangup and there is error reported like this:
 virtio_crypto virtio0: dataq.0:id 3 is not a head!

It seems that the data virtqueue need protection when it is handled
for virtio done notification. If the spinlock protection is added
in virtcrypto_done_task(), openssl benchmark with multiple processes
works well.

Fixes: fed93fb62e05 ("crypto: virtio - Handle dataq logic with tasklet")
Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 days agocrypto: inside-secure/eip93 - unregister only available algorithm
Aleksander Jan Bajkowski [Sun, 11 Jan 2026 13:20:32 +0000 (14:20 +0100)] 
crypto: inside-secure/eip93 - unregister only available algorithm

EIP93 has an options register. This register indicates which crypto
algorithms are implemented in silicon. Supported algorithms are
registered on this basis. Unregister algorithms on the same basis.
Currently, all algorithms are unregistered, even those not supported
by HW. This results in panic on platforms that don't have all options
implemented in silicon.

Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Acked-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 days agocrypto: ccp - Fix a crash due to incorrect cleanup usage of kfree
Ella Ma [Fri, 9 Jan 2026 15:17:24 +0000 (16:17 +0100)] 
crypto: ccp - Fix a crash due to incorrect cleanup usage of kfree

Annotating a local pointer variable, which will be assigned with the
kmalloc-family functions, with the `__cleanup(kfree)` attribute will
make the address of the local variable, rather than the address returned
by kmalloc, passed to kfree directly and lead to a crash due to invalid
deallocation of stack address. According to other places in the repo,
the correct usage should be `__free(kfree)`. The code coincidentally
compiled because the parameter type `void *` of kfree is compatible with
the desired type `struct { ... } **`.

Fixes: a71475582ada ("crypto: ccp - reduce stack usage in ccp_run_aes_gcm_cmd")
Signed-off-by: Ella Ma <alansnape3058@gmail.com>
Acked-by: Tom Lendacky <thomas.lendacky@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 days agocrypto: stm32 - Remove unnecessary checks before calling memcpy
Thorsten Blum [Fri, 9 Jan 2026 14:20:36 +0000 (15:20 +0100)] 
crypto: stm32 - Remove unnecessary checks before calling memcpy

memcpy() can be safely called with size 0, which is a no-op. Remove the
unnecessary checks before calling memcpy().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 days agocrypto: omap - Use sysfs_emit in sysfs show functions
Thorsten Blum [Fri, 9 Jan 2026 12:36:40 +0000 (13:36 +0100)] 
crypto: omap - Use sysfs_emit in sysfs show functions

Replace sprintf() with sysfs_emit() in sysfs show functions.
sysfs_emit() is preferred to format sysfs output as it provides better
bounds checking.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: ecc - Streamline alloc_point and remove {alloc,free}_digits_space
Thorsten Blum [Mon, 5 Jan 2026 22:21:53 +0000 (23:21 +0100)] 
crypto: ecc - Streamline alloc_point and remove {alloc,free}_digits_space

Check 'ndigits' before allocating 'struct ecc_point' to return early if
needed. Inline the code from and remove ecc_alloc_digits_space() and
ecc_free_digits_space(), respectively.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agohwrng: airoha - set rng quality to 900
Aleksander Jan Bajkowski [Mon, 5 Jan 2026 20:41:49 +0000 (21:41 +0100)] 
hwrng: airoha - set rng quality to 900

Airoha uses RAW mode to collect noise from the TRNG. These appear to
be unprocessed oscillations from the tero loop. For this reason, they
do not have a perfect distribution and entropy. Simple noise compression
reduces its size by 9%, so setting the quality to 900 seems reasonable.
The same value is used by the downstream driver.

Compare the size before and after compression:
$ ls -l random_airoha*
-rw-r--r-- 1 aleksander aleksander 76546048 Jan  3 23:43 random_airoha
-rw-rw-r-- 1 aleksander aleksander 69783562 Jan  5 20:23 random_airoha.zip

FIPS test results:
$ cat random_airoha | rngtest -c 10000
rngtest 2.6
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 200000032
rngtest: FIPS 140-2 successes: 0
rngtest: FIPS 140-2 failures: 10000
rngtest: FIPS 140-2(2001-10-10) Monobit: 9957
rngtest: FIPS 140-2(2001-10-10) Poker: 10000
rngtest: FIPS 140-2(2001-10-10) Runs: 10000
rngtest: FIPS 140-2(2001-10-10) Long run: 4249
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=953.674; avg=27698.935; max=19073.486)Mibits/s
rngtest: FIPS tests speed: (min=59.791; avg=298.028; max=328.853)Mibits/s
rngtest: Program run time: 647638 microseconds

In general, these data look like real noise, but with lower entropy
than expected.

Fixes: e53ca8efcc5e ("hwrng: airoha - add support for Airoha EN7581 TRNG")
Suggested-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: ccp - narrow scope of snp_range_list
Tycho Andersen (AMD) [Mon, 5 Jan 2026 17:22:18 +0000 (10:22 -0700)] 
crypto: ccp - narrow scope of snp_range_list

snp_range_list is only used in __sev_snp_init_locked() in the SNP_INIT_EX
case, move the declaration there and add a __free() cleanup helper for it
instead of waiting until shutdown.

Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: ccp - Fix a case where SNP_SHUTDOWN is missed
Tom Lendacky [Mon, 5 Jan 2026 17:22:17 +0000 (10:22 -0700)] 
crypto: ccp - Fix a case where SNP_SHUTDOWN is missed

If page reclaim fails in sev_ioctl_do_snp_platform_status() and SNP was
moved from UNINIT to INIT for the function, SNP is not moved back to
UNINIT state. Additionally, SNP is not required to be initialized in order
to execute the SNP_PLATFORM_STATUS command, so don't attempt to move to
INIT state and let SNP_PLATFORM_STATUS report the status as is.

Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Tycho Andersen (AMD) <tycho@kernel.org>
Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: nx - Simplify with scoped for each OF child loop
Krzysztof Kozlowski [Fri, 2 Jan 2026 12:50:12 +0000 (13:50 +0100)] 
crypto: nx - Simplify with scoped for each OF child loop

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: testmgr - allow authenc(sha224,rfc3686) variant in fips mode
Aleksander Jan Bajkowski [Thu, 1 Jan 2026 15:25:18 +0000 (16:25 +0100)] 
crypto: testmgr - allow authenc(sha224,rfc3686) variant in fips mode

The remaining combinations of AES-CTR-RFC3686 and SHA* have already been
marked as allowed in 8888690ef5f7. This commit does the same for SHA224.

rfc3686(ctr(aes)) is already marked fips compliant,
so these should be fine.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: inside-secure/eip93 - fix kernel panic in driver detach
Aleksander Jan Bajkowski [Tue, 30 Dec 2025 21:17:17 +0000 (22:17 +0100)] 
crypto: inside-secure/eip93 - fix kernel panic in driver detach

During driver detach, the same hash algorithm is unregistered multiple
times due to a wrong iterator.

Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: ccp - Use NULL instead of plain 0
Herbert Xu [Mon, 29 Dec 2025 00:48:09 +0000 (08:48 +0800)] 
crypto: ccp - Use NULL instead of plain 0

Use NULL instead of 0 as the null pointer.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: blowfish - fix typo in comment
Alexander Bendezu [Sun, 28 Dec 2025 00:01:01 +0000 (00:01 +0000)] 
crypto: blowfish - fix typo in comment

Fix spelling mistake in comment: endianess -> endianness

Signed-off-by: Alexander Bendezu <alexanderbendezu10@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agopadata: Constify padata_sysfs_entry structs
Thomas Weißschuh [Fri, 26 Dec 2025 16:03:18 +0000 (17:03 +0100)] 
padata: Constify padata_sysfs_entry structs

These structs are never modified.

To prevent malicious or accidental modifications due to bugs,
mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: api - remove unnecessary forward declarations
Thorsten Blum [Mon, 22 Dec 2025 10:44:55 +0000 (11:44 +0100)] 
crypto: api - remove unnecessary forward declarations

Add the __maybe_unused attribute to the function definitions and remove
the now-unnecessary forward declarations.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: simd - Simplify request size calculation in simd_aead_init
Thorsten Blum [Mon, 22 Dec 2025 10:42:53 +0000 (11:42 +0100)] 
crypto: simd - Simplify request size calculation in simd_aead_init

Fold both assignments into a single max() call to simplify the code.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Add gcm(aes) support for AMD/Xilinx Versal device
Harsh Jain [Sat, 20 Dec 2025 15:59:05 +0000 (21:29 +0530)] 
crypto: xilinx - Add gcm(aes) support for AMD/Xilinx Versal device

Add gcm(aes) algorithm support for AMD/Xilinx Versal devices.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Remove un-necessary typecast operation
Harsh Jain [Sat, 20 Dec 2025 15:59:04 +0000 (21:29 +0530)] 
crypto: xilinx - Remove un-necessary typecast operation

Return type of crypto_tfm_ctx() is void *. Remove explicit type cast.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agofirmware: xilinx: Add firmware API's to support aes-gcm in Versal device
Harsh Jain [Sat, 20 Dec 2025 15:59:03 +0000 (21:29 +0530)] 
firmware: xilinx: Add firmware API's to support aes-gcm in Versal device

Add aes-gcm crypto API's for AMD/Xilinx Versal device.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Change coherent DMA to streaming DMA API
Harsh Jain [Sat, 20 Dec 2025 15:59:02 +0000 (21:29 +0530)] 
crypto: xilinx - Change coherent DMA to streaming DMA API

Update the driver to use streaming DMA API.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Replace zynqmp prefix with xilinx
Harsh Jain [Sat, 20 Dec 2025 15:59:01 +0000 (21:29 +0530)] 
crypto: xilinx - Replace zynqmp prefix with xilinx

Replace zynqmp with xilinx to have more generic name.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Register H/W key support with paes
Harsh Jain [Sat, 20 Dec 2025 15:59:00 +0000 (21:29 +0530)] 
crypto: xilinx - Register H/W key support with paes

Register gcm(paes) for hardware supported keys.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Avoid submitting fallback requests to engine
Harsh Jain [Sat, 20 Dec 2025 15:58:59 +0000 (21:28 +0530)] 
crypto: xilinx - Avoid submitting fallback requests to engine

Don't enqueue requests which are supposed to fallback to s/w crypto.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Avoid Encrypt request to fallback for authsize < 16
Harsh Jain [Sat, 20 Dec 2025 15:58:58 +0000 (21:28 +0530)] 
crypto: xilinx - Avoid Encrypt request to fallback for authsize < 16

Encrypt requests can be handled by driver when authsize is less than 16.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Return linux error code instead of firmware error code
Harsh Jain [Sat, 20 Dec 2025 15:58:57 +0000 (21:28 +0530)] 
crypto: xilinx - Return linux error code instead of firmware error code

Convert FW error code to linux error code and remove dmesg error print for
authentication tag mismatch failure.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Update probe to self discover the device
Harsh Jain [Sat, 20 Dec 2025 15:58:56 +0000 (21:28 +0530)] 
crypto: xilinx - Update probe to self discover the device

Update driver to self discover the device.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agodt-bindings: crypto: Mark zynqmp-aes as Deprecated
Harsh Jain [Sat, 20 Dec 2025 15:58:55 +0000 (21:28 +0530)] 
dt-bindings: crypto: Mark zynqmp-aes as Deprecated

zynqmp-aes-gcm updated to self discover, corresponding dt binding
can be mark deprecated.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agofirmware: zynqmp: Add helper API to self discovery the device
Harsh Jain [Sat, 20 Dec 2025 15:58:54 +0000 (21:28 +0530)] 
firmware: zynqmp: Add helper API to self discovery the device

Add API to get SoC version and family info.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: xilinx - Remove union from zynqmp_aead_drv_ctx
Harsh Jain [Sat, 20 Dec 2025 15:58:53 +0000 (21:28 +0530)] 
crypto: xilinx - Remove union from zynqmp_aead_drv_ctx

"alg" in zynqmp_aead_drv_ctx is single field union variable.
Remove unnecessary alg union from structure.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agofirmware: zynqmp: Move crypto API's to separate file
Harsh Jain [Sat, 20 Dec 2025 15:58:52 +0000 (21:28 +0530)] 
firmware: zynqmp: Move crypto API's to separate file

For better maintainability move crypto related API's to
new zynqmp-crypto.c file.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers}
Thorsten Blum [Fri, 19 Dec 2025 14:51:22 +0000 (15:51 +0100)] 
crypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers}

Replace the for loops with calls to unregister_aeads(),
unregister_ahashes(), and unregister_skciphers(), respectively. Return
'ret' immediately and remove the goto statements to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: lskcipher - Use unregister_lskciphers in register_lskciphers
Thorsten Blum [Fri, 19 Dec 2025 14:51:21 +0000 (15:51 +0100)] 
crypto: lskcipher - Use unregister_lskciphers in register_lskciphers

Replace the for loop with a call to crypto_unregister_lskciphers().
Return 'ret' immediately and remove the goto statement to simplify the
error handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: skcipher - Use unregister_skciphers in register_skciphers
Thorsten Blum [Fri, 19 Dec 2025 14:51:20 +0000 (15:51 +0100)] 
crypto: skcipher - Use unregister_skciphers in register_skciphers

Replace the for loop with a call to crypto_unregister_skciphers().
Return 'ret' immediately and remove the goto statement to simplify the
error handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: shash - Use unregister_shashes in register_shashes
Thorsten Blum [Fri, 19 Dec 2025 14:51:19 +0000 (15:51 +0100)] 
crypto: shash - Use unregister_shashes in register_shashes

Replace the for loop with a call to crypto_unregister_shashes(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: ahash - Use unregister_ahashes in register_ahashes
Thorsten Blum [Fri, 19 Dec 2025 14:51:18 +0000 (15:51 +0100)] 
crypto: ahash - Use unregister_ahashes in register_ahashes

Replace the for loop with a call to crypto_unregister_ahashes(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2 weeks agocrypto: acomp - Use unregister_acomps in register_acomps
Thorsten Blum [Fri, 19 Dec 2025 14:51:17 +0000 (15:51 +0100)] 
crypto: acomp - Use unregister_acomps in register_acomps

Replace the for loop with a call to crypto_unregister_acomps(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/sgl - fix inconsistent map/unmap direction issue
Chenghai Huang [Fri, 19 Dec 2025 03:36:19 +0000 (11:36 +0800)] 
crypto: hisilicon/sgl - fix inconsistent map/unmap direction issue

Ensure that the direction for dma_map_sg and dma_unmap_sg is
consistent.

Fixes: 2566de3e06a3 ("crypto: hisilicon - Use fine grained DMA mapping direction")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/sec2 - support skcipher/aead fallback for hardware queue unavailable
Qi Tao [Thu, 18 Dec 2025 13:44:52 +0000 (21:44 +0800)] 
crypto: hisilicon/sec2 - support skcipher/aead fallback for hardware queue unavailable

When all hardware queues are busy and no shareable queue,
new processes fail to apply for queues. To avoid affecting
tasks, support fallback mechanism when hardware queues are
unavailable.

Fixes: c16a70c1f253 ("crypto: hisilicon/sec - add new algorithm mode for AEAD")
Signed-off-by: Qi Tao <taoqi10@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/hpre - support the hpre algorithm fallback
Weili Qian [Thu, 18 Dec 2025 13:44:51 +0000 (21:44 +0800)] 
crypto: hisilicon/hpre - support the hpre algorithm fallback

When all hardware queues are busy and no shareable queue,
new processes fail to apply for queues. To avoid affecting
tasks, support fallback mechanism when hardware queues are
unavailable.

HPRE driver supports DH algorithm, limited to prime numbers up to 4K.
It supports prime numbers larger than 4K via fallback mechanism.

Fixes: 05e7b906aa7c ("crypto: hisilicon/hpre - add 'ECDH' algorithm")
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/zip - support fallback for zip
Chenghai Huang [Thu, 18 Dec 2025 13:44:50 +0000 (21:44 +0800)] 
crypto: hisilicon/zip - support fallback for zip

When the hardware queue resource busy(no shareable queue)
or memery alloc fail in initialization of acomp_alg, use
soft algorithm to complete the work.

Fixes: 1a9e6f59caee ("crypto: hisilicon/zip - remove zlib and gzip")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/qm - optimize device selection priority based on queue ref count...
Chenghai Huang [Thu, 18 Dec 2025 13:44:49 +0000 (21:44 +0800)] 
crypto: hisilicon/qm - optimize device selection priority based on queue ref count and NUMA distance

Add device sorting criteria to prioritize devices with fewer
references and closer NUMA distances. Devices that are fully
occupied will not be prioritized for use.

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/qm - add reference counting to queues for tfm kernel reuse
Chenghai Huang [Thu, 18 Dec 2025 13:44:48 +0000 (21:44 +0800)] 
crypto: hisilicon/qm - add reference counting to queues for tfm kernel reuse

Add reference counting to queues. When all queues are occupied, tfm
will reuse queues with the same algorithm type that have already
been allocated in the kernel. The corresponding queue will be
released when the reference count reaches 1.

Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon - consolidate qp creation and start in hisi_qm_alloc_qps_node
Chenghai Huang [Thu, 18 Dec 2025 13:44:47 +0000 (21:44 +0800)] 
crypto: hisilicon - consolidate qp creation and start in hisi_qm_alloc_qps_node

Consolidate the creation and start of qp into the function
hisi_qm_alloc_qps_node. This change eliminates the need for
each module to perform these steps in two separate phases
(creation and start).

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/qm - centralize the sending locks of each module into qm
Chenghai Huang [Thu, 18 Dec 2025 13:44:46 +0000 (21:44 +0800)] 
crypto: hisilicon/qm - centralize the sending locks of each module into qm

When a single queue used by multiple tfms, the protection of shared
resources by individual module driver programs is no longer
sufficient. The hisi_qp_send needs to be ensured by the lock in qp.

Fixes: 5fdb4b345cfb ("crypto: hisilicon - add a lock for the qp send operation")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/qm - enhance the configuration of req_type in queue attributes
Chenghai Huang [Thu, 18 Dec 2025 13:44:45 +0000 (21:44 +0800)] 
crypto: hisilicon/qm - enhance the configuration of req_type in queue attributes

Originally, when a queue was requested, it could only be configured
with the default algorithm type of 0. Now, when multiple tfms use
the same queue, the queue must be selected based on its attributes
to meet the requirements of tfm tasks. So the algorithm type
attribute of queue need to be distinguished. Just like a queue used
for compression in ZIP cannot be used for decompression tasks.

Fixes: 3f1ec97aacf1 ("crypto: hisilicon/qm - Put device finding logic into QM")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/hpre: extend tag field to 64 bits for better performance
lizhi [Thu, 18 Dec 2025 13:44:44 +0000 (21:44 +0800)] 
crypto: hisilicon/hpre: extend tag field to 64 bits for better performance

This commit expands the tag field in hpre_sqe structure from 16-bit
to 64-bit. The change enables storing request addresses directly
in the tag field, allowing callback functions to access request messages
without the previous indirection mechanism.

By eliminating the need for lookup tables, this modification reduces lock
contention and associated overhead, leading to improved efficiency and
simplified code.

Fixes: c8b4b477079d ("crypto: hisilicon - add HiSilicon HPRE accelerator")
Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/sec - move backlog management to qp and store sqe in qp for callback
Chenghai Huang [Thu, 18 Dec 2025 13:44:43 +0000 (21:44 +0800)] 
crypto: hisilicon/sec - move backlog management to qp and store sqe in qp for callback

When multiple tfm use a same qp, the backlog data should be managed
centrally by the qp, rather than in the qp_ctx of each req.

Additionally, since SEC_BD_TYPE1 and SEC_BD_TYPE2 cannot use the
tag of the sqe to carry the virtual address of the req, the sent
sqe is stored in the qp. This allows the callback function to get
the req address. To handle the differences between hardware types,
the callback functions are split into two separate implementations.

Fixes: f0ae287c5045 ("crypto: hisilicon/sec2 - implement full backlog mode for sec")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: hisilicon/zip - adjust the way to obtain the req in the callback function
Chenghai Huang [Thu, 18 Dec 2025 13:44:42 +0000 (21:44 +0800)] 
crypto: hisilicon/zip - adjust the way to obtain the req in the callback function

In the shared queue design, multiple tfms use same qp, and one qp
need to corresponds to multiple qp_ctx. So use tag to obtain the
req virtual address. Build a one-to-one relationship between tfm
and qp_ctx. finaly remove the old get_tag operation.

Fixes: 2bcf36348ce5 ("crypto: hisilicon/zip - initialize operations about 'sqe' in 'acomp_alg.init'")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: octeontx - fix dma_free_coherent() size
Thomas Fourier [Thu, 18 Dec 2025 10:12:57 +0000 (11:12 +0100)] 
crypto: octeontx - fix dma_free_coherent() size

The size of the buffer in alloc_command_queues() is
curr->size + OTX_CPT_NEXT_CHUNK_PTR_SIZE, so used that length for
dma_free_coherent().

Fixes: 10b4f09491bf ("crypto: marvell - add the Virtual Function driver for CPT")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
3 weeks agocrypto: cavium - fix dma_free_coherent() size
Thomas Fourier [Thu, 18 Dec 2025 09:56:45 +0000 (10:56 +0100)] 
crypto: cavium - fix dma_free_coherent() size

The size of the buffer in alloc_command_queues() is
curr->size + CPT_NEXT_CHUNK_PTR_SIZE, so used that length for
dma_free_coherent().

Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: drbg - make drbg_get_random_bytes() return *void*
Sergey Shtylyov [Wed, 17 Dec 2025 20:21:45 +0000 (23:21 +0300)] 
crypto: drbg - make drbg_get_random_bytes() return *void*

Now that drbg_get_random_bytes() always returns 0, checking its result at
the call sites stopped to make sense -- make this function return *void*
instead of *int*...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: drbg - make drbg_fips_continuous_test() return bool
Sergey Shtylyov [Wed, 17 Dec 2025 20:21:44 +0000 (23:21 +0300)] 
crypto: drbg - make drbg_fips_continuous_test() return bool

Currently, drbg_fips_continuous_test() only returns 0 and -EAGAIN, so an
early return from the *do*/*while* loop in drbg_get_random_bytes() just
isn't possible. Make drbg_fips_continuous_test() return bool instead of
*int* (using true instead of 0 and false instead of -EAGAIN). This way,
we can further simplify drbg_get_random_bytes()...

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: drbg - kill useless variable in drbg_fips_continuous_test()
Sergey Shtylyov [Wed, 17 Dec 2025 20:21:43 +0000 (23:21 +0300)] 
crypto: drbg - kill useless variable in drbg_fips_continuous_test()

In drbg_fips_continuous_test(), not only the initializer of the ret local
variable is useless, the variable itself does not seem needed as it only
stores the result of memcmp() until it's checked on the next line -- get
rid of the variable...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: khazad - simplify return statement in khazad_mod_init
Thorsten Blum [Tue, 16 Dec 2025 14:55:35 +0000 (15:55 +0100)] 
crypto: khazad - simplify return statement in khazad_mod_init

Return the result of calling crypto_register_alg() directly and remove
the local return variable.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: octeontx2 - Use sysfs_emit in sysfs show functions
Thorsten Blum [Mon, 15 Dec 2025 12:26:05 +0000 (13:26 +0100)] 
crypto: octeontx2 - Use sysfs_emit in sysfs show functions

Replace sprintf() with sysfs_emit() in sso_pf_func_ovrd_show() and
kvf_limits_show(). sysfs_emit() is preferred for formatting sysfs output
as it performs proper bounds checking.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 weeks agocrypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions
Thorsten Blum [Mon, 15 Dec 2025 07:23:52 +0000 (08:23 +0100)] 
crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions

Replace sprintf() with sysfs_emit() in verify_compress_show() and
sync_mode_show(). sysfs_emit() is preferred to format sysfs output as it
provides better bounds checking.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: algapi - Use crypto_unregister_algs in crypto_register_algs
Thorsten Blum [Thu, 11 Dec 2025 10:15:55 +0000 (11:15 +0100)] 
crypto: algapi - Use crypto_unregister_algs in crypto_register_algs

Replace the for loop with a call to crypto_unregister_algs(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.

In crypto_unregister_algs(), unregister the algorithms in reverse order.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps
Thorsten Blum [Thu, 11 Dec 2025 08:52:51 +0000 (09:52 +0100)] 
crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps

Replace the for loop with a call to crypto_unregister_scomps(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agodt-bindings: crypto: qcom,prng: document x1e80100
Harshal Dev [Thu, 11 Dec 2025 08:44:59 +0000 (14:14 +0530)] 
dt-bindings: crypto: qcom,prng: document x1e80100

Document x1e80100 compatible for the True Random Number Generator.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: scompress - Remove forward declaration of crypto_scomp_show
Thorsten Blum [Tue, 9 Dec 2025 15:30:43 +0000 (16:30 +0100)] 
crypto: scompress - Remove forward declaration of crypto_scomp_show

Add the __maybe_unused attribute to the crypto_scomp_show() definition
and remove the now-unnecessary forward declaration.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: fips - annotate fips_enable() with __init to free init memory after boot
Can Peng [Mon, 8 Dec 2025 09:50:10 +0000 (17:50 +0800)] 
crypto: fips - annotate fips_enable() with __init to free init memory after boot

The fips_enable() function is only invoked early during kernel boot via the
__setup() macro ("fips=" command line parameter), and is never used again
after initialization completes.

Annotating it with __init places the function in the .init.text section,
allowing the kernel to free its memory after init (when freeing_initmem()
runs), reducing runtime memory footprint.

This is a standard practice for setup/early-parse functions and has no
functional impact — the parsing logic, return values, and fips mode
setting behavior remain unchanged.

Signed-off-by: Can Peng <pengcan@kylinos.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: iaa - Remove unreachable pr_debug from iaa_crypto_cleanup_module
Thorsten Blum [Fri, 28 Nov 2025 13:54:12 +0000 (14:54 +0100)] 
crypto: iaa - Remove unreachable pr_debug from iaa_crypto_cleanup_module

iaa_unregister_compression_device() always returns 0, making the debug
log message unreachable. Remove the log statement and convert
iaa_unregister_compression_device() to a void function.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: iaa - Simplify init_iaa_device()
Thorsten Blum [Thu, 27 Nov 2025 22:20:58 +0000 (23:20 +0100)] 
crypto: iaa - Simplify init_iaa_device()

Return the result directly to simplify init_iaa_device().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode
Thorsten Blum [Thu, 27 Nov 2025 14:01:57 +0000 (15:01 +0100)] 
crypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode

The local variable 'i' is initialized with -EINVAL, but the for loop
immediately overwrites it and -EINVAL is never returned.

If no empty compression mode can be found, the function would return the
out-of-bounds index IAA_COMP_MODES_MAX, which would cause an invalid
array access in add_iaa_compression_mode().

Fix both issues by returning either a valid index or -EINVAL.

Cc: stable@vger.kernel.org
Fixes: b190447e0fa3 ("crypto: iaa - Add compression mode management along with fixed mode")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: octeontx - Fix length check to avoid truncation in ucode_load_store
Thorsten Blum [Wed, 26 Nov 2025 09:46:13 +0000 (10:46 +0100)] 
crypto: octeontx - Fix length check to avoid truncation in ucode_load_store

OTX_CPT_UCODE_NAME_LENGTH limits the microcode name to 64 bytes. If a
user writes a string of exactly 64 characters, the original code used
'strlen(buf) > 64' to check the length, but then strscpy() copies only
63 characters before adding a NUL terminator, silently truncating the
copied string.

Fix this off-by-one error by using 'count' directly for the length check
to ensure long names are rejected early and copied without truncation.

Cc: stable@vger.kernel.org
Fixes: d9110b0b01ff ("crypto: marvell - add support for OCTEON TX CPT engine")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: sun8i-ss - Avoid -Wflex-array-member-not-at-end warning
Gustavo A. R. Silva [Mon, 24 Nov 2025 09:11:30 +0000 (18:11 +0900)] 
crypto: sun8i-ss - Avoid -Wflex-array-member-not-at-end warning

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the corresponding
structure. Notice that `struct ahash_request` is a flexible structure,
this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h:251:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: starfive - Avoid -Wflex-array-member-not-at-end warning
Gustavo A. R. Silva [Fri, 21 Nov 2025 03:56:21 +0000 (12:56 +0900)] 
crypto: starfive - Avoid -Wflex-array-member-not-at-end warning

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the corresponding
structure. Notice that `struct ahash_request` is a flexible structure,
this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/crypto/starfive/jh7110-cryp.h:219:49: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: qat - fix warning on adf_pfvf_pf_proto.c
Giovanni Cabiddu [Thu, 20 Nov 2025 16:30:46 +0000 (16:30 +0000)] 
crypto: qat - fix warning on adf_pfvf_pf_proto.c

Building the QAT driver with -Wmaybe-uninitialized triggers warnings in
qat_common/adf_pfvf_pf_proto.c. Specifically, the variables blk_type,
blk_byte, and byte_max may be used uninitialized in handle_blkmsg_req():

  make M=drivers/crypto/intel/qat W=1 C=2 "KCFLAGS=-Werror" \
       KBUILD_CFLAGS_KERNEL=-Wmaybe-uninitialized           \
       CFLAGS_MODULE=-Wmaybe-uninitialized

  ...
  warning: ‘byte_max’ may be used uninitialized [-Wmaybe-uninitialized]
  warning: ‘blk_type’ may be used uninitialized [-Wmaybe-uninitialized]
  warning: ‘blk_byte’ may be used uninitialized [-Wmaybe-uninitialized]

Although the caller of handle_blkmsg_req() always provides a req.type
that is handled by the switch, the compiler cannot guarantee this.

Add a default case to the switch statement to handle an invalid req.type.

Fixes: 673184a2a58f ("crypto: qat - introduce support for PFVF block messages")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: qat - add bank state save and restore for qat_420xx
Giovanni Cabiddu [Thu, 20 Nov 2025 16:30:19 +0000 (16:30 +0000)] 
crypto: qat - add bank state save and restore for qat_420xx

Register the functions required to save and restore the state of a ring
bank on the qat_420xx device.  Since this logic is shared across QAT
GEN4 devices, reuse the existing GEN4 implementation.

This functionality enables saving and restoring the state of a Virtual
Function (VF), which is required for supporting VM Live Migration.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: qat - fix parameter order used in ICP_QAT_FW_COMN_FLAGS_BUILD
Giovanni Cabiddu [Thu, 20 Nov 2025 16:29:23 +0000 (16:29 +0000)] 
crypto: qat - fix parameter order used in ICP_QAT_FW_COMN_FLAGS_BUILD

The macro ICP_QAT_FW_COMN_FLAGS_BUILD sets flags in the firmware
descriptor to indicate:

  * Whether the content descriptor is a pointer or contains embedded
    data.
  * Whether the source and destination buffers are scatter-gather lists
    or flat buffers.

The correct parameter order is:

  * First: content descriptor type
  * Second: source/destination pointer type

In the asymmetric crypto code, the macro was used with the parameters
swapped. Although this does not cause functional issues, since both
macros currently evaluate to 0, it is incorrect.

Fix the parameter order in the Diffie-Hellman and RSA code paths.

Fixes: a990532023b9 ("crypto: qat - Add support for RSA algorithm")
Fixes: c9839143ebbf ("crypto: qat - Add DH support")
Reported-by: Qihua Dai <qihua.dai@intel.com> # off-list
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
Chenghai Huang [Thu, 20 Nov 2025 13:21:24 +0000 (21:21 +0800)] 
crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()

In qm_get_complete_eqe_num(), the function entry has already
checked whether the interrupt is valid, so the interrupt event
can be processed directly. Currently, the interrupt valid bit is
being checked again redundantly, and no interrupt processing is
performed. Therefore, the loop condition should be modified to
directly process the interrupt event, and use do while instead of
the current while loop, because the condition is always satisfied
on the first iteration.

Fixes: f5a332980a68 ("crypto: hisilicon/qm - add the save operation of eqe and aeqe")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 weeks agocrypto: seqiv - Do not use req->iv after crypto_aead_encrypt
Herbert Xu [Wed, 17 Dec 2025 06:15:41 +0000 (14:15 +0800)] 
crypto: seqiv - Do not use req->iv after crypto_aead_encrypt

As soon as crypto_aead_encrypt is called, the underlying request
may be freed by an asynchronous completion.  Thus dereferencing
req->iv after it returns is invalid.

Instead of checking req->iv against info, create a new variable
unaligned_info and use it for that purpose instead.

Fixes: 0a270321dbf9 ("[CRYPTO] seqiv: Add Sequence Number IV Generator")
Reported-by: Xiumei Mu <xmu@redhat.com>
Reported-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
8 weeks agoLinux 6.19-rc1 v6.19-rc1
Linus Torvalds [Sun, 14 Dec 2025 04:05:07 +0000 (16:05 +1200)] 
Linux 6.19-rc1

8 weeks agoMerge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 14 Dec 2025 03:35:35 +0000 (15:35 +1200)] 
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "The only core fix is in doc; all the others are in drivers, with the
  biggest impacts in libsas being the rollback on error handling and in
  ufs coming from a couple of error handling fixes, one causing a crash
  if it's activated before scanning and the other fixing W-LUN
  resumption"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: ufs: qcom: Fix confusing cleanup.h syntax
  scsi: libsas: Add rollback handling when an error occurs
  scsi: device_handler: Return error pointer in scsi_dh_attached_handler_name()
  scsi: ufs: core: Fix a deadlock in the frequency scaling code
  scsi: ufs: core: Fix an error handler crash
  scsi: Revert "scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed"
  scsi: ufs: core: Fix RPMB link error by reversing Kconfig dependencies
  scsi: qla4xxx: Use time conversion macros
  scsi: qla2xxx: Enable/disable IRQD_NO_BALANCING during reset
  scsi: ipr: Enable/disable IRQD_NO_BALANCING during reset
  scsi: imm: Fix use-after-free bug caused by unfinished delayed work
  scsi: target: sbp: Remove KMSG_COMPONENT macro
  scsi: core: Correct documentation for scsi_device_quiesce()
  scsi: mpi3mr: Prevent duplicate SAS/SATA device entries in channel 1
  scsi: target: Reset t_task_cdb pointer in error case
  scsi: ufs: core: Fix EH failure after W-LUN resume error

8 weeks agoMerge tag 'ceph-for-6.19-rc1' of https://github.com/ceph/ceph-client
Linus Torvalds [Sun, 14 Dec 2025 03:24:10 +0000 (15:24 +1200)] 
Merge tag 'ceph-for-6.19-rc1' of https://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "We have a patch that adds an initial set of tracepoints to the MDS
  client from Max, a fix that hardens osdmap parsing code from myself
  (marked for stable) and a few assorted fixups"

* tag 'ceph-for-6.19-rc1' of https://github.com/ceph/ceph-client:
  rbd: stop selecting CRC32, CRYPTO, and CRYPTO_AES
  ceph: stop selecting CRC32, CRYPTO, and CRYPTO_AES
  libceph: make decode_pool() more resilient against corrupted osdmaps
  libceph: Amend checking to fix `make W=1` build breakage
  ceph: Amend checking to fix `make W=1` build breakage
  ceph: add trace points to the MDS client
  libceph: fix log output race condition in OSD client

8 weeks agoMerge tag 'tomoyo-pr-20251212' of git://git.code.sf.net/p/tomoyo/tomoyo
Linus Torvalds [Sun, 14 Dec 2025 03:21:02 +0000 (15:21 +1200)] 
Merge tag 'tomoyo-pr-20251212' of git://git.code.sf.net/p/tomoyo/tomoyo

Pull tomoyo update from Tetsuo Handa:
 "Trivial optimization"

* tag 'tomoyo-pr-20251212' of git://git.code.sf.net/p/tomoyo/tomoyo:
  tomoyo: Use local kmap in tomoyo_dump_page()

8 weeks agoMerge tag 'smp-urgent-2025-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 13 Dec 2025 18:12:46 +0000 (06:12 +1200)] 
Merge tag 'smp-urgent-2025-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug fix from Ingo Molnar:

 - Fix CPU hotplug callbacks to disable interrupts on UP kernels

* tag 'smp-urgent-2025-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu: Make atomic hotplug callbacks run with interrupts disabled on UP