[PATCH] fix sha1 strict aliasing bug

Dan Williams dcbw at redhat.com
Fri Nov 20 18:26:52 EST 2009


Discovered as part of the investigation of:

https://bugzilla.redhat.com/show_bug.cgi?id=494262#c32

if sha1 is built with gcc without turning off strict aliasing, it will
fail to correctly generate the hashes and will fail its own testcases as
well.

Signed-off-by: Dan Williams <dcbw at redhat.com>

---
Jouni: 0.6 too please? :)

diff --git a/src/crypto/sha1-internal.c b/src/crypto/sha1-internal.c
index 51e6121..11764a2 100644
--- a/src/crypto/sha1-internal.c
+++ b/src/crypto/sha1-internal.c
@@ -183,7 +183,7 @@ void SHA1Transform(u32 state[5], const unsigned char buffer[64])
 	} CHAR64LONG16;
 	CHAR64LONG16* block;
 #ifdef SHA1HANDSOFF
-	u32 workspace[16];
+	unsigned char workspace[64];
 	block = (CHAR64LONG16 *) workspace;
 	os_memcpy(block, buffer, 64);
 #else




More information about the HostAP mailing list