]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
6 months agocrypto: mips/crc32 - remove redundant setting of alignmask to 0
Eric Biggers [Thu, 19 Oct 2023 05:53:30 +0000 (22:53 -0700)] 
crypto: mips/crc32 - remove redundant setting of alignmask to 0

This unnecessary explicit setting of cra_alignmask to 0 shows up when
grepping for shash algorithms that set an alignmask.  Remove it.  No
change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocrypto: xilinx/zynqmp-sha - remove unnecessary alignmask
Eric Biggers [Thu, 19 Oct 2023 05:53:29 +0000 (22:53 -0700)] 
crypto: xilinx/zynqmp-sha - remove unnecessary alignmask

The zynqmp-sha3-384 algorithm sets a nonzero alignmask, but it doesn't
appear to actually need it.  Therefore, stop setting it.  This will
allow this algorithm to keep being registered after alignmask support is
removed from shash.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocrypto: stm32 - remove unnecessary alignmask
Eric Biggers [Thu, 19 Oct 2023 05:53:28 +0000 (22:53 -0700)] 
crypto: stm32 - remove unnecessary alignmask

The stm32 crc32 algorithms set a nonzero alignmask, but they don't seem
to actually need it.  Their ->update function already has code that
handles aligning the data to the same alignment that the alignmask
specifies, their ->setkey function already uses get_unaligned_le32(),
and their ->final function already uses put_unaligned_le32().
Therefore, stop setting the alignmask.  This will allow these algorithms
to keep being registered after alignmask support is removed from shash.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocrypto: sparc/crc32c - stop using the shash alignmask
Eric Biggers [Thu, 19 Oct 2023 05:53:27 +0000 (22:53 -0700)] 
crypto: sparc/crc32c - stop using the shash alignmask

As far as I can tell, "crc32c-sparc64" is the only "shash" algorithm in
the kernel that sets a nonzero alignmask and actually relies on it to
get the crypto API to align the inputs and outputs.  This capability is
not really useful, though.  To unblock removing the support for
alignmask from shash_alg, this patch updates crc32c-sparc64 to no longer
use the alignmask.  This means doing 8-byte alignment of the data when
doing an update, using get_unaligned_le32() when setting a non-default
initial CRC, and using put_unaligned_le32() to output the final CRC.

Partially tested with:

    export ARCH=sparc64 CROSS_COMPILE=sparc64-linux-gnu-
    make sparc64_defconfig
    echo CONFIG_CRYPTO_CRC32C_SPARC64=y >> .config
    echo '# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set' >> .config
    echo CONFIG_DEBUG_KERNEL=y >> .config
    echo CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y >> .config
    make olddefconfig
    make -j$(getconf _NPROCESSORS_ONLN)
    qemu-system-sparc64 -kernel arch/sparc/boot/image  -nographic

However, qemu doesn't actually support the sparc CRC32C instructions, so
for the test I temporarily replaced crc32c_sparc64() with __crc32c_le()
and made sparc64_has_crc32c_opcode() always return true.  So essentially
I tested the glue code, not the actual SPARC part which is unchanged.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocrypto: shash - eliminate indirect call for default import and export
Eric Biggers [Wed, 18 Oct 2023 22:34:55 +0000 (15:34 -0700)] 
crypto: shash - eliminate indirect call for default import and export

Most shash algorithms don't have custom ->import and ->export functions,
resulting in the memcpy() based default being used.  Yet,
crypto_shash_import() and crypto_shash_export() still make an indirect
call, which is expensive.  Therefore, change how the default import and
export are called to make it so that crypto_shash_import() and
crypto_shash_export() don't do an indirect call in this case.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agodt-bindings: crypto: qcom,prng: document SA8775P and SC7280
Om Prakash Singh [Mon, 16 Oct 2023 14:34:28 +0000 (20:04 +0530)] 
dt-bindings: crypto: qcom,prng: document SA8775P and SC7280

Document SA8775P and SC7280 compatible for the True Random Number
Generator.

Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocrypto: rsa - Add module alias for pkcs1pad
Herbert Xu [Mon, 16 Oct 2023 05:57:30 +0000 (13:57 +0800)] 
crypto: rsa - Add module alias for pkcs1pad

Add a module alias for pkcs1pas so that it can be auto-loaded by
modprobe.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agocerts: Break circular dependency when selftest is modular
Herbert Xu [Mon, 16 Oct 2023 05:21:44 +0000 (13:21 +0800)] 
certs: Break circular dependency when selftest is modular

The modular build fails because the self-test code depends on pkcs7
which in turn depends on x509 which contains the self-test.

Split the self-test out into its own module to break the cycle.

Fixes: 3cde3174eb91 ("certs: Add FIPS selftests")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
6 months agopadata: Fix refcnt handling in padata_free_shell()
WangJinchao [Mon, 16 Oct 2023 01:15:21 +0000 (09:15 +0800)] 
padata: Fix refcnt handling in padata_free_shell()

In a high-load arm64 environment, the pcrypt_aead01 test in LTP can lead
to system UAF (Use-After-Free) issues. Due to the lengthy analysis of
the pcrypt_aead01 function call, I'll describe the problem scenario
using a simplified model:

Suppose there's a user of padata named `user_function` that adheres to
the padata requirement of calling `padata_free_shell` after `serial()`
has been invoked, as demonstrated in the following code:

```c
struct request {
    struct padata_priv padata;
    struct completion *done;
};

void parallel(struct padata_priv *padata) {
    do_something();
}

void serial(struct padata_priv *padata) {
    struct request *request = container_of(padata,
     struct request,
padata);
    complete(request->done);
}

void user_function() {
    DECLARE_COMPLETION(done)
    padata->parallel = parallel;
    padata->serial = serial;
    padata_do_parallel();
    wait_for_completion(&done);
    padata_free_shell();
}
```

In the corresponding padata.c file, there's the following code:

```c
static void padata_serial_worker(struct work_struct *serial_work) {
    ...
    cnt = 0;

    while (!list_empty(&local_list)) {
        ...
        padata->serial(padata);
        cnt++;
    }

    local_bh_enable();

    if (refcount_sub_and_test(cnt, &pd->refcnt))
        padata_free_pd(pd);
}
```

Because of the high system load and the accumulation of unexecuted
softirq at this moment, `local_bh_enable()` in padata takes longer
to execute than usual. Subsequently, when accessing `pd->refcnt`,
`pd` has already been released by `padata_free_shell()`, resulting
in a UAF issue with `pd->refcnt`.

