2
* auth_parity - set parity on a key/check for odd parity
10
#include "ntp_stdlib.h"
25
* Go through counting bits in each byte. Check to see if
26
* each parity bit was set correctly. If not, note the error
30
for (half = 0; half < 2; half++) { /* two halves of key */
32
for (byte = 0; byte < 4; byte++) { /* 4 bytes per half */
34
for (i = 0; i < 7; i++) { /* 7 data bits / byte */
41
* If bitcount is even, parity must be set. If
42
* bitcount is odd, parity must be clear.
44
if ((bitcount & 0x1) == 0) {
45
if (!(key[half] & mask)) {
50
if (key[half] & mask) {
60
* Return the result of the parity check.
62
return (parity_err == 0);