Package: centericq
Version: 4.20.0-3
Followup-For: Bug #308670

Hello,

The following piece of code is apparently responsible for the
differences between amd64 and i386 architecture:

--- File libjabber-0.1/sha.c ---

static void shaHashBlock(SHA_CTX *ctx) {

  /* up to here the ctx struct contains the same values on i386 and amd64 */

  ctx->H[0] += A;
  ctx->H[1] += B;
  ctx->H[2] += C;
  ctx->H[3] += D;
  ctx->H[4] += E;

  /* from now on the H-values of the ctx struct contain different values */
}

The attached patch should fix the wrong calculation of the SHA hash by
making the SHA_CTX struct use uint32_t types for calculations with 32bit
fixed width values (like the H array values).

Daniel.
diff -ru centericq-4.20.0.orig/libjabber-0.1/libxode.h centericq-4.20.0/libjabber-0.1/libxode.h
--- centericq-4.20.0.orig/libjabber-0.1/libxode.h	2004-06-09 15:44:03.000000000 +0200
+++ centericq-4.20.0/libjabber-0.1/libxode.h	2005-05-15 05:50:45.000000000 +0200
@@ -424,10 +424,10 @@
  */
 
 typedef struct {
-  unsigned long H[5];
-  unsigned long W[80];
+  uint32_t H[5];
+  uint32_t W[80];
   int lenW;
-  unsigned long sizeHi,sizeLo;
+  uint32_t sizeHi,sizeLo;
 } SHA_CTX;

Reply via email to