summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des/qud_cksm.c
diff options
context:
space:
mode:
authorbeck <>2000-04-15 06:18:51 +0000
committerbeck <>2000-04-15 06:18:51 +0000
commitb608c7f2b175e121f2c22d53341a317153afdc8e (patch)
treee94b160b3fcd8180df79e4251d68d24d665f0195 /src/lib/libcrypto/des/qud_cksm.c
parentc8d6701c396cebdcd0d45eac73b762e9498f6b01 (diff)
downloadopenbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.gz
openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.bz2
openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.zip
OpenSSL 0.9.5a merge
Diffstat (limited to 'src/lib/libcrypto/des/qud_cksm.c')
-rw-r--r--src/lib/libcrypto/des/qud_cksm.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/lib/libcrypto/des/qud_cksm.c b/src/lib/libcrypto/des/qud_cksm.c
index 6ce8c61b42..5f0ec5387f 100644
--- a/src/lib/libcrypto/des/qud_cksm.c
+++ b/src/lib/libcrypto/des/qud_cksm.c
@@ -80,10 +80,14 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[],
80 int i; 80 int i;
81 long l; 81 long l;
82 const unsigned char *cp; 82 const unsigned char *cp;
83 unsigned char *lp; 83#ifdef _CRAY
84 short *lp;
85#else
86 DES_LONG *lp;
87#endif
84 88
85 if (out_count < 1) out_count=1; 89 if (out_count < 1) out_count=1;
86 lp = &(output[0])[0]; 90 lp = (DES_LONG *) &(output[0])[0];
87 91
88 z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); 92 z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]);
89 z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); 93 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[],
114 } 118 }
115 if (lp != NULL) 119 if (lp != NULL)
116 { 120 {
117 /* I believe I finally have things worked out. 121 /* The MIT library assumes that the checksum is
118 * The MIT library assumes that the checksum 122 * composed of 2*out_count 32 bit ints */
119 * is one huge number and it is returned in a 123 *lp++ = z0;
120 * host dependant byte order. 124 *lp++ = z1;
121 */
122 static DES_LONG ltmp=1;
123 static unsigned char *c=(unsigned char *)&ltmp;
124
125 if (c[0])
126 {
127 l2c(z0,lp);
128 l2c(z1,lp);
129 }
130 else
131 {
132 lp = &(output[out_count-i-1])[0];
133 l2n(z1,lp);
134 l2n(z0,lp);
135 }
136 } 125 }
137 } 126 }
138 return(z0); 127 return(z0);