2 * Copyright 1989 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
7 * These routines check and fix parity of encryption keys for the DES
10 * Under U.S. law, this software may not be exported outside the US
11 * without license from the U.S. Commerce department.
13 * These routines form the library interface to the DES facilities.
17 #include <afsconfig.h>
18 #include <afs/param.h>
21 #include "mit-cpyright.h"
24 #include "des_internal.h"
25 #include "des_prototypes.h"
27 #include "odd.h" /* Load compile-time generated odd_parity table */
30 * des_fixup_key_parity: Forces odd parity per byte; parity is bits
31 * 8,16,...64 in des order, implies 0, 8, 16, ...
35 des_fixup_key_parity(des_cblock key)
39 for (i = 0; i < sizeof(des_cblock); i++)
40 key[i] = odd_parity[key[i]];
46 * des_check_key_parity: returns true iff key has the correct des parity.
47 * See des_fix_key_parity for the definition of
51 des_check_key_parity(des_cblock key)
55 for (i = 0; i < sizeof(des_cblock); i++)
56 if (key[i] != odd_parity[key[i]])