Sami is probably correct with regards to 32 bit code in the SHA-1
implementation - this little patch *appears* to fix the SHA-1 PRNG on
amd64.  However, somebody with deeper understanding than me should
probably do some proper tests on it.  (Thanks for the report, Sami, I've
been blindly using APG to automate password generation for account
setup (thankfully on i386)!)

Also, on line 14 of sha/sha.h, I stumbled upon this:

        #define APG_LITTLE_ENDIAN

which is subsequently used for *all* archs in sha/sha.c.  Unfortunately,
I don't have a big endian box around to do any tests right now.

-ukh


diff -Naur apg-2.2.3.dfsg.1/sha/sha.c apg-2.2.3.dfsg.1.fixed/sha/sha.c
--- apg-2.2.3.dfsg.1/sha/sha.c  2003-08-07 17:40:30.000000000 +0200
+++ apg-2.2.3.dfsg.1.fixed/sha/sha.c    2007-03-19 11:45:03.122049745 +0100
@@ -13,6 +13,7 @@
 */
 
 #include <string.h>
+#include <sys/types.h>
 #include "sha.h"
 
 /* The SHA f()-functions */
@@ -39,7 +40,7 @@
 
 /* 32-bit rotate - kludged with shifts */
 
-typedef unsigned long UL ;     /* to save space */
+typedef u_int32_t UL ; /* to save space */
 
 #define S(n,X)  ( ( ((UL)X) << n ) | ( ((UL)X) >> ( 32 - n ) ) )
 
diff -Naur apg-2.2.3.dfsg.1/sha/sha.h apg-2.2.3.dfsg.1.fixed/sha/sha.h
--- apg-2.2.3.dfsg.1/sha/sha.h  2003-08-07 17:40:30.000000000 +0200
+++ apg-2.2.3.dfsg.1.fixed/sha/sha.h    2007-03-19 11:41:14.384084351 +0100
@@ -16,7 +16,7 @@
 /* Useful defines/typedefs */
 
 typedef unsigned char   BYTE ;
-typedef unsigned long   LONG ;
+typedef u_int32_t   LONG ;
 
 /* The SHA block size and message digest sizes, in bytes */
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to