The fix is straightforward: add `refcount_dec_and_test` before calling
`padata_free_pd` in `padata_free_shell`.

Fixes: 07928d9bfc81 ("padata: Remove broken queue flushing")
Signed-off-by: WangJinchao <wangjinchao@xfusion.com>
Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qcom-rng - Add missing dependency on hw_random
André Apitzsch [Mon, 16 Oct 2023 17:45:53 +0000 (19:45 +0200)] 
crypto: qcom-rng - Add missing dependency on hw_random

This should fix the undefined reference:

> /usr/bin/aarch64-alpine-linux-musl-ld: Unexpected GOT/PLT entries detected!
> /usr/bin/aarch64-alpine-linux-musl-ld: Unexpected run-time procedure linkages detected!
> /usr/bin/aarch64-alpine-linux-musl-ld: drivers/crypto/qcom-rng.o: in function `qcom_rng_probe':
> qcom-rng.c:(.text+0x130): undefined reference to `devm_hwrng_register'

Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: skcipher - fix weak key check for lskciphers
Eric Biggers [Fri, 13 Oct 2023 05:56:13 +0000 (22:56 -0700)] 
crypto: skcipher - fix weak key check for lskciphers

When an algorithm of the new "lskcipher" type is exposed through the
"skcipher" API, calls to crypto_skcipher_setkey() don't pass on the
CRYPTO_TFM_REQ_FORBID_WEAK_KEYS flag to the lskcipher.  This causes
self-test failures for ecb(des), as weak keys are not rejected anymore.
Fix this.

Fixes: 31865c4c4db2 ("crypto: skcipher - Add lskcipher")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hisilicon/qm - fix EQ/AEQ interrupt issue
Longfang Liu [Fri, 13 Oct 2023 03:49:57 +0000 (11:49 +0800)] 
crypto: hisilicon/qm - fix EQ/AEQ interrupt issue

During hisilicon accelerator live migration operation. In order to
prevent the problem of EQ/AEQ interrupt loss. Migration driver will
trigger an EQ/AEQ doorbell at the end of the migration.

This operation may cause double interruption of EQ/AEQ events.
To ensure that the EQ/AEQ interrupt processing function is normal.
The interrupt handling functionality of EQ/AEQ needs to be updated.
Used to handle repeated interrupts event.

Fixes: b0eed085903e ("hisi_acc_vfio_pci: Add support for VFIO live migration")
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hifn_795x - Silence gcc format-truncation false positive warnings
Herbert Xu [Thu, 12 Oct 2023 15:08:17 +0000 (23:08 +0800)] 
crypto: hifn_795x - Silence gcc format-truncation false positive warnings

The heuristics used by gcc triggers false positive truncation
warnings in hifn_alg_alloc.  The warning triggered by the strings
here are clearly false positives (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95755).

Add checks on snprintf calls to silence these warnings, including
the one for cra_driver_name even though it does not currently trigger
a gcc warning.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: lskcipher - Return EINVAL when ecb_name fails sanity checks
Herbert Xu [Thu, 12 Oct 2023 05:11:25 +0000 (13:11 +0800)] 
crypto: lskcipher - Return EINVAL when ecb_name fails sanity checks

Set the error value to -EINVAL instead of zero when the underlying
name (within "ecb()") fails basic sanity checks.

Fixes: 8aee5d4ebd11 ("crypto: lskcipher - Add compatibility wrapper around ECB")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202310111323.ZjK7bzjw-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocerts: Limit MODULE_SIG_KEY_TYPE_ECDSA to SHA384 or SHA512
Dimitri John Ledkov [Tue, 10 Oct 2023 21:27:55 +0000 (22:27 +0100)] 
certs: Limit MODULE_SIG_KEY_TYPE_ECDSA to SHA384 or SHA512

NIST FIPS 186-5 states that it is recommended that the security
strength associated with the bit length of n and the security strength
of the hash function be the same, or higher upon agreement. Given NIST
P384 curve is used, force using either SHA384 or SHA512.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agomodule: Do not offer sha224 for built-in module signing
Dimitri John Ledkov [Tue, 10 Oct 2023 21:26:33 +0000 (22:26 +0100)] 
module: Do not offer sha224 for built-in module signing

sha224 does not provide enough security against collision attacks
relative to the default keys used for signing (RSA 4k & P-384). Also
sha224 never became popular, as sha256 got widely adopter ahead of
sha224 being introduced.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: mscode_parser - remove sha224 authenticode support
Dimitri John Ledkov [Tue, 10 Oct 2023 21:25:29 +0000 (22:25 +0100)] 
crypto: mscode_parser - remove sha224 authenticode support

It is possible to stand up own certificates and sign PE-COFF binaries
using SHA-224. However it never became popular or needed since it has
similar costs as SHA-256. Windows Authenticode infrastructure never
had support for SHA-224, and all secureboot keys used fro linux
vmlinuz have always been using at least SHA-256.

Given the point of mscode_parser is to support interoperatiblity with
typical de-facto hashes, remove support for SHA-224 to avoid
posibility of creating interoperatibility issues with rhboot/shim,
grub, and non-linux systems trying to sign or verify vmlinux.

SHA-224 itself is not removed from the kernel, as it is truncated
SHA-256. If requested I can write patches to remove SHA-224 support
across all of the drivers.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: pkcs7 - remove sha1 support
Dimitri John Ledkov [Tue, 10 Oct 2023 21:22:38 +0000 (22:22 +0100)] 
crypto: pkcs7 - remove sha1 support

Removes support for sha1 signed kernel modules, importing sha1 signed
x.509 certificates.

rsa-pkcs1pad keeps sha1 padding support, which seems to be used by
virtio driver.

sha1 remains available as there are many drivers and subsystems using
it. Note only hmac(sha1) with secret keys remains cryptographically
secure.

In the kernel there are filesystems, IMA, tpm/pcr that appear to be
using sha1. Maybe they can all start to be slowly upgraded to
something else i.e. blake3, ParallelHash, SHAKE256 as needed.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: ccp - Dump SEV command buffer registers on SEV command error
John Allen [Tue, 10 Oct 2023 20:44:32 +0000 (20:44 +0000)] 
crypto: ccp - Dump SEV command buffer registers on SEV command error

PSP firmware may report additional error information in the SEV command
buffer registers in situations where an error occurs as the result of an
SEV command.  In this case, check if the command buffer registers have been
modified and if so, dump the contents.

Signed-off-by: John Allen <john.allen@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha512 - clean up backwards function names
Eric Biggers [Tue, 10 Oct 2023 06:41:27 +0000 (23:41 -0700)] 
crypto: arm64/sha512 - clean up backwards function names

