Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247098 > unrolled thread

[PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE

Started byLABBE Corentin <clabbe.montjoie@gmail.com>
First post2015-10-14 21:20 +0200
Last post2015-10-16 18:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-10-14 21:20 +0200
    Re: [PATCH] crypto: x86: Remove duplicate define of  SHA1_DIGEST_SIZE Thomas Gleixner <tglx@linutronix.de> - 2015-10-14 22:50 +0200
    Re: [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE Tim Chen <tim.c.chen@linux.intel.com> - 2015-10-16 18:10 +0200

#1247098 — [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE

FromLABBE Corentin <clabbe.montjoie@gmail.com>
Date2015-10-14 21:20 +0200
Subject[PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE
Message-ID<qjzKF-7SB-11@gated-at.bofh.it>
The sha x86 crypto code use two define for the same thing:
NUM_SHA1_DIGEST_WORDS and SHA1_DIGEST_LENGTH
Replace them by SHA1_DIGEST_SIZE/4

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 arch/x86/crypto/sha-mb/sha1_mb.c    | 2 +-
 arch/x86/crypto/sha-mb/sha_mb_ctx.h | 1 -
 arch/x86/crypto/sha-mb/sha_mb_mgr.h | 6 ++----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c
index a841e97..791cbfa 100644
--- a/arch/x86/crypto/sha-mb/sha1_mb.c
+++ b/arch/x86/crypto/sha-mb/sha1_mb.c
@@ -104,7 +104,7 @@ static asmlinkage struct job_sha1* (*sha1_job_mgr_get_comp_job)(struct sha1_mb_m
 
 inline void sha1_init_digest(uint32_t *digest)
 {
-	static const uint32_t initial_digest[SHA1_DIGEST_LENGTH] = {SHA1_H0,
+	static const uint32_t initial_digest[SHA1_DIGEST_SIZE / 4] = {SHA1_H0,
 					SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 };
 	memcpy(digest, initial_digest, sizeof(initial_digest));
 }
diff --git a/arch/x86/crypto/sha-mb/sha_mb_ctx.h b/arch/x86/crypto/sha-mb/sha_mb_ctx.h
index e36069d..9fd36eb5 100644
--- a/arch/x86/crypto/sha-mb/sha_mb_ctx.h
+++ b/arch/x86/crypto/sha-mb/sha_mb_ctx.h
@@ -94,7 +94,6 @@ enum hash_ctx_error {
 
 
 /* Hash Constants and Typedefs */
-#define SHA1_DIGEST_LENGTH          5
 #define SHA1_LOG2_BLOCK_SIZE        6
 
 #define SHA1_PADLENGTHFIELD_SIZE    8
diff --git a/arch/x86/crypto/sha-mb/sha_mb_mgr.h b/arch/x86/crypto/sha-mb/sha_mb_mgr.h
index 08ad1a9..3ff337c 100644
--- a/arch/x86/crypto/sha-mb/sha_mb_mgr.h
+++ b/arch/x86/crypto/sha-mb/sha_mb_mgr.h
@@ -54,11 +54,9 @@
 #ifndef __SHA_MB_MGR_H
 #define __SHA_MB_MGR_H
 
-
+#include <crypto/sha.h>
 #include <linux/types.h>
 
-#define NUM_SHA1_DIGEST_WORDS 5
-
 enum job_sts {	STS_UNKNOWN = 0,
 		STS_BEING_PROCESSED = 1,
 		STS_COMPLETED = 2,
@@ -69,7 +67,7 @@ enum job_sts {	STS_UNKNOWN = 0,
 struct job_sha1 {
 	u8	*buffer;
 	u32	len;
-	u32	result_digest[NUM_SHA1_DIGEST_WORDS] __aligned(32);
+	u32	result_digest[SHA1_DIGEST_SIZE / 4] __aligned(32);
 	enum	job_sts status;
 	void	*user_data;
 };
-- 
2.4.9

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1247143 — Re: [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE

FromThomas Gleixner <tglx@linutronix.de>
Date2015-10-14 22:50 +0200
SubjectRe: [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE
Message-ID<qjB9M-1n3-9@gated-at.bofh.it>
In reply to#1247098
On Wed, 14 Oct 2015, LABBE Corentin wrote:

> The sha x86 crypto code use two define for the same thing:
> NUM_SHA1_DIGEST_WORDS and SHA1_DIGEST_LENGTH
> Replace them by SHA1_DIGEST_SIZE/4

That's wrong. Use only one for the number of words and make the define
so it's derived from the LENGTH.

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248947

FromTim Chen <tim.c.chen@linux.intel.com>
Date2015-10-16 18:10 +0200
Message-ID<qkfJV-2V2-33@gated-at.bofh.it>
In reply to#1247098
On Wed, 2015-10-14 at 21:15 +0200, LABBE Corentin wrote:
> The sha x86 crypto code use two define for the same thing:
> NUM_SHA1_DIGEST_WORDS and SHA1_DIGEST_LENGTH
> Replace them by SHA1_DIGEST_SIZE/4

Thanks.  Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
> 
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web