more general quad_cksum test.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1024 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-11-17 09:41:14 +00:00
parent 5ace64a339
commit c7d548e1df

View File

@@ -585,24 +585,28 @@ char *argv[];
printf("Doing quad_cksum\n"); printf("Doing quad_cksum\n");
cs=quad_cksum((C_Block *)cbc_data,(C_Block *)qret, cs=quad_cksum((C_Block *)cbc_data,(C_Block *)qret,
(long)strlen(cbc_data),2,(C_Block *)cbc_iv); (long)strlen(cbc_data),2,(C_Block *)cbc_iv);
for (i=0; i<4; i++)
{ {
lqret[i]=0;
memcpy(&(lqret[i]),&(qret[i][0]),4);
}
{ /* Big-endian fix */
static DES_LONG l=1; static DES_LONG l=1;
static unsigned char *c=(unsigned char *)&l; static unsigned char *c=(unsigned char *)&l;
DES_LONG ll;
if (!c[0]) if (!c[0])
{ {
ll=lqret[0]^lqret[3]; for (i=0; i<4; i++)
lqret[0]^=ll; {
lqret[3]^=ll; lqret[i] = (qret[3-i][0] << 24) |
ll=lqret[1]^lqret[2]; (qret[3-i][1] << 16) |
lqret[1]^=ll; (qret[3-i][2] << 8) |
lqret[2]^=ll; (qret[3-i][3] << 0);
}
}
else
{
for (i=0; i<4; i++)
{
lqret[i] = (qret[i][3] << 24) |
(qret[i][2] << 16) |
(qret[i][1] << 8) |
(qret[i][0] << 0);
}
} }
} }
if (cs != 0x70d7a63aL) if (cs != 0x70d7a63aL)