17c478bd9Sstevel@tonic-gate /*
2159d09a2SMark Phalan * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
37c478bd9Sstevel@tonic-gate * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate */
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gate
77c478bd9Sstevel@tonic-gate /*
87c478bd9Sstevel@tonic-gate * Copyright (C) 1998 by the FundsXpress, INC.
9*55fea89dSDan Cross *
107c478bd9Sstevel@tonic-gate * All rights reserved.
11*55fea89dSDan Cross *
127c478bd9Sstevel@tonic-gate * Export of this software from the United States of America may require
137c478bd9Sstevel@tonic-gate * a specific license from the United States Government. It is the
147c478bd9Sstevel@tonic-gate * responsibility of any person or organization contemplating export to
157c478bd9Sstevel@tonic-gate * obtain such a license before exporting.
16*55fea89dSDan Cross *
177c478bd9Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
187c478bd9Sstevel@tonic-gate * distribute this software and its documentation for any purpose and
197c478bd9Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
207c478bd9Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
217c478bd9Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that
227c478bd9Sstevel@tonic-gate * the name of FundsXpress. not be used in advertising or publicity pertaining
237c478bd9Sstevel@tonic-gate * to distribution of the software without specific, written prior
247c478bd9Sstevel@tonic-gate * permission. FundsXpress makes no representations about the suitability of
257c478bd9Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express
267c478bd9Sstevel@tonic-gate * or implied warranty.
27*55fea89dSDan Cross *
287c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
297c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
307c478bd9Sstevel@tonic-gate * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
317c478bd9Sstevel@tonic-gate */
327c478bd9Sstevel@tonic-gate
33159d09a2SMark Phalan #include "k5-int.h"
34159d09a2SMark Phalan #include "etypes.h"
357c478bd9Sstevel@tonic-gate
36505d05c7Sgtb krb5_boolean KRB5_CALLCONV
krb5_c_valid_enctype(krb5_enctype etype)37505d05c7Sgtb krb5_c_valid_enctype(krb5_enctype etype)
387c478bd9Sstevel@tonic-gate {
397c478bd9Sstevel@tonic-gate int i;
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate for (i=0; i<krb5_enctypes_length; i++) {
427c478bd9Sstevel@tonic-gate if (krb5_enctypes_list[i].etype == etype)
437c478bd9Sstevel@tonic-gate return(1);
447c478bd9Sstevel@tonic-gate }
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate return(0);
477c478bd9Sstevel@tonic-gate }
487c478bd9Sstevel@tonic-gate
49505d05c7Sgtb krb5_boolean KRB5_CALLCONV
valid_enctype(krb5_enctype etype)50505d05c7Sgtb valid_enctype(krb5_enctype etype)
51505d05c7Sgtb {
52505d05c7Sgtb return krb5_c_valid_enctype (etype);
53505d05c7Sgtb }
54505d05c7Sgtb
557c478bd9Sstevel@tonic-gate /* Solaris kerberos:
567c478bd9Sstevel@tonic-gate *
577c478bd9Sstevel@tonic-gate * is_in_keytype(): returns 1 if enctype == one of the enctypes in keytype
587c478bd9Sstevel@tonic-gate * otherwise 0 is returned.
597c478bd9Sstevel@tonic-gate */
60505d05c7Sgtb krb5_boolean KRB5_CALLCONV
is_in_keytype(keytype,numkeytypes,enctype)617c478bd9Sstevel@tonic-gate is_in_keytype(keytype, numkeytypes, enctype)
627c478bd9Sstevel@tonic-gate krb5_const krb5_enctype *keytype;
637c478bd9Sstevel@tonic-gate int numkeytypes;
647c478bd9Sstevel@tonic-gate krb5_enctype enctype;
657c478bd9Sstevel@tonic-gate {
667c478bd9Sstevel@tonic-gate int i;
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate KRB5_LOG(KRB5_INFO, "is_in_keytype() enctype = %d", enctype);
697c478bd9Sstevel@tonic-gate KRB5_LOG(KRB5_INFO, "is_in_keytype() numkeytypes = %d", numkeytypes);
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gate if (keytype == NULL || numkeytypes <= 0) {
727c478bd9Sstevel@tonic-gate return(0);
737c478bd9Sstevel@tonic-gate }
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate for (i = 0; i < numkeytypes; i++) {
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate KRB5_LOG1(KRB5_INFO, "is_in_keytype() keytype[%d] = %d",
787c478bd9Sstevel@tonic-gate i, keytype[i]);
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate if (keytype[i] == enctype) {
817c478bd9Sstevel@tonic-gate KRB5_LOG0(KRB5_INFO, "is_in_keytype() end true");
827c478bd9Sstevel@tonic-gate return(1);
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate KRB5_LOG0(KRB5_INFO, "is_in_keytype() end false");
877c478bd9Sstevel@tonic-gate return(0);
887c478bd9Sstevel@tonic-gate }
89