xref: /onnv-gate/usr/src/lib/gss_mechs/mech_krb5/crypto/keyed_cksum.c (revision 7934:6aeeafc994de)
10Sstevel@tonic-gate 
20Sstevel@tonic-gate /*
30Sstevel@tonic-gate  * Copyright (C) 1998 by the FundsXpress, INC.
4*7934SMark.Phalan@Sun.COM  *
50Sstevel@tonic-gate  * All rights reserved.
6*7934SMark.Phalan@Sun.COM  *
70Sstevel@tonic-gate  * Export of this software from the United States of America may require
80Sstevel@tonic-gate  * a specific license from the United States Government.  It is the
90Sstevel@tonic-gate  * responsibility of any person or organization contemplating export to
100Sstevel@tonic-gate  * obtain such a license before exporting.
11*7934SMark.Phalan@Sun.COM  *
120Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
130Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
140Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
150Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
160Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
170Sstevel@tonic-gate  * the name of FundsXpress. not be used in advertising or publicity pertaining
180Sstevel@tonic-gate  * to distribution of the software without specific, written prior
190Sstevel@tonic-gate  * permission.  FundsXpress makes no representations about the suitability of
200Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
210Sstevel@tonic-gate  * or implied warranty.
22*7934SMark.Phalan@Sun.COM  *
230Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
240Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
250Sstevel@tonic-gate  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
28*7934SMark.Phalan@Sun.COM #include "k5-int.h"
29*7934SMark.Phalan@Sun.COM #include "cksumtypes.h"
300Sstevel@tonic-gate 
31781Sgtb krb5_boolean KRB5_CALLCONV
krb5_c_is_keyed_cksum(krb5_cksumtype ctype)32781Sgtb krb5_c_is_keyed_cksum(krb5_cksumtype ctype)
330Sstevel@tonic-gate {
340Sstevel@tonic-gate     int i;
350Sstevel@tonic-gate 
360Sstevel@tonic-gate     for (i=0; i<krb5_cksumtypes_length; i++) {
370Sstevel@tonic-gate 	if (krb5_cksumtypes_list[i].ctype == ctype) {
380Sstevel@tonic-gate 	    if (krb5_cksumtypes_list[i].keyhash ||
390Sstevel@tonic-gate 		(krb5_cksumtypes_list[i].flags &
400Sstevel@tonic-gate 		 KRB5_CKSUMFLAG_DERIVE))
410Sstevel@tonic-gate 		return(1);
420Sstevel@tonic-gate 	    else
430Sstevel@tonic-gate 		return(0);
440Sstevel@tonic-gate 	}
450Sstevel@tonic-gate     }
460Sstevel@tonic-gate 
470Sstevel@tonic-gate     /* ick, but it's better than coredumping, which is what the
480Sstevel@tonic-gate        old code would have done */
49*7934SMark.Phalan@Sun.COM     return 0;   /* error case */
500Sstevel@tonic-gate }
51*7934SMark.Phalan@Sun.COM 
52*7934SMark.Phalan@Sun.COM krb5_boolean KRB5_CALLCONV
is_keyed_cksum(krb5_cksumtype ctype)53*7934SMark.Phalan@Sun.COM is_keyed_cksum(krb5_cksumtype ctype)
54*7934SMark.Phalan@Sun.COM {
55*7934SMark.Phalan@Sun.COM     return krb5_c_is_keyed_cksum (ctype);
56*7934SMark.Phalan@Sun.COM }
57