#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef DES
#include "ntp_stdlib.h"
int
DESauth_parity(
u_int32 *key
)
{
u_int32 mask;
int parity_err;
int bitcount;
int half;
int byte;
int i;
parity_err = 0;
for (half = 0; half < 2; half++) {
mask = 0x80000000;
for (byte = 0; byte < 4; byte++) {
bitcount = 0;
for (i = 0; i < 7; i++) {
if (key[half] & mask)
bitcount++;
mask >>= 1;
}
if ((bitcount & 0x1) == 0) {
if (!(key[half] & mask)) {
parity_err++;
key[half] |= mask;
}
} else {
if (key[half] & mask) {
parity_err++;
key[half] &= ~mask;
}
}
mask >>= 1;
}
}
return (parity_err == 0);
}
#else
int authparity_bs;
#endif