xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/crypto/encrypt_length.c (revision 7c478bd95313f5f23a4c958a745db2134aa0324)
1*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
2*7c478bd9Sstevel@tonic-gate /*
3*7c478bd9Sstevel@tonic-gate  * Copyright (C) 1998 by the FundsXpress, INC.
4*7c478bd9Sstevel@tonic-gate  *
5*7c478bd9Sstevel@tonic-gate  * All rights reserved.
6*7c478bd9Sstevel@tonic-gate  *
7*7c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may require
8*7c478bd9Sstevel@tonic-gate  * a specific license from the United States Government.  It is the
9*7c478bd9Sstevel@tonic-gate  * responsibility of any person or organization contemplating export to
10*7c478bd9Sstevel@tonic-gate  * obtain such a license before exporting.
11*7c478bd9Sstevel@tonic-gate  *
12*7c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13*7c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
14*7c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
15*7c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
16*7c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
17*7c478bd9Sstevel@tonic-gate  * the name of FundsXpress. not be used in advertising or publicity pertaining
18*7c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
19*7c478bd9Sstevel@tonic-gate  * permission.  FundsXpress makes no representations about the suitability of
20*7c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
21*7c478bd9Sstevel@tonic-gate  * or implied warranty.
22*7c478bd9Sstevel@tonic-gate  *
23*7c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
24*7c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
25*7c478bd9Sstevel@tonic-gate  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26*7c478bd9Sstevel@tonic-gate  */
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #include <k5-int.h>
29*7c478bd9Sstevel@tonic-gate #include <etypes.h>
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
32*7c478bd9Sstevel@tonic-gate KRB5_DLLIMP krb5_error_code KRB5_CALLCONV
33*7c478bd9Sstevel@tonic-gate krb5_c_encrypt_length(context, enctype, inputlen, length)
34*7c478bd9Sstevel@tonic-gate      krb5_context context;
35*7c478bd9Sstevel@tonic-gate      krb5_enctype enctype;
36*7c478bd9Sstevel@tonic-gate      size_t inputlen;
37*7c478bd9Sstevel@tonic-gate      size_t *length;
38*7c478bd9Sstevel@tonic-gate {
39*7c478bd9Sstevel@tonic-gate     int i;
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate     for (i=0; i<krb5_enctypes_length; i++) {
42*7c478bd9Sstevel@tonic-gate 	if (krb5_enctypes_list[i].etype == enctype)
43*7c478bd9Sstevel@tonic-gate 	    break;
44*7c478bd9Sstevel@tonic-gate     }
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate     if (i == krb5_enctypes_length)
47*7c478bd9Sstevel@tonic-gate 	return(KRB5_BAD_ENCTYPE);
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate     (*(krb5_enctypes_list[i].encrypt_len))
50*7c478bd9Sstevel@tonic-gate 	(krb5_enctypes_list[i].enc, krb5_enctypes_list[i].hash,
51*7c478bd9Sstevel@tonic-gate 	 inputlen, length);
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate     return(0);
54*7c478bd9Sstevel@tonic-gate }
55