xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/crypto/mandatory_sumtype.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright 2004 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) 2003 by the Massachusetts Institute of Technology.
10  * All rights reserved.
11  *
12  * Export of this software from the United States of America may
13  *   require a specific license from the United States Government.
14  *   It is the responsibility of any person or organization contemplating
15  *   export to 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 M.I.T. not be used in advertising or publicity pertaining
23  * to distribution of the software without specific, written prior
24  * permission.  Furthermore if you modify this software you must label
25  * your software as modified software and not distribute it in such a
26  * fashion that it might be confused with the original M.I.T. software.
27  * M.I.T. makes no representations about the suitability of
28  * this software for any purpose.  It is provided "as is" without express
29  * or implied warranty.
30  */
31 
32 #include <k5-int.h>
33 #include <etypes.h>
34 
35 /*ARGSUSED*/
36 krb5_error_code
37 krb5int_c_mandatory_cksumtype (krb5_context ctx, krb5_enctype etype,
38 			       krb5_cksumtype *cksumtype)
39 {
40     int i;
41 
42     for (i = 0; i < krb5_enctypes_length; i++)
43 	if (krb5_enctypes_list[i].etype == etype) {
44 	    *cksumtype = krb5_enctypes_list[i].required_ctype;
45 	    return 0;
46 	}
47 
48     return KRB5_BAD_ENCTYPE;
49 }
50