xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/crypto/keyed_cksum.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  * Copyright (C) 1998 by the FundsXpress, INC.
10  *
11  * All rights reserved.
12  *
13  * Export of this software from the United States of America may require
14  * a specific license from the United States Government.  It is the
15  * responsibility of any person or organization contemplating export to
16  * obtain such a license before exporting.
17  *
18  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
19  * distribute this software and its documentation for any purpose and
20  * without fee is hereby granted, provided that the above copyright
21  * notice appear in all copies and that both that copyright notice and
22  * this permission notice appear in supporting documentation, and that
23  * the name of FundsXpress. not be used in advertising or publicity pertaining
24  * to distribution of the software without specific, written prior
25  * permission.  FundsXpress makes no representations about the suitability of
26  * this software for any purpose.  It is provided "as is" without express
27  * or implied warranty.
28  *
29  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
30  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
31  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  */
33 
34 #include <k5-int.h>
35 #include <cksumtypes.h>
36 
37 KRB5_DLLIMP krb5_boolean KRB5_CALLCONV
38 is_keyed_cksum(ctype)
39      krb5_cksumtype ctype;
40 {
41     int i;
42 
43     for (i=0; i<krb5_cksumtypes_length; i++) {
44 	if (krb5_cksumtypes_list[i].ctype == ctype) {
45 	    if (krb5_cksumtypes_list[i].keyhash ||
46 		(krb5_cksumtypes_list[i].flags &
47 		 KRB5_CKSUMFLAG_DERIVE))
48 		return(1);
49 	    else
50 		return(0);
51 	}
52     }
53 
54     /* ick, but it's better than coredumping, which is what the
55        old code would have done */
56     return(0);
57 }
58