From: Robert K. <may...@us...> - 2001-08-21 17:55:36
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv3788/lib Modified Files: tigertree.c Log Message: Fixed the tiger hash digest generation for big endian machines. Index: tigertree.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/tigertree.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** tigertree.c 2001/04/03 23:53:49 1.2 --- tigertree.c 2001/08/21 17:55:33 1.3 *************** *** 25,28 **** --- 25,40 ---- #include "tigertree.h" + #ifdef _WIN32 + #undef WORDS_BIGENDIAN + #else + #include "../config.h" + #endif + + #ifdef WORDS_BIGENDIAN + # define BIG_ENDIAN 1 + #else + # define BIG_ENDIAN 0 + #endif + /* Initialize the tigertree context */ void tt_init(TT_CONTEXT *ctx) *************** *** 102,105 **** --- 114,143 ---- } memmove(s,ctx->nodes,TIGERSIZE); + + #if (defined BIG_ENDIAN) + { + word32 *i; + byte *b, btemp; + word16 *w, wtemp; + + for(i = (word32 *)s; i < ((word32 *)s) + 6; i++) + { + b = (byte *)i; + btemp = *b; + *b = *(b + 1); + *(b + 1) = btemp; + + b+=2; + btemp = *(b); + *b = *(b + 1); + *(b + 1) = btemp; + + w = (word16 *)i; + wtemp = *w; + *w = *(w + 1); + *(w + 1) = wtemp; + } + } + #endif } |