1*7c64d375Smp153739 /*
2*7c64d375Smp153739 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3*7c64d375Smp153739 * Use is subject to license terms.
4*7c64d375Smp153739 */
5*7c64d375Smp153739
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate * Copyright (C) 1998 by the FundsXpress, INC.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * All rights reserved.
107c478bd9Sstevel@tonic-gate *
117c478bd9Sstevel@tonic-gate * Export of this software from the United States of America may require
127c478bd9Sstevel@tonic-gate * a specific license from the United States Government. It is the
137c478bd9Sstevel@tonic-gate * responsibility of any person or organization contemplating export to
147c478bd9Sstevel@tonic-gate * obtain such a license before exporting.
157c478bd9Sstevel@tonic-gate *
167c478bd9Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
177c478bd9Sstevel@tonic-gate * distribute this software and its documentation for any purpose and
187c478bd9Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
197c478bd9Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
207c478bd9Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that
217c478bd9Sstevel@tonic-gate * the name of FundsXpress. not be used in advertising or publicity pertaining
227c478bd9Sstevel@tonic-gate * to distribution of the software without specific, written prior
237c478bd9Sstevel@tonic-gate * permission. FundsXpress makes no representations about the suitability of
247c478bd9Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express
257c478bd9Sstevel@tonic-gate * or implied warranty.
267c478bd9Sstevel@tonic-gate *
277c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
287c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
297c478bd9Sstevel@tonic-gate * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
307c478bd9Sstevel@tonic-gate */
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate #include <k5-int.h>
337c478bd9Sstevel@tonic-gate #include <etypes.h>
34505d05c7Sgtb krb5_error_code KRB5_CALLCONV
krb5_enctype_to_string(krb5_enctype enctype,char * buffer,size_t buflen)35505d05c7Sgtb krb5_enctype_to_string(krb5_enctype enctype, char *buffer, size_t buflen)
367c478bd9Sstevel@tonic-gate {
377c478bd9Sstevel@tonic-gate int i;
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate for (i=0; i<krb5_enctypes_length; i++) {
407c478bd9Sstevel@tonic-gate if (krb5_enctypes_list[i].etype == enctype) {
417c478bd9Sstevel@tonic-gate if ((strlen(krb5_enctypes_list[i].out_string)+1) > buflen)
427c478bd9Sstevel@tonic-gate return(ENOMEM);
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate strcpy(buffer, krb5_enctypes_list[i].out_string);
457c478bd9Sstevel@tonic-gate return(0);
467c478bd9Sstevel@tonic-gate }
477c478bd9Sstevel@tonic-gate }
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate return(EINVAL);
507c478bd9Sstevel@tonic-gate }
51*7c64d375Smp153739
52*7c64d375Smp153739 /* Solaris Kerberos */
53*7c64d375Smp153739 krb5_error_code KRB5_CALLCONV
krb5_enctype_to_istring(krb5_enctype enctype,char * buffer,size_t buflen)54*7c64d375Smp153739 krb5_enctype_to_istring(krb5_enctype enctype, char *buffer, size_t buflen)
55*7c64d375Smp153739 {
56*7c64d375Smp153739 int i;
57*7c64d375Smp153739
58*7c64d375Smp153739 for (i=0; i<krb5_enctypes_length; i++) {
59*7c64d375Smp153739 if (krb5_enctypes_list[i].etype == enctype) {
60*7c64d375Smp153739 if ((strlen(krb5_enctypes_list[i].in_string)+1) > buflen)
61*7c64d375Smp153739 return(ENOMEM);
62*7c64d375Smp153739
63*7c64d375Smp153739 strlcpy(buffer, krb5_enctypes_list[i].in_string, buflen);
64*7c64d375Smp153739 return(0);
65*7c64d375Smp153739 }
66*7c64d375Smp153739 }
67*7c64d375Smp153739
68*7c64d375Smp153739 return(EINVAL);
69*7c64d375Smp153739 }
70