[openwrt/openwrt] ltq-deu: convert SHA1 after library impl of SHA1 was removed

LEDE Commits lede-commits at lists.infradead.org
Wed Jan 5 17:10:20 PST 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/e84c4b54f34591b51a2503cadabe37218173036c

commit e84c4b54f34591b51a2503cadabe37218173036c
Author: Daniel Kestrel <kestrel1974 at t-online.de>
AuthorDate: Mon May 31 14:32:27 2021 +0200

    ltq-deu: convert SHA1 after library impl of SHA1 was removed
    
    The <linux/cryptohash.h> was removed with Linux 5.8, because it only
    contained the library implementation of SHA1, which was folded
    into <crypto/sha.h>.
    So switch this driver away from using <linux/cryptohash.h>.
    
    Signed-off-by: Daniel Kestrel <kestrel1974 at t-online.de>
---
 package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c      | 16 ++++++++--------
 package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
index 9112febbb7..362fe89c92 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
@@ -44,8 +44,8 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/crypto.h>
-#include <linux/cryptohash.h>
 #include <crypto/sha.h>
+#include <crypto/hash.h>
 #include <crypto/internal/hash.h>
 #include <linux/types.h>
 #include <linux/scatterlist.h>
@@ -92,13 +92,13 @@ struct sha1_ctx {
 extern int disable_deudma;
 
 
-/*! \fn static void sha1_transform (u32 *state, const u32 *in)
+/*! \fn static void sha1_transform1 (u32 *state, const u32 *in)
  *  \ingroup IFX_SHA1_FUNCTIONS
  *  \brief main interface to sha1 hardware   
  *  \param state current state 
  *  \param in 64-byte block of input  
 */                                 
-static void sha1_transform (struct sha1_ctx *sctx, u32 *state, const u32 *in)
+static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
 {
     int i = 0;
     volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
@@ -140,12 +140,12 @@ static void sha1_transform (struct sha1_ctx *sctx, u32 *state, const u32 *in)
     CRTCL_SECT_END;
 }
 
-/*! \fn static void sha1_init(struct crypto_tfm *tfm)
+/*! \fn static void sha1_init1(struct crypto_tfm *tfm)
  *  \ingroup IFX_SHA1_FUNCTIONS
  *  \brief initialize sha1 hardware   
  *  \param tfm linux crypto algo transform  
 */                                 
-static int sha1_init(struct shash_desc *desc)
+static int sha1_init1(struct shash_desc *desc)
 {
     struct sha1_ctx *sctx = shash_desc_ctx(desc);
     
@@ -174,9 +174,9 @@ static int sha1_update(struct shash_desc * desc, const u8 *data,
 
     if ((j + len) > 63) {
         memcpy (&sctx->buffer[j], data, (i = 64 - j));
-        sha1_transform (sctx, sctx->state, (const u32 *)sctx->buffer);
+        sha1_transform1 (sctx, sctx->state, (const u32 *)sctx->buffer);
         for (; i + 63 < len; i += 64) {
-            sha1_transform (sctx, sctx->state, (const u32 *)&data[i]);
+            sha1_transform1 (sctx, sctx->state, (const u32 *)&data[i]);
         }
 
         j = 0;
@@ -250,7 +250,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
 */
 static struct shash_alg ifxdeu_sha1_alg = {
         .digestsize     =       SHA1_DIGEST_SIZE,
-        .init           =       sha1_init,
+        .init           =       sha1_init1,
         .update         =       sha1_update,
         .final          =       sha1_final,
         .descsize       =       sizeof(struct sha1_ctx),
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
index 465c58f105..09496c509b 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
@@ -44,8 +44,8 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/crypto.h>
-#include <linux/cryptohash.h>
 #include <crypto/internal/hash.h>
+#include <crypto/sha.h>
 #include <linux/types.h>
 #include <linux/scatterlist.h>
 #include <asm/byteorder.h>



More information about the lede-commits mailing list