1 /* 2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 7 /* 8 * Copyright (C) 1998 by the FundsXpress, INC. 9 * 10 * All rights reserved. 11 * 12 * Export of this software from the United States of America may require 13 * a specific license from the United States Government. It is the 14 * responsibility of any person or organization contemplating export to 15 * obtain such a license before exporting. 16 * 17 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 18 * distribute this software and its documentation for any purpose and 19 * without fee is hereby granted, provided that the above copyright 20 * notice appear in all copies and that both that copyright notice and 21 * this permission notice appear in supporting documentation, and that 22 * the name of FundsXpress. not be used in advertising or publicity pertaining 23 * to distribution of the software without specific, written prior 24 * permission. FundsXpress makes no representations about the suitability of 25 * this software for any purpose. It is provided "as is" without express 26 * or implied warranty. 27 * 28 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 29 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 30 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 31 */ 32 33 #include "k5-int.h" 34 #include "etypes.h" 35 36 krb5_boolean KRB5_CALLCONV 37 krb5_c_valid_enctype(krb5_enctype etype) 38 { 39 int i; 40 41 for (i=0; i<krb5_enctypes_length; i++) { 42 if (krb5_enctypes_list[i].etype == etype) 43 return(1); 44 } 45 46 return(0); 47 } 48 49 krb5_boolean KRB5_CALLCONV 50 valid_enctype(krb5_enctype etype) 51 { 52 return krb5_c_valid_enctype (etype); 53 } 54 55 /* Solaris kerberos: 56 * 57 * is_in_keytype(): returns 1 if enctype == one of the enctypes in keytype 58 * otherwise 0 is returned. 59 */ 60 krb5_boolean KRB5_CALLCONV 61 is_in_keytype(keytype, numkeytypes, enctype) 62 krb5_const krb5_enctype *keytype; 63 int numkeytypes; 64 krb5_enctype enctype; 65 { 66 int i; 67 68 KRB5_LOG(KRB5_INFO, "is_in_keytype() enctype = %d", enctype); 69 KRB5_LOG(KRB5_INFO, "is_in_keytype() numkeytypes = %d", numkeytypes); 70 71 if (keytype == NULL || numkeytypes <= 0) { 72 return(0); 73 } 74 75 for (i = 0; i < numkeytypes; i++) { 76 77 KRB5_LOG1(KRB5_INFO, "is_in_keytype() keytype[%d] = %d", 78 i, keytype[i]); 79 80 if (keytype[i] == enctype) { 81 KRB5_LOG0(KRB5_INFO, "is_in_keytype() end true"); 82 return(1); 83 } 84 } 85 86 KRB5_LOG0(KRB5_INFO, "is_in_keytype() end false"); 87 return(0); 88 } 89