In the Linux kernel, a function whose name has two leading underscores
is conventionally called by the same-named function without leading
underscores -- not the other way around.  __sha512_block_data_order()
got this backwards.  Fix this, albeit without changing the name in the
perlasm since that is OpenSSL code.  No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha256 - clean up backwards function names
Eric Biggers [Tue, 10 Oct 2023 06:41:26 +0000 (23:41 -0700)] 
crypto: arm64/sha256 - clean up backwards function names

In the Linux kernel, a function whose name has two leading underscores
is conventionally called by the same-named function without leading
underscores -- not the other way around.  __sha256_block_data_order()
and __sha256_block_neon() got this backwards.  Fix this, albeit without
changing the names in the perlasm since that is OpenSSL code.  No change
in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha512-ce - clean up backwards function names
Eric Biggers [Tue, 10 Oct 2023 06:41:25 +0000 (23:41 -0700)] 
crypto: arm64/sha512-ce - clean up backwards function names

In the Linux kernel, a function whose name has two leading underscores
is conventionally called by the same-named function without leading
underscores -- not the other way around.  __sha512_ce_transform() and
__sha512_block_data_order() got this backwards.  Fix this, albeit
without changing "sha512_block_data_order" in the perlasm since that is
OpenSSL code.  No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha2-ce - clean up backwards function names
Eric Biggers [Tue, 10 Oct 2023 06:41:24 +0000 (23:41 -0700)] 
crypto: arm64/sha2-ce - clean up backwards function names

In the Linux kernel, a function whose name has two leading underscores
is conventionally called by the same-named function without leading
underscores -- not the other way around.  __sha2_ce_transform() and
__sha256_block_data_order() got this backwards.  Fix this, albeit
without changing "sha256_block_data_order" in the perlasm since that is
OpenSSL code.  No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha1-ce - clean up backwards function names
Eric Biggers [Tue, 10 Oct 2023 06:41:23 +0000 (23:41 -0700)] 
crypto: arm64/sha1-ce - clean up backwards function names

In the Linux kernel, a function whose name has two leading underscores
is conventionally called by the same-named function without leading
underscores -- not the other way around.  __sha1_ce_transform() got this
backwards.  Fix this.  No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: x86/nhpoly1305 - implement ->digest
Eric Biggers [Tue, 10 Oct 2023 05:59:46 +0000 (22:59 -0700)] 
crypto: x86/nhpoly1305 - implement ->digest

Implement the ->digest method to improve performance on single-page
messages by reducing the number of indirect calls.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/nhpoly1305 - implement ->digest
Eric Biggers [Tue, 10 Oct 2023 05:59:45 +0000 (22:59 -0700)] 
crypto: arm64/nhpoly1305 - implement ->digest

Implement the ->digest method to improve performance on single-page
messages by reducing the number of indirect calls.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm/nhpoly1305 - implement ->digest
Eric Biggers [Tue, 10 Oct 2023 05:59:44 +0000 (22:59 -0700)] 
crypto: arm/nhpoly1305 - implement ->digest

Implement the ->digest method to improve performance on single-page
messages by reducing the number of indirect calls.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: adiantum - add fast path for single-page messages
Eric Biggers [Tue, 10 Oct 2023 05:59:43 +0000 (22:59 -0700)] 
crypto: adiantum - add fast path for single-page messages

When the source scatterlist is a single page, optimize the first hash
step of adiantum to use crypto_shash_digest() instead of
init/update/final, and use the same local kmap for both hashing the bulk
part and loading the narrow part of the source data.

Likewise, when the destination scatterlist is a single page, optimize
the second hash step of adiantum to use crypto_shash_digest() instead of
init/update/final, and use the same local kmap for both hashing the bulk
part and storing the narrow part of the destination data.

In some cases these optimizations improve performance significantly.

Note: ideally, for optimal performance each architecture should
implement the full "adiantum(xchacha12,aes)" algorithm and fully
optimize the contiguous buffer case to use no indirect calls.  That's
not something I've gotten around to doing, though.  This commit just
makes a relatively small change that provides some benefit with the
existing template-based approach.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - fix double free during reset
Svyatoslav Pankratov [Mon, 9 Oct 2023 12:27:19 +0000 (13:27 +0100)] 
crypto: qat - fix double free during reset

There is no need to free the reset_data structure if the recovery is
unsuccessful and the reset is synchronous. The function
adf_dev_aer_schedule_reset() handles the cleanup properly. Only
asynchronous resets require such structure to be freed inside the reset
worker.

Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
Signed-off-by: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: x86/sha256 - implement ->digest for sha256
Eric Biggers [Mon, 9 Oct 2023 08:19:00 +0000 (01:19 -0700)] 
crypto: x86/sha256 - implement ->digest for sha256

Implement a ->digest function for sha256-ssse3, sha256-avx, sha256-avx2,
and sha256-ni.  This improves the performance of crypto_shash_digest()
with these algorithms by reducing the number of indirect calls that are
made.

For now, don't bother with this for sha224, since sha224 is rarely used.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arm64/sha2-ce - implement ->digest for sha256
Eric Biggers [Mon, 9 Oct 2023 07:53:27 +0000 (00:53 -0700)] 
crypto: arm64/sha2-ce - implement ->digest for sha256

Implement a ->digest function for sha256-ce.  This improves the
performance of crypto_shash_digest() with this algorithm by reducing the
number of indirect calls that are made.  This only adds ~112 bytes of
code, mostly for the inlined init, as the finup function is tail-called.

For now, don't bother with this for sha224, since sha224 is rarely used.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: shash - fold shash_digest_unaligned() into crypto_shash_digest()
Eric Biggers [Mon, 9 Oct 2023 07:32:14 +0000 (00:32 -0700)] 
crypto: shash - fold shash_digest_unaligned() into crypto_shash_digest()

Fold shash_digest_unaligned() into its only remaining caller.  Also,
avoid a redundant check of CRYPTO_TFM_NEED_KEY by replacing the call to
crypto_shash_init() with shash->init(desc).  Finally, replace
shash_update_unaligned() + shash_final_unaligned() with
shash_finup_unaligned() which does exactly that.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: shash - optimize the default digest and finup
Eric Biggers [Mon, 9 Oct 2023 07:32:13 +0000 (00:32 -0700)] 
crypto: shash - optimize the default digest and finup

