xref: /titanic_41/usr/src/lib/gss_mechs/mech_dh/backend/mech/crypto.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	crypto.h
24  *
25  *	Copyright (c) 1997, by Sun Microsystems, Inc.
26  *	All rights reserved.
27  *
28  */
29 
30 #ifndef _CRYPTO_H_
31 #define	_CRYPTO_H_
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include <rpc/des_crypt.h>
40 #include <dh_gssapi.h>
41 #include <dhmech_prot.h>
42 #include "../crypto/md5.h"
43 
44 typedef enum { ENCIPHER, DECIPHER } cipher_mode_t;
45 
46 typedef OM_uint32 (*cipher_proc)(gss_buffer_t buf,
47     dh_key_set_t keys, cipher_mode_t mode);
48 typedef OM_uint32 (*verifier_proc)(gss_buffer_t tok, gss_buffer_t msg,
49     cipher_proc signer, dh_key_set_t keys, dh_signature_t signature);
50 
51 /* Proto types */
52 
53 void
54 __dh_release_buffer(gss_buffer_t b);
55 
56 bool_t
57 __dh_is_valid_QOP(dh_qop_t qop);
58 
59 OM_uint32
60 __QOPSeal(dh_qop_t qop, gss_buffer_t input, int conf_req,
61 	dh_key_set_t keys, gss_buffer_t output, int *conf_ret);
62 
63 OM_uint32
64 __QOPUnSeal(dh_qop_t qop, gss_buffer_t input, int conf_req,
65 	    dh_key_set_t keys, gss_buffer_t output);
66 
67 bool_t
68 __cmpsig(dh_signature_t, dh_signature_t);
69 
70 OM_uint32
71 __verify_sig(dh_token_t, dh_qop_t, dh_key_set_t, dh_signature_t);
72 
73 OM_uint32
74 __get_sig_size(dh_qop_t, unsigned int *);
75 
76 OM_uint32
77 __mk_sig(dh_qop_t, char *, long, gss_buffer_t, dh_key_set_t, dh_signature_t);
78 
79 OM_uint32
80 __alloc_sig(dh_qop_t, dh_signature_t);
81 
82 bool_t
83 __dh_is_valid_QOP(dh_qop_t);
84 
85 void
86 __free_signature(dh_signature_t);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* _CRYPTO_H_ */
93