X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fdes%2Fqud_cksm.c;h=5f0ec5387fab0a00bc79cbed6c0594267453f7b2;hb=9ec0126ed2b943acf844de90fce5871b6a57960f;hp=39e8f40fa902cdb92878a697530100998b0c0ea3;hpb=d02b48c63a58ea4367a0e905979f140b7d090f86;p=openssl.git diff --git a/crypto/des/qud_cksm.c b/crypto/des/qud_cksm.c index 39e8f40fa9..5f0ec5387f 100644 --- a/crypto/des/qud_cksm.c +++ b/crypto/des/qud_cksm.c @@ -1,5 +1,5 @@ /* crypto/des/qud_cksm.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -73,28 +73,28 @@ /* Got the value MIT uses via brute force :-) 2/10/90 eay */ #define NOISE ((DES_LONG)83653421L) -DES_LONG des_quad_cksum(input, output, length, out_count, seed) -des_cblock (*input); -des_cblock (*output); -long length; -int out_count; -des_cblock (*seed); +DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], + long length, int out_count, des_cblock *seed) { DES_LONG z0,z1,t0,t1; int i; long l; - unsigned char *cp; - unsigned char *lp; + const unsigned char *cp; +#ifdef _CRAY + short *lp; +#else + DES_LONG *lp; +#endif if (out_count < 1) out_count=1; - lp=(unsigned char *)output; + 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]); for (i=0; ((i<4)&&(i 0) { @@ -118,25 +118,10 @@ des_cblock (*seed); } 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 *)<mp; - - if (c[0]) - { - l2c(z0,lp); - l2c(z1,lp); - } - else - { - lp=output[out_count-i-1]; - 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);