2 * auth_parity - set parity on a key/check for odd parity
4 #include "ntp_stdlib.h"
19 * Go through counting bits in each byte. Check to see if
20 * each parity bit was set correctly. If not, note the error
24 for (half = 0; half < 2; half++) { /* two halves of key */
26 for (byte = 0; byte < 4; byte++) { /* 4 bytes per half */
28 for (i = 0; i < 7; i++) { /* 7 data bits / byte */
35 * If bitcount is even, parity must be set. If
36 * bitcount is odd, parity must be clear.
38 if ((bitcount & 0x1) == 0) {
39 if (!(key[half] & mask)) {
44 if (key[half] & mask) {
54 * Return the result of the parity check.
56 return (parity_err == 0);