Mailing List Archive

More sparc g10 problems
The sparc is really quite picky with long longs and unaligned memory;
most specifically, it _requires_ that long longs be aligned along
8-byte boundaries. The tiger.c functions make rather extensive use of
long longs, but doesn't do checking to see if the memory is aligned,
and solaris2.5.1's malloc only guarantees 4-byte boundaries.

Normally, the posix function memalign() would be used, but all the
custom memory allocation routines make it a bit confusing to me as
to where it shoudl be put in.

In addition, since DIGEST_ALSO_TIGER is only defined when WITH_TIGER_HASH
is defined, much of the code breaks when DIGEST_ALSO_TIGER is not defined.
Here are the patches to let the code compile without WITH_TIGER_HASH
defined.

(incidentally, removing the (void) from the timezone checking routines
worked.)

diff -u -r -x *.m4 -x configure -x *.in ../gnupg-0.2.19/cipher/md.c gnupg-0.2.19/cipher/md.c
--- ../gnupg-0.2.19/cipher/md.c Fri May 22 01:39:53 1998
+++ gnupg-0.2.19/cipher/md.c Wed Jun 10 16:29:37 1998
@@ -205,8 +205,10 @@
md_digest_length( int algo )
{
switch( algo ) {
+#ifdef WITH_TIGER_HASH
case DIGEST_ALGO_TIGER:
return 24;
+#endif
case DIGEST_ALGO_RMD160:
case DIGEST_ALGO_SHA1:
return 20;
@@ -236,6 +238,7 @@
0x02, 0x01, 0x05, 0x00, 0x04, 0x14 };
alen = DIM(asn); p = asn;
}
+#if defined(WITH_TIGER_HASH)
else if( algo == DIGEST_ALGO_TIGER ) {
/* 40: SEQUENCE {
* 12: SEQUENCE {
@@ -253,6 +256,7 @@
0x45, 0x52, 0x31, 0x39, 0x32, 0x05, 0x00, 0x04, 0x18 };
alen = DIM(asn); p = asn;
}
+#endif /*defined(WITH_TIGER_HASH) */
else if( algo == DIGEST_ALGO_SHA1 ) {
static byte asn[15] = /* Object ID is 1.3.14.3.2.26 */
{ 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03,
diff -u -r -x *.m4 -x configure -x *.in ../gnupg-0.2.19/cipher/misc.c gnupg-0.2.19/cipher/misc.c
--- ../gnupg-0.2.19/cipher/misc.c Thu May 28 09:28:15 1998
+++ gnupg-0.2.19/cipher/misc.c Wed Jun 10 16:30:13 1998
@@ -46,7 +46,9 @@
{ "RMD160", DIGEST_ALGO_RMD160 },
{ "RMD-160", DIGEST_ALGO_RMD160 },
{ "RIPE-MD-160", DIGEST_ALGO_RMD160 },
+#ifdef WITH_TIGER_HASH
{ "TIGER", DIGEST_ALGO_TIGER },
+#endif
{NULL} };


diff -u -r -x *.m4 -x configure -x *.in ../gnupg-0.2.19/g10/mainproc.c gnupg-0.2.19/g10/mainproc.c
--- ../gnupg-0.2.19/g10/mainproc.c Fri May 29 05:14:49 1998
+++ gnupg-0.2.19/g10/mainproc.c Wed Jun 10 16:31:19 1998
@@ -246,7 +246,9 @@
/*md_start_debug(c->mfx.md, "proc_plaintext");*/
md_enable( c->mfx.md, DIGEST_ALGO_SHA1 );
md_enable( c->mfx.md, DIGEST_ALGO_MD5 );
+#ifdef WITH_TIGER_HASH
md_enable( c->mfx.md, DIGEST_ALGO_TIGER );
+#endif
rc = handle_plaintext( pt, &c->mfx );
if( rc )
log_error( "handle plaintext failed: %s\n", g10_errstr(rc));
Re: More sparc g10 problems [ In reply to ]
Tom Spindler <dogcow@home.merit.edu> writes:

> 8-byte boundaries. The tiger.c functions make rather extensive use of
> long longs, but doesn't do checking to see if the memory is aligned,
> and solaris2.5.1's malloc only guarantees 4-byte boundaries.

Good to know.

> In addition, since DIGEST_ALSO_TIGER is only defined when WITH_TIGER_HASH
> is defined, much of the code breaks when DIGEST_ALSO_TIGER is not defined.

I'll move tiger to an gnupg extension module but in the meantime a
aplly your patch.

Thanks,

Werner