For an shash algorithm that doesn't implement ->digest, currently
crypto_shash_digest() with aligned input makes 5 indirect calls: 1 to
shash_digest_unaligned(), 1 to ->init, 2 to ->update ('alignmask + 1'
bytes, then the rest), then 1 to ->final.  This is true even if the
algorithm implements ->finup.  This is caused by an unnecessary fallback
to code meant to handle unaligned inputs.  In fact,
crypto_shash_digest() already does the needed alignment check earlier.
Therefore, optimize the number of indirect calls for aligned inputs to 3
when the algorithm implements ->finup.  It remains at 5 when the
algorithm implements neither ->finup nor ->digest.

Similarly, for an shash algorithm that doesn't implement ->finup,
currently crypto_shash_finup() with aligned input makes 4 indirect
calls: 1 to shash_finup_unaligned(), 2 to ->update, and
1 to ->final.  Optimize this to 3 calls.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: xts - use 'spawn' for underlying single-block cipher
Eric Biggers [Mon, 9 Oct 2023 02:31:16 +0000 (19:31 -0700)] 
crypto: xts - use 'spawn' for underlying single-block cipher

Since commit adad556efcdd ("crypto: api - Fix built-in testing
dependency failures"), the following warning appears when booting an
x86_64 kernel that is configured with
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y and CONFIG_CRYPTO_AES_NI_INTEL=y,
even when CONFIG_CRYPTO_XTS=y and CONFIG_CRYPTO_AES=y:

    alg: skcipher: skipping comparison tests for xts-aes-aesni because xts(ecb(aes-generic)) is unavailable

This is caused by an issue in the xts template where it allocates an
"aes" single-block cipher without declaring a dependency on it via the
crypto_spawn mechanism.  This issue was exposed by the above commit
because it reversed the order that the algorithms are tested in.

Specifically, when "xts(ecb(aes-generic))" is instantiated and tested
during the comparison tests for "xts-aes-aesni", the "xts" template
allocates an "aes" crypto_cipher for encrypting tweaks.  This resolves
to "aes-aesni".  (Getting "aes-aesni" instead of "aes-generic" here is a
bit weird, but it's apparently intended.)  Due to the above-mentioned
commit, the testing of "aes-aesni", and the finalization of its
registration, now happens at this point instead of before.  At the end
of that, crypto_remove_spawns() unregisters all algorithm instances that
depend on a lower-priority "aes" implementation such as "aes-generic"
but that do not depend on "aes-aesni".  However, because "xts" does not
use the crypto_spawn mechanism for its "aes", its dependency on
"aes-aesni" is not recognized by crypto_remove_spawns().  Thus,
crypto_remove_spawns() unexpectedly unregisters "xts(ecb(aes-generic))".

Fix this issue by making the "xts" template use the crypto_spawn
mechanism for its "aes" dependency, like what other templates do.

Note, this fix could be applied as far back as commit f1c131b45410
("crypto: xts - Convert to skcipher").  However, the issue only got
exposed by the much more recent changes to how the crypto API runs the
self-tests, so there should be no need to backport this to very old
kernels.  Also, an alternative fix would be to flip the list iteration
order in crypto_start_tests() to restore the original testing order.
I'm thinking we should do that too, since the original order seems more
natural, but it shouldn't be relied on for correctness.

Fixes: adad556efcdd ("crypto: api - Fix built-in testing dependency failures")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: virtio - handle config changed by work queue
zhenwei pi [Sat, 7 Oct 2023 06:43:09 +0000 (14:43 +0800)] 
crypto: virtio - handle config changed by work queue

MST pointed out: config change callback is also handled incorrectly
in this driver, it takes a mutex from interrupt context.

Handle config changed by work queue instead.

Cc: Gonglei (Arei) <arei.gonglei@huawei.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hisilicon/qm - alloc buffer to set and get xqc
Weili Qian [Sun, 8 Oct 2023 12:36:17 +0000 (20:36 +0800)] 
crypto: hisilicon/qm - alloc buffer to set and get xqc

If the temporarily applied memory is used to set or get the xqc
information, the driver releases the memory immediately after the
hardware mailbox operation time exceeds the driver waiting time.
However, the hardware does not cancel the operation, so the hardware
may write data to released memory.

Therefore, when the driver is bound to a device, the driver reserves
memory for the xqc configuration. The subsequent xqc configuration
uses the reserved memory to prevent hardware from accessing the
released memory.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: jitter - reuse allocated entropy collector
Stephan Müller [Sat, 7 Oct 2023 07:10:43 +0000 (09:10 +0200)] 
crypto: jitter - reuse allocated entropy collector

In case a health test error occurs during runtime, the power-up health
tests are rerun to verify that the noise source is still good and
that the reported health test error was an outlier. For performing this
power-up health test, the already existing entropy collector instance
is used instead of allocating a new one. This change has the following
implications:

* The noise that is collected as part of the newly run health tests is
  inserted into the entropy collector and thus stirs the existing
  data present in there further. Thus, the entropy collected during
  the health test is not wasted. This is also allowed by SP800-90B.

* The power-on health test is not affected by the state of the entropy
  collector, because it resets the APT / RCT state. The remainder of
  the state is unrelated to the health test as it is only applied to
  newly obtained time stamps.

This change also fixes a bug report about an allocation while in an
atomic lock (the lock is taken in jent_kcapi_random, jent_read_entropy
is called and this can call jent_entropy_init).

Fixes: 04597c8dd6c4 ("jitter - add RCT/APT support for different OSRs")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: n2 - Use device_get_match_data()
Rob Herring [Fri, 6 Oct 2023 21:43:40 +0000 (16:43 -0500)] 
hwrng: n2 - Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: aspeed-hace - Use device_get_match_data()
Rob Herring [Fri, 6 Oct 2023 21:39:17 +0000 (16:39 -0500)] 
crypto: aspeed-hace - Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Reviewed-by: Neal Liu <neal_liu@aspeedtech.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - add cnv_errors debugfs file
Lucas Segarra Fernandez [Wed, 4 Oct 2023 10:36:42 +0000 (12:36 +0200)] 
crypto: qat - add cnv_errors debugfs file

The Compress and Verify (CnV) feature check and ensures data integrity
in the compression operation. The implementation of CnV keeps a record
of the CnV errors that have occurred since the driver was loaded.

Expose CnV error stats by providing the "cnv_errors" file under
debugfs. This includes the number of errors detected up to now and
the type of the last error. The error count is provided on a per
Acceleration Engine basis and it is reset every time the driver is loaded.

Signed-off-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - add pm_status debugfs file
Lucas Segarra Fernandez [Wed, 4 Oct 2023 10:09:20 +0000 (12:09 +0200)] 
crypto: qat - add pm_status debugfs file

QAT devices implement a mechanism that allows them to go autonomously
to a low power state depending on the load.

Expose power management info by providing the "pm_status" file under
debugfs. This includes PM state, PM event log, PM event counters, PM HW
CSRs, per-resource type constrain counters and per-domain power gating
status specific to the QAT device.

This information is retrieved from (1) the FW by means of
ICP_QAT_FW_PM_INFO command, (2) CSRs and (3) counters collected by the
device driver.

In addition, add logic to keep track and report power management event
interrupts and acks/nacks sent to FW to allow/prevent state transitions.

Signed-off-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - refactor included headers
Lucas Segarra Fernandez [Wed, 4 Oct 2023 10:09:19 +0000 (12:09 +0200)] 
crypto: qat - refactor included headers

Include kernel.h for GENMASK(), kstrtobool() and types.

Add forward declaration for struct adf_accel_dev. Remove unneeded
include.

This change doesn't introduce any function change.

Signed-off-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qcom-rng - Add hw_random interface support
Om Prakash Singh [Tue, 3 Oct 2023 07:10:21 +0000 (09:10 +0200)] 
crypto: qcom-rng - Add hw_random interface support

Add hw_random interface support in qcom-rng driver as new IP block
in Qualcomm SoC has inbuilt NIST SP800 90B compliant entropic source
to generate true random number.

Keeping current rng_alg interface as well for random number generation
using Kernel Crypto API.

Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: qcom,prng: document SM8550
Neil Armstrong [Tue, 3 Oct 2023 07:10:20 +0000 (09:10 +0200)] 
dt-bindings: crypto: qcom,prng: document SM8550

Document SM8550 compatible for the True Random Number Generator.

Reviewed-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: qcom,prng: document that RNG on SM8450 is a TRNG
Neil Armstrong [Tue, 3 Oct 2023 07:10:19 +0000 (09:10 +0200)] 
dt-bindings: crypto: qcom,prng: document that RNG on SM8450 is a TRNG

It has been reported at [1] the RNG HW on SM8450 is in fact a True Random
Number Generator and no more Pseudo, document this by adding
a new qcom,trng and the corresponding SoC specific sm8450 compatible.

[1] https://lore.kernel.org/all/20230818161720.3644424-1-quic_omprsing@quicinc.com/

Suggested-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Suggested-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Om Prakash Singh <quic_omprsing@quicinc.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: skcipher - Remove obsolete skcipher_alg helpers
Herbert Xu [Tue, 3 Oct 2023 03:43:33 +0000 (11:43 +0800)] 
crypto: skcipher - Remove obsolete skcipher_alg helpers

As skcipher spawn users can no longer assume the spawn is of type
struct skcipher_alg, these helpers are no longer used.  Remove them.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: xts - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:32 +0000 (11:43 +0800)] 
crypto: xts - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: lrw - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:31 +0000 (11:43 +0800)] 
crypto: lrw - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hctr2 - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:30 +0000 (11:43 +0800)] 
crypto: hctr2 - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: gcm - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:29 +0000 (11:43 +0800)] 
crypto: gcm - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: cts - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:28 +0000 (11:43 +0800)] 
crypto: cts - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: ctr - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:27 +0000 (11:43 +0800)] 
crypto: ctr - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: chacha20poly1305 - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:26 +0000 (11:43 +0800)] 
crypto: chacha20poly1305 - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: ccm - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:25 +0000 (11:43 +0800)] 
crypto: ccm - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: authencesn - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:24 +0000 (11:43 +0800)] 
crypto: authencesn - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: authenc - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:23 +0000 (11:43 +0800)] 
crypto: authenc - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: adiantum - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:22 +0000 (11:43 +0800)] 
crypto: adiantum - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: cryptd - Only access common skcipher fields on spawn
Herbert Xu [Tue, 3 Oct 2023 03:43:21 +0000 (11:43 +0800)] 
crypto: cryptd - Only access common skcipher fields on spawn

