xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/crypto/string_to_cksumtype.c (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (C) 1998 by the FundsXpress, INC.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * All rights reserved.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may require
77c478bd9Sstevel@tonic-gate  * a specific license from the United States Government.  It is the
87c478bd9Sstevel@tonic-gate  * responsibility of any person or organization contemplating export to
97c478bd9Sstevel@tonic-gate  * obtain such a license before exporting.
107c478bd9Sstevel@tonic-gate  *
117c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
127c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
137c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
147c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
157c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
167c478bd9Sstevel@tonic-gate  * the name of FundsXpress. not be used in advertising or publicity pertaining
177c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
187c478bd9Sstevel@tonic-gate  * permission.  FundsXpress makes no representations about the suitability of
197c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
207c478bd9Sstevel@tonic-gate  * or implied warranty.
217c478bd9Sstevel@tonic-gate  *
227c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
237c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
247c478bd9Sstevel@tonic-gate  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #include <k5-int.h>
287c478bd9Sstevel@tonic-gate #include <cksumtypes.h>
297c478bd9Sstevel@tonic-gate 
30*505d05c7Sgtb krb5_error_code KRB5_CALLCONV
krb5_string_to_cksumtype(char * string,krb5_cksumtype * cksumtypep)31*505d05c7Sgtb krb5_string_to_cksumtype(char *string, krb5_cksumtype *cksumtypep)
327c478bd9Sstevel@tonic-gate {
337c478bd9Sstevel@tonic-gate     int i;
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate     for (i=0; i<krb5_cksumtypes_length; i++) {
367c478bd9Sstevel@tonic-gate 	if (strcasecmp(krb5_cksumtypes_list[i].in_string, string) == 0) {
377c478bd9Sstevel@tonic-gate 	    *cksumtypep = krb5_cksumtypes_list[i].ctype;
387c478bd9Sstevel@tonic-gate 	    return(0);
397c478bd9Sstevel@tonic-gate 	}
407c478bd9Sstevel@tonic-gate     }
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate     return(EINVAL);
437c478bd9Sstevel@tonic-gate }
44