]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2026 13:11:30 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2026 13:11:30 +0000 (15:11 +0200)
added patches:
crypto-amcc-fix-incorrect-kernel-doc-comment-syntax-in-files.patch
crypto-crypto4xx-remove-ahash-related-code.patch
crypto-crypto4xx-remove-insecure-and-unused-rng_alg.patch

queue-5.10/crypto-amcc-fix-incorrect-kernel-doc-comment-syntax-in-files.patch [new file with mode: 0644]
queue-5.10/crypto-crypto4xx-remove-ahash-related-code.patch [new file with mode: 0644]
queue-5.10/crypto-crypto4xx-remove-insecure-and-unused-rng_alg.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/crypto-amcc-fix-incorrect-kernel-doc-comment-syntax-in-files.patch b/queue-5.10/crypto-amcc-fix-incorrect-kernel-doc-comment-syntax-in-files.patch
new file mode 100644 (file)
index 0000000..6a03d60
--- /dev/null
@@ -0,0 +1,324 @@
+From stable+bounces-276908-greg=kroah.com@vger.kernel.org Fri Jul 17 04:49:24 2026
+From: Eric Biggers <ebiggers@kernel.org>
+Date: Thu, 16 Jul 2026 19:46:03 -0700
+Subject: crypto: amcc - fix incorrect kernel-doc comment syntax in files
+To: stable@vger.kernel.org
+Cc: linux-crypto@vger.kernel.org, Aditya Srivastava <yashsri421@gmail.com>, Randy Dunlap <rdunlap@infradead.org>, Herbert Xu <herbert@gondor.apana.org.au>, Eric Biggers <ebiggers@kernel.org>
+Message-ID: <20260717024605.87486-2-ebiggers@kernel.org>
+
+From: Aditya Srivastava <yashsri421@gmail.com>
+
+commit 73f04d3d800f3c8058bb00447e3e1c4cdc85a2b0 upstream.
+
+The opening comment mark '/**' is used for highlighting the beginning of
+kernel-doc comments.
+There are certain files in drivers/crypto/amcc, which follow this syntax,
+but the content inside does not comply with kernel-doc.
+Such lines were probably not meant for kernel-doc parsing, but are parsed
+due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
+causes unexpected warnings from kernel-doc.
+
+E.g., presence of kernel-doc like comment in
+drivers/crypto/amcc/crypto4xx_alg.c at header, and some other lines,
+causes these warnings by kernel-doc:
+
+"warning: expecting prototype for AMCC SoC PPC4xx Crypto Driver(). Prototype was for set_dynamic_sa_command_0() instead"
+"warning: Function parameter or member 'dir' not described in 'set_dynamic_sa_command_0'"
+etc..
+
+Provide a simple fix by replacing such occurrences with general comment
+format, i.e. '/*', to prevent kernel-doc from parsing it.
+
+Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
+Acked-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Eric Biggers <ebiggers@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/amcc/crypto4xx_alg.c     |   12 ++++++------
+ drivers/crypto/amcc/crypto4xx_core.c    |   18 +++++++++---------
+ drivers/crypto/amcc/crypto4xx_core.h    |    4 ++--
+ drivers/crypto/amcc/crypto4xx_reg_def.h |    8 ++++----
+ drivers/crypto/amcc/crypto4xx_sa.h      |   18 +++++++++---------
+ drivers/crypto/amcc/crypto4xx_trng.h    |    2 +-
+ 6 files changed, 31 insertions(+), 31 deletions(-)
+
+--- a/drivers/crypto/amcc/crypto4xx_alg.c
++++ b/drivers/crypto/amcc/crypto4xx_alg.c
+@@ -1,5 +1,5 @@
+ // SPDX-License-Identifier: GPL-2.0-or-later
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
+@@ -115,7 +115,7 @@ int crypto4xx_decrypt_iv_block(struct sk
+       return crypto4xx_crypt(req, AES_IV_SIZE, true, true);
+ }
+-/**
++/*
+  * AES Functions
+  */
+ static int crypto4xx_setkey_aes(struct crypto_skcipher *cipher,
+@@ -374,7 +374,7 @@ static int crypto4xx_aead_setup_fallback
+       return crypto_aead_setkey(ctx->sw_cipher.aead, key, keylen);
+ }
+-/**
++/*
+  * AES-CCM Functions
+  */
+@@ -489,7 +489,7 @@ int crypto4xx_setauthsize_aead(struct cr
+       return crypto_aead_setauthsize(ctx->sw_cipher.aead, authsize);
+ }
+-/**
++/*
+  * AES-GCM Functions
+  */
+@@ -617,7 +617,7 @@ int crypto4xx_decrypt_aes_gcm(struct aea
+       return crypto4xx_crypt_aes_gcm(req, true);
+ }
+-/**
++/*
+  * HASH SHA1 Functions
+  */
+ static int crypto4xx_hash_alg_init(struct crypto_tfm *tfm,
+@@ -711,7 +711,7 @@ int crypto4xx_hash_digest(struct ahash_r
+                                 ctx->sa_len, 0, NULL);
+ }
+-/**
++/*
+  * SHA1 Algorithm
+  */
+ int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm)
+--- a/drivers/crypto/amcc/crypto4xx_core.c
++++ b/drivers/crypto/amcc/crypto4xx_core.c
+@@ -1,5 +1,5 @@
+ // SPDX-License-Identifier: GPL-2.0-or-later
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
+@@ -44,7 +44,7 @@
+ #define PPC4XX_SEC_VERSION_STR                        "0.5"
+-/**
++/*
+  * PPC4xx Crypto Engine Initialization Routine
+  */
+ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
+@@ -159,7 +159,7 @@ void crypto4xx_free_sa(struct crypto4xx_
+       ctx->sa_len = 0;
+ }
+-/**
++/*
+  * alloc memory for the gather ring
+  * no need to alloc buf for the ring
+  * gdr_tail, gdr_head and gdr_count are initialized by this function
+@@ -268,7 +268,7 @@ static u32 crypto4xx_put_pd_to_pdr(struc
+       return tail;
+ }
+-/**
++/*
+  * alloc memory for the gather ring
+  * no need to alloc buf for the ring
+  * gdr_tail, gdr_head and gdr_count are initialized by this function
+@@ -346,7 +346,7 @@ static inline struct ce_gd *crypto4xx_ge
+       return &dev->gdr[idx];
+ }
+-/**
++/*
+  * alloc memory for the scatter ring
+  * need to alloc buf for the ring
+  * sdr_tail, sdr_head and sdr_count are initialized by this function
+@@ -928,7 +928,7 @@ int crypto4xx_build_pd(struct crypto_asy
+       return is_busy ? -EBUSY : -EINPROGRESS;
+ }
+-/**
++/*
+  * Algorithm Registration Functions
+  */
+ static void crypto4xx_ctx_init(struct crypto4xx_alg *amcc_alg,
+@@ -1095,7 +1095,7 @@ static void crypto4xx_bh_tasklet_cb(unsi
+       } while (head != tail);
+ }
+-/**
++/*
+  * Top Half of isr.
+  */
+ static inline irqreturn_t crypto4xx_interrupt_handler(int irq, void *data,
+@@ -1184,7 +1184,7 @@ static int crypto4xx_prng_seed(struct cr
+       return 0;
+ }
+-/**
++/*
+  * Supported Crypto Algorithms
+  */
+ static struct crypto4xx_alg_common crypto4xx_alg[] = {
+@@ -1367,7 +1367,7 @@ static struct crypto4xx_alg_common crypt
+       } },
+ };
+-/**
++/*
+  * Module Initialization Routine
+  */
+ static int crypto4xx_probe(struct platform_device *ofdev)
+--- a/drivers/crypto/amcc/crypto4xx_core.h
++++ b/drivers/crypto/amcc/crypto4xx_core.h
+@@ -1,5 +1,5 @@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
+@@ -188,7 +188,7 @@ int crypto4xx_hash_final(struct ahash_re
+ int crypto4xx_hash_update(struct ahash_request *req);
+ int crypto4xx_hash_init(struct ahash_request *req);
+-/**
++/*
+  * Note: Only use this function to copy items that is word aligned.
+  */
+ static inline void crypto4xx_memcpy_swab32(u32 *dst, const void *buf,
+--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
++++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
+@@ -1,5 +1,5 @@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
+@@ -104,7 +104,7 @@
+ #define CRYPTO4XX_PRNG_LFSR_L                 0x00070030
+ #define CRYPTO4XX_PRNG_LFSR_H                 0x00070034
+-/**
++/*
+  * Initialize CRYPTO ENGINE registers, and memory bases.
+  */
+ #define PPC4XX_PDR_POLL                               0x3ff
+@@ -123,7 +123,7 @@
+ #define PPC4XX_INT_TIMEOUT_CNT                        0
+ #define PPC4XX_INT_TIMEOUT_CNT_REVB           0x3FF
+ #define PPC4XX_INT_CFG                                1
+-/**
++/*
+  * all follow define are ad hoc
+  */
+ #define PPC4XX_RING_RETRY                     100
+@@ -131,7 +131,7 @@
+ #define PPC4XX_SDR_SIZE                               PPC4XX_NUM_SD
+ #define PPC4XX_GDR_SIZE                               PPC4XX_NUM_GD
+-/**
++/*
+   * Generic Security Association (SA) with all possible fields. These will
+  * never likely used except for reference purpose. These structure format
+  * can be not changed as the hardware expects them to be layout as defined.
+--- a/drivers/crypto/amcc/crypto4xx_sa.h
++++ b/drivers/crypto/amcc/crypto4xx_sa.h
+@@ -1,5 +1,5 @@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
+@@ -14,7 +14,7 @@
+ #define AES_IV_SIZE                           16
+-/**
++/*
+  * Contents of Dynamic Security Association (SA) with all possible fields
+  */
+ union dynamic_sa_contents {
+@@ -122,7 +122,7 @@ union sa_command_0 {
+ #define SA_AES_KEY_LEN_256                    4
+ #define SA_REV2                                       1
+-/**
++/*
+  * The follow defines bits sa_command_1
+  * In Basic hash mode  this bit define simple hash or hmac.
+  * In IPsec mode, this bit define muting control.
+@@ -172,7 +172,7 @@ struct dynamic_sa_ctl {
+       union sa_command_1 sa_command_1;
+ } __attribute__((packed));
+-/**
++/*
+  * State Record for Security Association (SA)
+  */
+ struct  sa_state_record {
+@@ -184,7 +184,7 @@ struct  sa_state_record {
+       };
+ } __attribute__((packed));
+-/**
++/*
+  * Security Association (SA) for AES128
+  *
+  */
+@@ -213,7 +213,7 @@ struct dynamic_sa_aes192 {
+ #define SA_AES192_LEN         (sizeof(struct dynamic_sa_aes192)/4)
+ #define SA_AES192_CONTENTS    0x3e000062
+-/**
++/*
+  * Security Association (SA) for AES256
+  */
+ struct dynamic_sa_aes256 {
+@@ -228,7 +228,7 @@ struct dynamic_sa_aes256 {
+ #define SA_AES256_CONTENTS    0x3e000082
+ #define SA_AES_CONTENTS               0x3e000002
+-/**
++/*
+  * Security Association (SA) for AES128 CCM
+  */
+ struct dynamic_sa_aes128_ccm {
+@@ -242,7 +242,7 @@ struct dynamic_sa_aes128_ccm {
+ #define SA_AES128_CCM_CONTENTS        0x3e000042
+ #define SA_AES_CCM_CONTENTS   0x3e000002
+-/**
++/*
+  * Security Association (SA) for AES128_GCM
+  */
+ struct dynamic_sa_aes128_gcm {
+@@ -258,7 +258,7 @@ struct dynamic_sa_aes128_gcm {
+ #define SA_AES128_GCM_CONTENTS        0x3e000442
+ #define SA_AES_GCM_CONTENTS   0x3e000402
+-/**
++/*
+  * Security Association (SA) for HASH160: HMAC-SHA1
+  */
+ struct dynamic_sa_hash160 {
+--- a/drivers/crypto/amcc/crypto4xx_trng.h
++++ b/drivers/crypto/amcc/crypto4xx_trng.h
+@@ -1,5 +1,5 @@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+-/**
++/*
+  * AMCC SoC PPC4xx Crypto Driver
+  *
+  * Copyright (c) 2008 Applied Micro Circuits Corporation.
diff --git a/queue-5.10/crypto-crypto4xx-remove-ahash-related-code.patch b/queue-5.10/crypto-crypto4xx-remove-ahash-related-code.patch
new file mode 100644 (file)
index 0000000..2b29ea4
--- /dev/null
@@ -0,0 +1,260 @@
+From stable+bounces-276909-greg=kroah.com@vger.kernel.org Fri Jul 17 04:49:28 2026
+From: Eric Biggers <ebiggers@kernel.org>
+Date: Thu, 16 Jul 2026 19:46:04 -0700
+Subject: crypto: crypto4xx - Remove ahash-related code
+To: stable@vger.kernel.org
+Cc: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>, Eric Biggers <ebiggers@kernel.org>
+Message-ID: <20260717024605.87486-3-ebiggers@kernel.org>
+
+From: Herbert Xu <herbert@gondor.apana.org.au>
+
+commit 97855e7f1ccf4917f305baab199edb9f2595ff5b upstream.
+
+The hash implementation in crypto4xx has been disabled since 2009.
+As nobody has tried to fix this remove all the dead code.
+
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Eric Biggers <ebiggers@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/amcc/crypto4xx_alg.c  |  106 -----------------------------------
+ drivers/crypto/amcc/crypto4xx_core.c |   43 --------------
+ drivers/crypto/amcc/crypto4xx_core.h |    7 --
+ 3 files changed, 1 insertion(+), 155 deletions(-)
+
+--- a/drivers/crypto/amcc/crypto4xx_alg.c
++++ b/drivers/crypto/amcc/crypto4xx_alg.c
+@@ -12,9 +12,6 @@
+ #include <linux/interrupt.h>
+ #include <linux/spinlock_types.h>
+ #include <linux/scatterlist.h>
+-#include <linux/crypto.h>
+-#include <linux/hash.h>
+-#include <crypto/internal/hash.h>
+ #include <linux/dma-mapping.h>
+ #include <crypto/algapi.h>
+ #include <crypto/aead.h>
+@@ -616,106 +613,3 @@ int crypto4xx_decrypt_aes_gcm(struct aea
+ {
+       return crypto4xx_crypt_aes_gcm(req, true);
+ }
+-
+-/*
+- * HASH SHA1 Functions
+- */
+-static int crypto4xx_hash_alg_init(struct crypto_tfm *tfm,
+-                                 unsigned int sa_len,
+-                                 unsigned char ha,
+-                                 unsigned char hm)
+-{
+-      struct crypto_alg *alg = tfm->__crt_alg;
+-      struct crypto4xx_alg *my_alg;
+-      struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm);
+-      struct dynamic_sa_hash160 *sa;
+-      int rc;
+-
+-      my_alg = container_of(__crypto_ahash_alg(alg), struct crypto4xx_alg,
+-                            alg.u.hash);
+-      ctx->dev   = my_alg->dev;
+-
+-      /* Create SA */
+-      if (ctx->sa_in || ctx->sa_out)
+-              crypto4xx_free_sa(ctx);
+-
+-      rc = crypto4xx_alloc_sa(ctx, sa_len);
+-      if (rc)
+-              return rc;
+-
+-      crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
+-                               sizeof(struct crypto4xx_ctx));
+-      sa = (struct dynamic_sa_hash160 *)ctx->sa_in;
+-      set_dynamic_sa_command_0(&sa->ctrl, SA_SAVE_HASH, SA_NOT_SAVE_IV,
+-                               SA_NOT_LOAD_HASH, SA_LOAD_IV_FROM_SA,
+-                               SA_NO_HEADER_PROC, ha, SA_CIPHER_ALG_NULL,
+-                               SA_PAD_TYPE_ZERO, SA_OP_GROUP_BASIC,
+-                               SA_OPCODE_HASH, DIR_INBOUND);
+-      set_dynamic_sa_command_1(&sa->ctrl, 0, SA_HASH_MODE_HASH,
+-                               CRYPTO_FEEDBACK_MODE_NO_FB, SA_EXTENDED_SN_OFF,
+-                               SA_SEQ_MASK_OFF, SA_MC_ENABLE,
+-                               SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
+-                               SA_NOT_COPY_HDR);
+-      /* Need to zero hash digest in SA */
+-      memset(sa->inner_digest, 0, sizeof(sa->inner_digest));
+-      memset(sa->outer_digest, 0, sizeof(sa->outer_digest));
+-
+-      return 0;
+-}
+-
+-int crypto4xx_hash_init(struct ahash_request *req)
+-{
+-      struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+-      int ds;
+-      struct dynamic_sa_ctl *sa;
+-
+-      sa = ctx->sa_in;
+-      ds = crypto_ahash_digestsize(
+-                      __crypto_ahash_cast(req->base.tfm));
+-      sa->sa_command_0.bf.digest_len = ds >> 2;
+-      sa->sa_command_0.bf.load_hash_state = SA_LOAD_HASH_FROM_SA;
+-
+-      return 0;
+-}
+-
+-int crypto4xx_hash_update(struct ahash_request *req)
+-{
+-      struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
+-      struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+-      struct scatterlist dst;
+-      unsigned int ds = crypto_ahash_digestsize(ahash);
+-
+-      sg_init_one(&dst, req->result, ds);
+-
+-      return crypto4xx_build_pd(&req->base, ctx, req->src, &dst,
+-                                req->nbytes, NULL, 0, ctx->sa_in,
+-                                ctx->sa_len, 0, NULL);
+-}
+-
+-int crypto4xx_hash_final(struct ahash_request *req)
+-{
+-      return 0;
+-}
+-
+-int crypto4xx_hash_digest(struct ahash_request *req)
+-{
+-      struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
+-      struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+-      struct scatterlist dst;
+-      unsigned int ds = crypto_ahash_digestsize(ahash);
+-
+-      sg_init_one(&dst, req->result, ds);
+-
+-      return crypto4xx_build_pd(&req->base, ctx, req->src, &dst,
+-                                req->nbytes, NULL, 0, ctx->sa_in,
+-                                ctx->sa_len, 0, NULL);
+-}
+-
+-/*
+- * SHA1 Algorithm
+- */
+-int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm)
+-{
+-      return crypto4xx_hash_alg_init(tfm, SA_HASH160_LEN, SA_HASH_ALG_SHA1,
+-                                     SA_HASH_MODE_HASH);
+-}
+--- a/drivers/crypto/amcc/crypto4xx_core.c
++++ b/drivers/crypto/amcc/crypto4xx_core.c
+@@ -485,18 +485,6 @@ static void crypto4xx_copy_pkt_to_dst(st
+       }
+ }
+-static void crypto4xx_copy_digest_to_dst(void *dst,
+-                                      struct pd_uinfo *pd_uinfo,
+-                                      struct crypto4xx_ctx *ctx)
+-{
+-      struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *) ctx->sa_in;
+-
+-      if (sa->sa_command_0.bf.hash_alg == SA_HASH_ALG_SHA1) {
+-              memcpy(dst, pd_uinfo->sr_va->save_digest,
+-                     SA_HASH_ALG_SHA1_DIGEST_SIZE);
+-      }
+-}
+-
+ static void crypto4xx_ret_sg_desc(struct crypto4xx_device *dev,
+                                 struct pd_uinfo *pd_uinfo)
+ {
+@@ -549,23 +537,6 @@ static void crypto4xx_cipher_done(struct
+       skcipher_request_complete(req, 0);
+ }
+-static void crypto4xx_ahash_done(struct crypto4xx_device *dev,
+-                              struct pd_uinfo *pd_uinfo)
+-{
+-      struct crypto4xx_ctx *ctx;
+-      struct ahash_request *ahash_req;
+-
+-      ahash_req = ahash_request_cast(pd_uinfo->async_req);
+-      ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(ahash_req));
+-
+-      crypto4xx_copy_digest_to_dst(ahash_req->result, pd_uinfo, ctx);
+-      crypto4xx_ret_sg_desc(dev, pd_uinfo);
+-
+-      if (pd_uinfo->state & PD_ENTRY_BUSY)
+-              ahash_request_complete(ahash_req, -EINPROGRESS);
+-      ahash_request_complete(ahash_req, 0);
+-}
+-
+ static void crypto4xx_aead_done(struct crypto4xx_device *dev,
+                               struct pd_uinfo *pd_uinfo,
+                               struct ce_pd *pd)
+@@ -642,9 +613,6 @@ static void crypto4xx_pd_done(struct cry
+       case CRYPTO_ALG_TYPE_AEAD:
+               crypto4xx_aead_done(dev, pd_uinfo, pd);
+               break;
+-      case CRYPTO_ALG_TYPE_AHASH:
+-              crypto4xx_ahash_done(dev, pd_uinfo);
+-              break;
+       }
+ }
+@@ -915,8 +883,7 @@ int crypto4xx_build_pd(struct crypto_asy
+       }
+       pd->pd_ctl.w = PD_CTL_HOST_READY |
+-              ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) ||
+-               (crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AEAD) ?
++              ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AEAD) ?
+                       PD_CTL_HASH_FINAL : 0);
+       pd->pd_ctl_len.w = 0x00400000 | (assoclen + datalen);
+       pd_uinfo->state = PD_ENTRY_INUSE | (is_busy ? PD_ENTRY_BUSY : 0);
+@@ -1022,10 +989,6 @@ static int crypto4xx_register_alg(struct
+                       rc = crypto_register_aead(&alg->alg.u.aead);
+                       break;
+-              case CRYPTO_ALG_TYPE_AHASH:
+-                      rc = crypto_register_ahash(&alg->alg.u.hash);
+-                      break;
+-
+               case CRYPTO_ALG_TYPE_RNG:
+                       rc = crypto_register_rng(&alg->alg.u.rng);
+                       break;
+@@ -1051,10 +1014,6 @@ static void crypto4xx_unregister_alg(str
+       list_for_each_entry_safe(alg, tmp, &sec_dev->alg_list, entry) {
+               list_del(&alg->entry);
+               switch (alg->alg.type) {
+-              case CRYPTO_ALG_TYPE_AHASH:
+-                      crypto_unregister_ahash(&alg->alg.u.hash);
+-                      break;
+-
+               case CRYPTO_ALG_TYPE_AEAD:
+                       crypto_unregister_aead(&alg->alg.u.aead);
+                       break;
+--- a/drivers/crypto/amcc/crypto4xx_core.h
++++ b/drivers/crypto/amcc/crypto4xx_core.h
+@@ -16,7 +16,6 @@
+ #include <linux/ratelimit.h>
+ #include <linux/mutex.h>
+ #include <linux/scatterlist.h>
+-#include <crypto/internal/hash.h>
+ #include <crypto/internal/aead.h>
+ #include <crypto/internal/rng.h>
+ #include <crypto/internal/skcipher.h>
+@@ -135,7 +134,6 @@ struct crypto4xx_alg_common {
+       u32 type;
+       union {
+               struct skcipher_alg cipher;
+-              struct ahash_alg hash;
+               struct aead_alg aead;
+               struct rng_alg rng;
+       } u;
+@@ -182,11 +180,6 @@ int crypto4xx_encrypt_noiv_block(struct
+ int crypto4xx_decrypt_noiv_block(struct skcipher_request *req);
+ int crypto4xx_rfc3686_encrypt(struct skcipher_request *req);
+ int crypto4xx_rfc3686_decrypt(struct skcipher_request *req);
+-int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm);
+-int crypto4xx_hash_digest(struct ahash_request *req);
+-int crypto4xx_hash_final(struct ahash_request *req);
+-int crypto4xx_hash_update(struct ahash_request *req);
+-int crypto4xx_hash_init(struct ahash_request *req);
+ /*
+  * Note: Only use this function to copy items that is word aligned.
diff --git a/queue-5.10/crypto-crypto4xx-remove-insecure-and-unused-rng_alg.patch b/queue-5.10/crypto-crypto4xx-remove-insecure-and-unused-rng_alg.patch
new file mode 100644 (file)
index 0000000..a246e32
--- /dev/null
@@ -0,0 +1,233 @@
+From stable+bounces-276910-greg=kroah.com@vger.kernel.org Fri Jul 17 04:49:35 2026
+From: Eric Biggers <ebiggers@kernel.org>
+Date: Thu, 16 Jul 2026 19:46:05 -0700
+Subject: crypto: crypto4xx - Remove insecure and unused rng_alg
+To: stable@vger.kernel.org
+Cc: linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>, Christian Lamparter <chunkeey@gmail.com>, Herbert Xu <herbert@gondor.apana.org.au>
+Message-ID: <20260717024605.87486-4-ebiggers@kernel.org>
+
+From: Eric Biggers <ebiggers@kernel.org>
+
+commit 7811ec9e973d2c9e465083699f0c8240b98cb8c4 upstream.
+
+Remove crypto4xx_rng, as it is insecure and unused:
+
+- It has only a 64-bit security strength, which is highly inadequate.
+  This can be seen by the fact that crypto4xx_hw_init() seeds it with
+  only 64 bits of entropy, and the fact that the original commit
+  mentions that it implements ANSI X9.17 Annex C.
+
+  Another issue was that this driver didn't implement the crypto_rng API
+  correctly, as crypto4xx_prng_generate() didn't return 0 on success.
+
+- No user of this code is known.  It's usable only theoretically via the
+  "rng" algorithm type of AF_ALG.  But userspace actually just uses the
+  actual Linux RNG (/dev/random etc) instead.  And rng_algs don't
+  contribute entropy to the actual Linux RNG either.  (This may have
+  been confused with hwrng, which does contribute entropy.)
+
+Fixes: d072bfa48853 ("crypto: crypto4xx - add prng crypto support")
+Cc: stable@vger.kernel.org
+Signed-off-by: Eric Biggers <ebiggers@kernel.org>
+Acked-by: Christian Lamparter <chunkeey@gmail.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/amcc/crypto4xx_core.c    |   87 --------------------------------
+ drivers/crypto/amcc/crypto4xx_core.h    |    4 -
+ drivers/crypto/amcc/crypto4xx_reg_def.h |   11 ----
+ 3 files changed, 102 deletions(-)
+
+--- a/drivers/crypto/amcc/crypto4xx_core.c
++++ b/drivers/crypto/amcc/crypto4xx_core.c
+@@ -31,11 +31,9 @@
+ #include <crypto/ctr.h>
+ #include <crypto/gcm.h>
+ #include <crypto/sha.h>
+-#include <crypto/rng.h>
+ #include <crypto/scatterwalk.h>
+ #include <crypto/skcipher.h>
+ #include <crypto/internal/aead.h>
+-#include <crypto/internal/rng.h>
+ #include <crypto/internal/skcipher.h>
+ #include "crypto4xx_reg_def.h"
+ #include "crypto4xx_core.h"
+@@ -989,10 +987,6 @@ static int crypto4xx_register_alg(struct
+                       rc = crypto_register_aead(&alg->alg.u.aead);
+                       break;
+-              case CRYPTO_ALG_TYPE_RNG:
+-                      rc = crypto_register_rng(&alg->alg.u.rng);
+-                      break;
+-
+               default:
+                       rc = crypto_register_skcipher(&alg->alg.u.cipher);
+                       break;
+@@ -1018,10 +1012,6 @@ static void crypto4xx_unregister_alg(str
+                       crypto_unregister_aead(&alg->alg.u.aead);
+                       break;
+-              case CRYPTO_ALG_TYPE_RNG:
+-                      crypto_unregister_rng(&alg->alg.u.rng);
+-                      break;
+-
+               default:
+                       crypto_unregister_skcipher(&alg->alg.u.cipher);
+               }
+@@ -1080,69 +1070,6 @@ static irqreturn_t crypto4xx_ce_interrup
+               PPC4XX_TMO_ERR_INT);
+ }
+-static int ppc4xx_prng_data_read(struct crypto4xx_device *dev,
+-                               u8 *data, unsigned int max)
+-{
+-      unsigned int i, curr = 0;
+-      u32 val[2];
+-
+-      do {
+-              /* trigger PRN generation */
+-              writel(PPC4XX_PRNG_CTRL_AUTO_EN,
+-                     dev->ce_base + CRYPTO4XX_PRNG_CTRL);
+-
+-              for (i = 0; i < 1024; i++) {
+-                      /* usually 19 iterations are enough */
+-                      if ((readl(dev->ce_base + CRYPTO4XX_PRNG_STAT) &
+-                           CRYPTO4XX_PRNG_STAT_BUSY))
+-                              continue;
+-
+-                      val[0] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_0);
+-                      val[1] = readl_be(dev->ce_base + CRYPTO4XX_PRNG_RES_1);
+-                      break;
+-              }
+-              if (i == 1024)
+-                      return -ETIMEDOUT;
+-
+-              if ((max - curr) >= 8) {
+-                      memcpy(data, &val, 8);
+-                      data += 8;
+-                      curr += 8;
+-              } else {
+-                      /* copy only remaining bytes */
+-                      memcpy(data, &val, max - curr);
+-                      break;
+-              }
+-      } while (curr < max);
+-
+-      return curr;
+-}
+-
+-static int crypto4xx_prng_generate(struct crypto_rng *tfm,
+-                                 const u8 *src, unsigned int slen,
+-                                 u8 *dstn, unsigned int dlen)
+-{
+-      struct rng_alg *alg = crypto_rng_alg(tfm);
+-      struct crypto4xx_alg *amcc_alg;
+-      struct crypto4xx_device *dev;
+-      int ret;
+-
+-      amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.rng);
+-      dev = amcc_alg->dev;
+-
+-      mutex_lock(&dev->core_dev->rng_lock);
+-      ret = ppc4xx_prng_data_read(dev, dstn, dlen);
+-      mutex_unlock(&dev->core_dev->rng_lock);
+-      return ret;
+-}
+-
+-
+-static int crypto4xx_prng_seed(struct crypto_rng *tfm, const u8 *seed,
+-                      unsigned int slen)
+-{
+-      return 0;
+-}
+-
+ /*
+  * Supported Crypto Algorithms
+  */
+@@ -1312,18 +1239,6 @@ static struct crypto4xx_alg_common crypt
+                       .cra_module     = THIS_MODULE,
+               },
+       } },
+-      { .type = CRYPTO_ALG_TYPE_RNG, .u.rng = {
+-              .base = {
+-                      .cra_name               = "stdrng",
+-                      .cra_driver_name        = "crypto4xx_rng",
+-                      .cra_priority           = 300,
+-                      .cra_ctxsize            = 0,
+-                      .cra_module             = THIS_MODULE,
+-              },
+-              .generate               = crypto4xx_prng_generate,
+-              .seed                   = crypto4xx_prng_seed,
+-              .seedsize               = 0,
+-      } },
+ };
+ /*
+@@ -1393,7 +1308,6 @@ static int crypto4xx_probe(struct platfo
+       core_dev->dev->core_dev = core_dev;
+       core_dev->dev->is_revb = is_revb;
+       core_dev->device = dev;
+-      mutex_init(&core_dev->rng_lock);
+       spin_lock_init(&core_dev->lock);
+       INIT_LIST_HEAD(&core_dev->dev->alg_list);
+       ratelimit_default_init(&core_dev->dev->aead_ratelimit);
+@@ -1471,7 +1385,6 @@ static int crypto4xx_remove(struct platf
+       tasklet_kill(&core_dev->tasklet);
+       /* Un-register with Linux CryptoAPI */
+       crypto4xx_unregister_alg(core_dev->dev);
+-      mutex_destroy(&core_dev->rng_lock);
+       /* Free all allocated memory */
+       crypto4xx_stop_all(core_dev);
+--- a/drivers/crypto/amcc/crypto4xx_core.h
++++ b/drivers/crypto/amcc/crypto4xx_core.h
+@@ -14,10 +14,8 @@
+ #define __CRYPTO4XX_CORE_H__
+ #include <linux/ratelimit.h>
+-#include <linux/mutex.h>
+ #include <linux/scatterlist.h>
+ #include <crypto/internal/aead.h>
+-#include <crypto/internal/rng.h>
+ #include <crypto/internal/skcipher.h>
+ #include "crypto4xx_reg_def.h"
+ #include "crypto4xx_sa.h"
+@@ -111,7 +109,6 @@ struct crypto4xx_core_device {
+       u32 irq;
+       struct tasklet_struct tasklet;
+       spinlock_t lock;
+-      struct mutex rng_lock;
+ };
+ struct crypto4xx_ctx {
+@@ -135,7 +132,6 @@ struct crypto4xx_alg_common {
+       union {
+               struct skcipher_alg cipher;
+               struct aead_alg aead;
+-              struct rng_alg rng;
+       } u;
+ };
+--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
++++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
+@@ -90,20 +90,9 @@
+ #define CRYPTO4XX_BYTE_ORDER_CFG              0x000600d8
+ #define CRYPTO4XX_ENDIAN_CFG                  0x000600d8
+-#define CRYPTO4XX_PRNG_STAT                   0x00070000
+-#define CRYPTO4XX_PRNG_STAT_BUSY              0x1
+ #define CRYPTO4XX_PRNG_CTRL                   0x00070004
+ #define CRYPTO4XX_PRNG_SEED_L                 0x00070008
+ #define CRYPTO4XX_PRNG_SEED_H                 0x0007000c
+-
+-#define CRYPTO4XX_PRNG_RES_0                  0x00070020
+-#define CRYPTO4XX_PRNG_RES_1                  0x00070024
+-#define CRYPTO4XX_PRNG_RES_2                  0x00070028
+-#define CRYPTO4XX_PRNG_RES_3                  0x0007002C
+-
+-#define CRYPTO4XX_PRNG_LFSR_L                 0x00070030
+-#define CRYPTO4XX_PRNG_LFSR_H                 0x00070034
+-
+ /*
+  * Initialize CRYPTO ENGINE registers, and memory bases.
+  */
index 70845c52540753b7e6c60ad555054a0226370870..7a142104027f878d1112f49e0d5a1e878ae26228 100644 (file)
@@ -574,3 +574,6 @@ mmc-vub300-defer-reset-until-cmd_mutex-is-unlocked.patch
 mtd-rawnand-fsl_ifc-return-errors-for-failed-page-reads.patch
 mtd-rawnand-lpc32xx_mlc-fail-dma-transfers-on-timeout.patch
 mtd-rawnand-lpc32xx_slc-fail-dma-transfer-on-completion-timeout.patch
+crypto-amcc-fix-incorrect-kernel-doc-comment-syntax-in-files.patch
+crypto-crypto4xx-remove-ahash-related-code.patch
+crypto-crypto4xx-remove-insecure-and-unused-rng_alg.patch