As skcipher spawns may be of the type lskcipher, only the common
fields may be accessed.  This was already the case but use the
correct helpers to make this more obvious.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: essiv - Handle lskcipher spawns
Herbert Xu [Tue, 3 Oct 2023 03:43:20 +0000 (11:43 +0800)] 
crypto: essiv - Handle lskcipher spawns

Add code to handle an underlying lskcihper object when grabbing
an skcipher spawn.

Fixes: 31865c4c4db2 ("crypto: skcipher - Add lskcipher")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: skcipher - Add crypto_spawn_skcipher_alg_common
Herbert Xu [Tue, 3 Oct 2023 03:43:19 +0000 (11:43 +0800)] 
crypto: skcipher - Add crypto_spawn_skcipher_alg_common

As skcipher spawns can be of two different types (skcipher vs.
lskcipher), only the common fields can be accessed.  Add a helper
to return the common algorithm object.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: arc4 - Convert from skcipher to lskcipher
Herbert Xu [Tue, 3 Oct 2023 03:43:18 +0000 (11:43 +0800)] 
crypto: arc4 - Convert from skcipher to lskcipher

Replace skcipher implementation with lskcipher.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: skcipher - Add dependency on ecb
Herbert Xu [Tue, 3 Oct 2023 03:31:55 +0000 (11:31 +0800)] 
crypto: skcipher - Add dependency on ecb

As lskcipher requires the ecb wrapper for the transition add an
explicit dependency on it so that it is always present.  This can
be removed once all simple ciphers have been converted to lskcipher.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Fixes: 705b52fef3c7 ("crypto: cbc - Convert from skcipher to lskcipher")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - add namespace to driver
Giovanni Cabiddu [Mon, 2 Oct 2023 08:51:09 +0000 (09:51 +0100)] 
crypto: qat - add namespace to driver

Create CRYPTO_QAT namespace for symbols exported by the qat_common
module and import those in the QAT drivers. It will reduce the global
namespace crowdedness and potential misuse or the API.

This does not introduce any functional change.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: testmgr - Remove zlib-deflate
Herbert Xu [Wed, 30 Aug 2023 09:57:06 +0000 (17:57 +0800)] 
crypto: testmgr - Remove zlib-deflate

Remove zlib-deflate test vectors as it no longer exists in the kernel.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
7 months agocrypto: deflate - Remove zlib-deflate
Herbert Xu [Wed, 30 Aug 2023 09:56:25 +0000 (17:56 +0800)] 
crypto: deflate - Remove zlib-deflate

