Another sparc patch (was Re: bus error and check fail on solaris 2.6)

Remi Guyomarch rguyom at
Wed Feb 24 23:31:25 CET 1999

Another patch for a mis-aligned memory access, this time in md5.c
(md5_write) :

diff -ur old/cipher/md5.c new/cipher/md5.c
--- old/cipher/md5.c	Wed Feb 10 17:22:21 1999
+++ new/cipher/md5.c	Wed Feb 24 19:02:43 1999
@@ -268,8 +268,9 @@
 	    ctx->buflen = (left_over + add) & 63;
-	buffer = (const char *) buffer + add;
 	len -= add;
+	memmove (buffer, buffer + add, len);
+	/*buffer = (const char *) buffer + add;*/
     /* Process available complete blocks.  */

Well, I don't know if it's The-Right-Thing-To-Do(tm), but at least if
helps the Sparc port by a large margin ;-)
Basically, buffer is later passed to transform() which use it as an
array of unsigned int. On Sparc unsigned int pointers must be aligned
on a 4-byte boundary.
I know this breaks the "const void *", but I don't see any other way
to do this.

With this patch the last failing check is the clearsig test with
--rfc1991. It pass all clearsig tests but the one with
--rfc1991. Unfortunately this one doesn't segfault, but produce a bad
signature instead...

Another thing, in cipher/rndlinux.c you wrote :

 #if defined(__sparc__) && defined(__linux__)
   #warning something is wrong with UltraPenguin /dev/random
     if( !S_ISCHR(sb.st_mode) )
 	g10_log_fatal("invalid random device!\n" );

Hmm, this worry me. What's wrong in UltraPenguin's /dev/random ? Does
the RH 5.2 distrib has the same problem ? How do I test for a faulty
/dev/random ?

Rémi        <rguyom at> | Don't waste your computer's time :
    PGP-encrypt anything important: | - KeyID:0x85BD8B1B |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : /pipermail/attachments/19990224/2346cb7e/attachment.bin

More information about the Gnupg-devel mailing list