summaryrefslogtreecommitdiffstats
path: root/crypto/des/qud_cksm.c
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-03-19 02:06:37 +0000
committerUlf Möller <ulf@openssl.org>2000-03-19 02:06:37 +0000
commit7af4816f0e9b624d8c2fcec19768ac14febb1832 (patch)
treec67a91f44159becae7ae9f47aad714888520509b /crypto/des/qud_cksm.c
parent369782ac5027b7e4d46a708eca020d84d97ad034 (diff)
des_quad_cksum() byte order bug fix.
See http://www.pdc.kth.se/kth-krb/ Their solution for CRAY is somewhat awkward. I'll assume that a "short" is 32 bits on CRAY to avoid the #ifdef _CRAY typedef struct { unsigned int a:32; unsigned int b:32; } XXX; #else typedef DES_LONG XXX; #endif
Diffstat (limited to 'crypto/des/qud_cksm.c')
-rw-r--r--crypto/des/qud_cksm.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/crypto/des/qud_cksm.c b/crypto/des/qud_cksm.c
index 6ce8c61b42..5f0ec5387f 100644
--- a/crypto/des/qud_cksm.c
+++ b/crypto/des/qud_cksm.c
@@ -80,10 +80,14 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[],
int i;
long l;
const unsigned char *cp;
- unsigned char *lp;
+#ifdef _CRAY
+ short *lp;
+#else
+ DES_LONG *lp;
+#endif
if (out_count < 1) out_count=1;
- lp = &(output[0])[0];
+ lp = (DES_LONG *) &(output[0])[0];
z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]);
z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]);
@@ -114,25 +118,10 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[],
}
if (lp != NULL)
{
- /* I believe I finally have things worked out.
- * The MIT library assumes that the checksum
- * is one huge number and it is returned in a
- * host dependant byte order.
- */
- static DES_LONG ltmp=1;
- static unsigned char *c=(unsigned char *)&ltmp;
-
- if (c[0])
- {
- l2c(z0,lp);
- l2c(z1,lp);
- }
- else
- {
- lp = &(output[out_count-i-1])[0];
- l2n(z1,lp);
- l2n(z0,lp);
- }
+ /* The MIT library assumes that the checksum is
+ * composed of 2*out_count 32 bit ints */
+ *lp++ = z0;
+ *lp++ = z1;
}
}
return(z0);