Remove the implementation of zlib-deflate because it is completely
unused in the kernel.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
7 months agocrypto: qat - Remove zlib-deflate
Herbert Xu [Wed, 30 Aug 2023 09:55:02 +0000 (17:55 +0800)] 
crypto: qat - Remove zlib-deflate

Remove the implementation of zlib-deflate because it is completely
unused in the kernel.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
7 months agocrypto: pkcs7 - remove md4 md5 x.509 support
Dimitri John Ledkov [Sun, 1 Oct 2023 23:57:15 +0000 (00:57 +0100)] 
crypto: pkcs7 - remove md4 md5 x.509 support

Remove support for md4 md5 hash and signatures in x.509 certificate
parsers, pkcs7 signature parser, authenticode parser.

All of these are insecure or broken, and everyone has long time ago
migrated to alternative hash implementations.

Also remove md2 & md3 oids which have already didn't have support.

This is also likely the last user of md4 in the kernel, and thus
crypto/md4.c and related tests in tcrypt & testmgr can likely be
removed. Other users such as cifs smbfs ext modpost sumversions have
their own internal implementation as needed.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: sig - fix kernel-doc typo
Randy Dunlap [Sun, 1 Oct 2023 00:00:44 +0000 (17:00 -0700)] 
crypto: sig - fix kernel-doc typo

Correct typo of "destination".

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: akcipher - fix kernel-doc typos
Randy Dunlap [Sun, 1 Oct 2023 00:00:43 +0000 (17:00 -0700)] 
crypto: akcipher - fix kernel-doc typos

Correct typos of "destination".

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: rng: meson: add meson-rng-s4 compatible
Alexey Romanov [Fri, 29 Sep 2023 10:29:37 +0000 (13:29 +0300)] 
dt-bindings: rng: meson: add meson-rng-s4 compatible

Add compatible for hardware number generator node for
Amlogic S4-series.

Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: meson - add support for S4
Alexey Romanov [Fri, 29 Sep 2023 10:29:36 +0000 (13:29 +0300)] 
hwrng: meson - add support for S4

For some Amlogic SOC's, mechanism to obtain random number
has been changed. For example, S4 now uses status bit waiting algo.

Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hisilicon/qm - check function qp num before alg register
Weili Qian [Thu, 28 Sep 2023 09:21:47 +0000 (17:21 +0800)] 
crypto: hisilicon/qm - check function qp num before alg register

When the Kunpeng accelerator executes tasks such as encryption
and decryption have minimum requirements on the number of device
queues. If the number of queues does not meet the requirement,
the process initialization will fail. Therefore, the driver checks
the number of queues on the device before registering the algorithm.
If the number does not meet the requirements, the driver does not register
the algorithm to crypto subsystem, the device is still added to the
qm_list.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hisilicon/qm - fix the type value of aeq
Weili Qian [Thu, 28 Sep 2023 09:21:03 +0000 (17:21 +0800)] 
crypto: hisilicon/qm - fix the type value of aeq

The type of aeq has only 4bits in dw0 17 to 20bits, but 15bits(17 to
31bits) are read in function qm_aeq_thread(). The remaining 11bits(21
to 31bits) are reserved for aeq, but may not be 0. To avoid getting
incorrect value of type, other bits are cleared.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: hisilicon/qm - fix PF queue parameter issue
Longfang Liu [Thu, 28 Sep 2023 08:57:22 +0000 (16:57 +0800)] 
crypto: hisilicon/qm - fix PF queue parameter issue

If the queue isolation feature is enabled, the number of queues
supported by the device changes. When PF is enabled using the
current default number of queues, the default number of queues may
be greater than the number supported by the device. As a result,
the PF fails to be bound to the driver.

After modification, if queue isolation feature is enabled, when
the default queue parameter is greater than the number supported
by the device, the number of enabled queues will be changed to
the number supported by the device, so that the PF and driver
can be properly bound.

Fixes: 8bbecfb402f7 ("crypto: hisilicon/qm - add queue isolation support for Kunpeng930")
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: x86/aesni - Perform address alignment early for XTS mode
Chang S. Bae [Thu, 28 Sep 2023 07:25:08 +0000 (00:25 -0700)] 
crypto: x86/aesni - Perform address alignment early for XTS mode

Currently, the alignment of each field in struct aesni_xts_ctx occurs
right before every access. However, it's possible to perform this
alignment ahead of time.

Introduce a helper function that converts struct crypto_skcipher *tfm
to struct aesni_xts_ctx *ctx and returns an aligned address. Utilize
this helper function at the beginning of each XTS function and then
eliminate redundant alignment code.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/all/ZFWQ4sZEVu%2FLHq+Q@gmail.com/
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Cc: linux-crypto@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: x86/aesni - Correct the data type in struct aesni_xts_ctx
Chang S. Bae [Thu, 28 Sep 2023 07:25:07 +0000 (00:25 -0700)] 
crypto: x86/aesni - Correct the data type in struct aesni_xts_ctx

Currently, every field in struct aesni_xts_ctx is defined as a byte
array of the same size as struct crypto_aes_ctx. This data type
is obscure and the choice lacks justification.

To rectify this, update the field type in struct aesni_xts_ctx to
match its actual structure.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/all/ZFWQ4sZEVu%2FLHq+Q@gmail.com/
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Cc: linux-crypto@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: x86/aesni - Refactor the common address alignment code
Chang S. Bae [Thu, 28 Sep 2023 07:25:06 +0000 (00:25 -0700)] 
crypto: x86/aesni - Refactor the common address alignment code

The address alignment code has been duplicated for each mode. Instead
of duplicating the same code, refactor the alignment code and simplify
the alignment helpers.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/all/20230526065414.GB875@sol.localdomain/
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Cc: linux-crypto@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agoX.509: Add missing IMPLICIT annotations to AKID ASN.1 module
Lukas Wunner [Tue, 26 Sep 2023 09:46:41 +0000 (11:46 +0200)] 
X.509: Add missing IMPLICIT annotations to AKID ASN.1 module

The ASN.1 module in RFC 5280 appendix A.1 uses EXPLICIT TAGS whereas the
one in appendix A.2 uses IMPLICIT TAGS.

The kernel's simplified asn1_compiler.c always uses EXPLICIT TAGS, hence
definitions from appendix A.2 need to be annotated as IMPLICIT for the
compiler to generate RFC-compliant code.

In particular, GeneralName is defined in appendix A.2:

GeneralName ::= CHOICE {
        otherName                       [0] OtherName,
        ...
        dNSName                         [2] IA5String,
        x400Address                     [3] ORAddress,
        directoryName                   [4] Name,
        ...
        }

