From: Sam Hartman Date: Tue, 20 Nov 2001 00:26:54 +0000 (+0000) Subject: Work around hash using host byte order X-Git-Tag: krb5-1.3-alpha1~941 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0334904c593755c04315747883b67bc07d856a2a;p=krb5.git Work around hash using host byte order git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14009 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/yarrow/ChangeLog b/src/lib/crypto/yarrow/ChangeLog index cbdc2d216..22413ecfd 100644 --- a/src/lib/crypto/yarrow/ChangeLog +++ b/src/lib/crypto/yarrow/ChangeLog @@ -1,3 +1,7 @@ +2001-11-19 Sam Hartman + + * yhash.h: Work around sha1 implementation using host byte order + 2001-11-19 Danilo Almeida * Makefile.in: Fix typo OUTP -> OUTPRE. diff --git a/src/lib/crypto/yarrow/yhash.h b/src/lib/crypto/yarrow/yhash.h index 98c440302..24208a6b5 100644 --- a/src/lib/crypto/yarrow/yhash.h +++ b/src/lib/crypto/yarrow/yhash.h @@ -15,8 +15,16 @@ #define HASH_Init(x) shsInit(x) #define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz) #define HASH_Final(x, tdigest) do { \ - shsFinal(x); \ - memcpy((tdigest), (void *) (x)->digest, SHS_DIGESTSIZE); \ + int loopvar; \ + unsigned char *out = (void *)(tdigest); \ + HASH_CTX *ctx = (x); \ + shsFinal(ctx); \ +for (loopvar=0; loopvar<(sizeof(ctx->digest)/sizeof(ctx->digest[0])); loopvar++) { \ + out[loopvar*4] = (ctx->digest[loopvar]>>24)&0xff; \ + out[loopvar*4+1] = (ctx->digest[loopvar]>>16)&0xff; \ + out[loopvar*4+2] = (ctx->digest[loopvar]>>8)&0xff; \ + out[loopvar*4+3] = ctx->digest[loopvar]&0xff; \ +} \ } while(0)