2 * Copyright (C) 1998 by the FundsXpress, INC.
6 * Export of this software from the United States of America may require
7 * a specific license from the United States Government. It is the
8 * responsibility of any person or organization contemplating export to
9 * obtain such a license before exporting.
11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
12 * distribute this software and its documentation for any purpose and
13 * without fee is hereby granted, provided that the above copyright
14 * notice appear in all copies and that both that copyright notice and
15 * this permission notice appear in supporting documentation, and that
16 * the name of FundsXpress. not be used in advertising or publicity pertaining
17 * to distribution of the software without specific, written prior
18 * permission. FundsXpress makes no representations about the suitability of
19 * this software for any purpose. It is provided "as is" without express
20 * or implied warranty.
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 #include "keyhash_provider.h"
31 static krb5_error_code
32 k5_descbc_hash(const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *ivec,
33 const krb5_data *input, krb5_data *output)
35 mit_des_key_schedule schedule;
38 return(KRB5_BAD_KEYSIZE);
39 if ((input->length%8) != 0)
40 return(KRB5_BAD_MSIZE);
41 if (ivec && (ivec->length != 8))
42 return(KRB5_CRYPTO_INTERNAL);
43 if (output->length != 8)
44 return(KRB5_CRYPTO_INTERNAL);
46 switch (mit_des_key_sched(key->contents, schedule)) {
48 return(KRB5DES_BAD_KEYPAR);
50 return(KRB5DES_WEAK_KEY);
53 /* this has a return value, but it's useless to us */
55 mit_des_cbc_cksum((unsigned char *) input->data,
56 (unsigned char *) output->data, input->length,
58 ivec? (const unsigned char *)ivec->data:
59 (const unsigned char *)mit_des_zeroblock);
61 memset(schedule, 0, sizeof(schedule));
66 const struct krb5_keyhash_provider krb5int_keyhash_descbc = {