Re: [PATCH] crypto/sha256.c crypto/sha512.c

From: James Morris
Date: Wed Jan 28 2004 - 17:10:51 EST


On Wed, 28 Jan 2004, Jean-Luc Cooke wrote:

> Pardon my ignorance, but does silence mean "yes"?

No, but the patch looks fine to me and passes the test vectors.

Dave, I've included it below.


- James
--
James Morris
<jmorris@xxxxxxxxxx>

diff -Naur linux-2.6.1/crypto/sha256.c linux-2.6.1-patched/crypto/sha256.c
--- linux-2.6.1/crypto/sha256.c 2004-01-09 01:59:26.000000000 -0500
+++ linux-2.6.1-patched/crypto/sha256.c 2004-01-27 14:22:00.000000000 -0500
@@ -34,12 +34,12 @@

static inline u32 Ch(u32 x, u32 y, u32 z)
{
- return ((x & y) ^ (~x & z));
+ return z ^ (x & (y ^ z));
}

static inline u32 Maj(u32 x, u32 y, u32 z)
{
- return ((x & y) ^ (x & z) ^ (y & z));
+ return (x & y) | (z & (x | y));
}

static inline u32 RORu32(u32 x, u32 y)
diff -Naur linux-2.6.1/crypto/sha512.c linux-2.6.1-patched/crypto/sha512.c
--- linux-2.6.1/crypto/sha512.c 2004-01-09 02:00:03.000000000 -0500
+++ linux-2.6.1-patched/crypto/sha512.c 2004-01-27 14:22:26.000000000 -0500
@@ -34,12 +34,12 @@

static inline u64 Ch(u64 x, u64 y, u64 z)
{
- return ((x & y) ^ (~x & z));
+ return z ^ (x & (y ^ z));
}

static inline u64 Maj(u64 x, u64 y, u64 z)
{
- return ((x & y) ^ (x & z) ^ (y & z));
+ return (x & y) | (z & (x | y));
}

static inline u64 RORu64(u64 x, u64 y)

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