Because appendix A.2 uses IMPLICIT TAGS, the IA5String tag (0x16) of a
dNSName is not rendered.  Instead, the string directly succeeds the
[2] tag (0x82).

Likewise, the SEQUENCE tag (0x30) of an OtherName is not rendered.
Instead, only the constituents of the SEQUENCE are rendered:  An OID tag
(0x06), a [0] tag (0xa0) and an ANY tag.  That's three consecutive tags
instead of a single encompassing tag.

The situation is different for x400Address and directoryName choices:
They reference ORAddress and Name, which are defined in appendix A.1,
therefore use EXPLICIT TAGS.

The AKID ASN.1 module is missing several IMPLICIT annotations, hence
isn't RFC-compliant.  In the unlikely event that an AKID contains other
elements beside a directoryName, users may see parse errors.

Add the missing annotations but do not tag this commit for stable as I
am not aware of any issue reports.  Fixes are only eligible for stable
if they're "obviously correct" and with ASN.1 there's no such thing.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: fsl-imx-sahara: Fix the number of irqs
Fabio Estevam [Mon, 25 Sep 2023 11:12:20 +0000 (08:12 -0300)] 
dt-bindings: crypto: fsl-imx-sahara: Fix the number of irqs

i.MX27 has only one Sahara interrupt. i.MX53 has two.

Describe this difference.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: fsl-imx-sahara: Document the clocks
Fabio Estevam [Mon, 25 Sep 2023 11:12:19 +0000 (08:12 -0300)] 
dt-bindings: crypto: fsl-imx-sahara: Document the clocks

Describe the clocks (ipg and ahb) needed by Sahara block to operate.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: fsl-imx-sahara: Shorten the title
Fabio Estevam [Mon, 25 Sep 2023 11:12:18 +0000 (08:12 -0300)] 
dt-bindings: crypto: fsl-imx-sahara: Shorten the title

In the title, there is no need to mention "included in some i.MX chips"
as it is too vague.

Remove it to make it simpler.

While at it, also remove the extra space in the first reg entry.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: engine - Make crypto_engine_exit() return void
Uwe Kleine-König [Sat, 23 Sep 2023 10:08:06 +0000 (12:08 +0200)] 
crypto: engine - Make crypto_engine_exit() return void

All callers ignore the return value, so simplify by not providing one.

Note that crypto_engine_exit() is typically called in a device driver's
remove path (or the error path in probe), where errors cannot be handled
anyhow.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: keembay - Don't pass errors to the caller in .remove()
Uwe Kleine-König [Sat, 23 Sep 2023 10:08:05 +0000 (12:08 +0200)] 
crypto: keembay - Don't pass errors to the caller in .remove()

Returning an error code in the remove function of a platform device has
no effect (compared to returning zero) apart from an error message, that
the error is ignored. Then the device is removed irrespective of the
returned value.

As kmb_ocs_hcu_remove is only called after kmb_ocs_hcu_probe() returned
successfully, platform_get_drvdata() never returns NULL and so the
respective check can just be dropped.

crypto_engine_exit() might return an error code but already emits an
error message in that case, so better return zero in
kmb_ocs_hcu_remove() even in this case to suppress another error
message. All other crypto drivers also ignore the return value of
crypto_engine_exit().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - Annotate struct adf_fw_counters with __counted_by
Kees Cook [Fri, 22 Sep 2023 17:54:33 +0000 (10:54 -0700)] 
crypto: qat - Annotate struct adf_fw_counters with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct adf_fw_counters.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Tom Rix <trix@redhat.com>
Cc: Adam Guerin <adam.guerin@intel.com>
Cc: Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: qat-linux@intel.com
Cc: linux-crypto@vger.kernel.org
Cc: llvm@lists.linux.dev
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: qat - increase size of buffers
Giovanni Cabiddu [Fri, 22 Sep 2023 09:03:47 +0000 (10:03 +0100)] 
crypto: qat - increase size of buffers

Increase the size of the buffers used for composing the names used for
the transport debugfs entries and the vector name to avoid a potential
truncation.

This resolves the following errors when compiling the driver with W=1
and KCFLAGS=-Werror on GCC 12.3.1:

    drivers/crypto/intel/qat/qat_common/adf_transport_debug.c: In function ‘adf_ring_debugfs_add’:
    drivers/crypto/intel/qat/qat_common/adf_transport_debug.c:100:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
    drivers/crypto/intel/qat/qat_common/adf_isr.c: In function ‘adf_isr_resource_alloc’:
    drivers/crypto/intel/qat/qat_common/adf_isr.c:197:47: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 5 [-Werror=format-truncation=]

Fixes: a672a9dc872e ("crypto: qat - Intel(R) QAT transport code")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: caam/jr - fix Chacha20 + Poly1305 self test failure
Gaurav Jain [Thu, 21 Sep 2023 12:42:37 +0000 (18:12 +0530)] 
crypto: caam/jr - fix Chacha20 + Poly1305 self test failure

key buffer is not copied in chachapoly_setkey function,
results in wrong output for encryption/decryption operation.

fix this by memcpy the key in caam_ctx key arrary

Fixes: d6bbd4eea243 ("crypto: caam/jr - add support for Chacha20 + Poly1305")
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: jitter - Allow configuration of oversampling rate
Stephan Müller [Thu, 21 Sep 2023 11:48:59 +0000 (13:48 +0200)] 
crypto: jitter - Allow configuration of oversampling rate

The oversampling rate used by the Jitter RNG allows the configuration of
the heuristically implied entropy in one timing measurement. This
entropy rate is (1 / OSR) bits of entropy per time stamp.

Considering that the Jitter RNG now support APT/RCT health tests for
different OSRs, allow this value to be configured at compile time to
support systems with limited amount of entropy in their timer.

The allowed range of OSR values complies with the APT/RCT cutoff health
test values which range from 1 through 15.

The default value of the OSR selection support is left at 1 which is the
current default. Thus, the addition of the configuration support does
not alter the default Jitter RNG behavior.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: jitter - Allow configuration of memory size
Stephan Müller [Thu, 21 Sep 2023 11:48:33 +0000 (13:48 +0200)] 
crypto: jitter - Allow configuration of memory size

The memory size consumed by the Jitter RNG is one contributing factor in
the amount of entropy that is gathered. As the amount of entropy
directly correlates with the distance of the memory from the CPU, the
caches that are possibly present on a given system have an impact on the
collected entropy.

