xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/crypto/encrypt_length.c (revision 505d05c73a6e56769f263d4803b22eddd168ee24)
17c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
27c478bd9Sstevel@tonic-gate /*
37c478bd9Sstevel@tonic-gate  * Copyright (C) 1998 by the FundsXpress, INC.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * All rights reserved.
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may require
87c478bd9Sstevel@tonic-gate  * a specific license from the United States Government.  It is the
97c478bd9Sstevel@tonic-gate  * responsibility of any person or organization contemplating export to
107c478bd9Sstevel@tonic-gate  * obtain such a license before exporting.
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
137c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
147c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
157c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
167c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
177c478bd9Sstevel@tonic-gate  * the name of FundsXpress. not be used in advertising or publicity pertaining
187c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
197c478bd9Sstevel@tonic-gate  * permission.  FundsXpress makes no representations about the suitability of
207c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
217c478bd9Sstevel@tonic-gate  * or implied warranty.
227c478bd9Sstevel@tonic-gate  *
237c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
247c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
257c478bd9Sstevel@tonic-gate  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #include <k5-int.h>
297c478bd9Sstevel@tonic-gate #include <etypes.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*ARGSUSED*/
32*505d05c7Sgtb krb5_error_code KRB5_CALLCONV
33*505d05c7Sgtb krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype,
34*505d05c7Sgtb 		    size_t inputlen, size_t *length)
357c478bd9Sstevel@tonic-gate {
367c478bd9Sstevel@tonic-gate     int i;
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate     for (i=0; i<krb5_enctypes_length; i++) {
397c478bd9Sstevel@tonic-gate 	if (krb5_enctypes_list[i].etype == enctype)
407c478bd9Sstevel@tonic-gate 	    break;
417c478bd9Sstevel@tonic-gate     }
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate     if (i == krb5_enctypes_length)
447c478bd9Sstevel@tonic-gate 	return(KRB5_BAD_ENCTYPE);
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate     (*(krb5_enctypes_list[i].encrypt_len))
477c478bd9Sstevel@tonic-gate 	(krb5_enctypes_list[i].enc, krb5_enctypes_list[i].hash,
487c478bd9Sstevel@tonic-gate 	 inputlen, length);
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate     return(0);
517c478bd9Sstevel@tonic-gate }
52