1 /* 2 * Copyright 2005 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 <etypes.h> 36 37 krb5_boolean KRB5_CALLCONV 38 krb5_c_valid_enctype(krb5_enctype etype) 39 { 40 int i; 41 42 for (i=0; i<krb5_enctypes_length; i++) { 43 if (krb5_enctypes_list[i].etype == etype) 44 return(1); 45 } 46 47 return(0); 48 } 49 50 krb5_boolean KRB5_CALLCONV 51 valid_enctype(krb5_enctype etype) 52 { 53 return krb5_c_valid_enctype (etype); 54 } 55 56 /* Solaris kerberos: 57 * 58 * is_in_keytype(): returns 1 if enctype == one of the enctypes in keytype 59 * otherwise 0 is returned. 60 */ 61 krb5_boolean KRB5_CALLCONV 62 is_in_keytype(keytype, numkeytypes, enctype) 63 krb5_const krb5_enctype *keytype; 64 int numkeytypes; 65 krb5_enctype enctype; 66 { 67 int i; 68 69 KRB5_LOG(KRB5_INFO, "is_in_keytype() enctype = %d", enctype); 70 KRB5_LOG(KRB5_INFO, "is_in_keytype() numkeytypes = %d", numkeytypes); 71 72 if (keytype == NULL || numkeytypes <= 0) { 73 return(0); 74 } 75 76 for (i = 0; i < numkeytypes; i++) { 77 78 KRB5_LOG1(KRB5_INFO, "is_in_keytype() keytype[%d] = %d", 79 i, keytype[i]); 80 81 if (keytype[i] == enctype) { 82 KRB5_LOG0(KRB5_INFO, "is_in_keytype() end true"); 83 return(1); 84 } 85 } 86 87 KRB5_LOG0(KRB5_INFO, "is_in_keytype() end false"); 88 return(0); 89 } 90