Thus, the kernel compile time should offer a means to configure the
amount of memory used by the Jitter RNG. Although this option could be
turned into a runtime option (e.g. a kernel command line option), it
should remain a compile time option as otherwise adminsitrators who may
not have performed an entropy assessment may select a value that is
inappropriate.

The default value selected by the configuration is identical to the
current Jitter RNG value. Thus, the patch should not lead to any change
in the Jitter RNG behavior.

To accommodate larger memory buffers, kvzalloc / kvfree is used.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: jitter - add RCT/APT support for different OSRs
Stephan Müller [Thu, 21 Sep 2023 11:48:11 +0000 (13:48 +0200)] 
crypto: jitter - add RCT/APT support for different OSRs

The oversampling rate (OSR) value specifies the heuristically implied
entropy in the recorded data - H_submitter = 1/osr. A different entropy
estimate implies a different APT/RCT cutoff value. This change adds
support for OSRs 1 through 15. This OSR can be selected by the caller
of the Jitter RNG.

For this patch, the caller still uses one hard-coded OSR. A subsequent
patch allows this value to be configured.

In addition, the power-up self test is adjusted as follows:

* It allows the caller to provide an oversampling rate that should be
tested with - commonly it should be the same as used for the actual
runtime operation. This makes the power-up testing therefore consistent
with the runtime operation.

* It calls now jent_measure_jitter (i.e. collects the full entropy
that can possibly be harvested by the Jitter RNG) instead of only
jent_condition_data (which only returns the entropy harvested from
the conditioning component). This should now alleviate reports where
the Jitter RNG initialization thinks there is too little entropy.

* The power-up test now solely relies on the (enhanced) APT and RCT
test that is used as a health test at runtime.

The code allowing the different OSRs as well as the power-up test
changes are present in the user space version of the Jitter RNG 3.4.1
and thus was already in production use for some time.

Reported-by "Ospan, Abylay" <aospan@amazon.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agocrypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
Gaurav Jain [Thu, 21 Sep 2023 09:44:44 +0000 (15:14 +0530)] 
crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure

key buffer is not copied in chachapoly_setkey function,
results in wrong output for encryption/decryption operation.

fix this by memcpy the key in caam_ctx key arrary

Fixes: c10a53367901 ("crypto: caam/qi2 - add support for Chacha20 + Poly1305")
Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - rework power management sequences
Gatien Chevallier [Thu, 21 Sep 2023 08:03:00 +0000 (10:03 +0200)] 
hwrng: stm32 - rework power management sequences

Implement stm32_rng_suspend()/stm32_rng_resume() low-power APIs
called when the hardware block context will be lost.

There is no need to save the RNG_CR register in
stm32_rng_runtime_suspend() as the context is not lost. Therefore,
only enable/disable the RNG in the runtime sequences.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - support RNG configuration locking mechanism
Gatien Chevallier [Thu, 21 Sep 2023 08:02:59 +0000 (10:02 +0200)] 
hwrng: stm32 - support RNG configuration locking mechanism

If "st,rng-lock-conf" DT binding property is set for a stm32-rng node,
the RNG configuration will be locked until next hardware block reset
or platform reset.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - restrain RNG noise source clock
Gatien Chevallier [Thu, 21 Sep 2023 08:02:58 +0000 (10:02 +0200)] 
hwrng: stm32 - restrain RNG noise source clock

For NIST certification the noise source sampling may need to be
restrained.

This change implements an algorithm that gets the rate of the RNG
clock and apply the correct value in CLKDIV field in RNG_CR register
to force the RNG clock rate to be "max_clock_rate" maximum.

As it is platform-specific, implement it as a compat data.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - rework error handling in stm32_rng_read()
Gatien Chevallier [Thu, 21 Sep 2023 08:02:57 +0000 (10:02 +0200)] 
hwrng: stm32 - rework error handling in stm32_rng_read()

Try to conceal seed errors when possible. If, despite the error
concealing tries, a seed error is still present, then return an error.

A clock error does not compromise the hardware block and data can
still be read from RNG_DR. Just warn that the RNG clock is too slow
and clear RNG_SR.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - implement error concealment
Gatien Chevallier [Thu, 21 Sep 2023 08:02:56 +0000 (10:02 +0200)] 
hwrng: stm32 - implement error concealment

The RNG driver should be capable of recovering from an error. Implement
an error concealment API. This avoids irrecoverable RNG state.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - implement STM32MP13x support
Gatien Chevallier [Thu, 21 Sep 2023 08:02:55 +0000 (10:02 +0200)] 
hwrng: stm32 - implement STM32MP13x support

The RNG present on STM32MP13x platforms introduces a customizable
configuration and the conditional reset.

STM32 RNG configuration should best fit the requirements of the
platform. Therefore, put a platform-specific RNG configuration
field in the platform data. Default RNG configuration for STM32MP13
is the NIST certified configuration [1].

While there, fix and the RNG init sequence to support all RNG
versions.

[1] https://csrc.nist.gov/projects/cryptographic-module-validation-program/entropy-validations/certificate/53

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agohwrng: stm32 - use devm_platform_get_and_ioremap_resource() API
Gatien Chevallier [Thu, 21 Sep 2023 08:02:54 +0000 (10:02 +0200)] 
hwrng: stm32 - use devm_platform_get_and_ioremap_resource() API

Use devm_platform_get_and_ioremap_resource() to get and ioremap a
resource.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: rng: introduce new compatible for STM32MP13x
Gatien Chevallier [Thu, 21 Sep 2023 08:02:53 +0000 (10:02 +0200)] 
dt-bindings: rng: introduce new compatible for STM32MP13x

Introduce st,stm32mp13-rng compatible and add st,rng-lock-conf.

If st,rng-lock-conf is set, the RNG configuration in RNG_CR, RNG_HTCR
and RNG_NSCR will be locked. It is supported starting from the RNG
version present in the STM32MP13

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agoipsec: Select CRYPTO_AEAD
Herbert Xu [Wed, 20 Sep 2023 23:20:25 +0000 (07:20 +0800)] 
ipsec: Select CRYPTO_AEAD

Select CRYPTO_AEAD so that crypto_has_aead is available.

Fixes: 1383e2ab102c ("ipsec: Stop using crypto_has_alg")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309202112.33V1Ezb1-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
7 months agodt-bindings: crypto: ice: document the sa8775p inline crypto engine
Bartosz Golaszewski [Wed, 13 Sep 2023 15:35:28 +0000 (17:35 +0200)] 
dt-bindings: crypto: ice: document the sa8775p inline crypto engine

Add the compatible string for QCom ICE on sa8775p SoCs.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>