xref: /illumos-gate/usr/src/lib/gss_mechs/mech_dh/backend/mech/crypto.h (revision 59d65d3175825093531e82f44269d948ed510a00)
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 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <rpc/des_crypt.h>
38 #include <dh_gssapi.h>
39 #include <dhmech_prot.h>
40 #include "../crypto/md5.h"
41 
42 typedef enum { ENCIPHER, DECIPHER } cipher_mode_t;
43 
44 typedef OM_uint32 (*cipher_proc)(gss_buffer_t buf,
45     dh_key_set_t keys, cipher_mode_t mode);
46 typedef OM_uint32 (*verifier_proc)(gss_buffer_t tok, gss_buffer_t msg,
47     cipher_proc signer, dh_key_set_t keys, dh_signature_t signature);
48 
49 /* Proto types */
50 
51 void
52 __dh_release_buffer(gss_buffer_t b);
53 
54 bool_t
55 __dh_is_valid_QOP(dh_qop_t qop);
56 
57 OM_uint32
58 __QOPSeal(dh_qop_t qop, gss_buffer_t input, int conf_req,
59 	dh_key_set_t keys, gss_buffer_t output, int *conf_ret);
60 
61 OM_uint32
62 __QOPUnSeal(dh_qop_t qop, gss_buffer_t input, int conf_req,
63 	    dh_key_set_t keys, gss_buffer_t output);
64 
65 bool_t
66 __cmpsig(dh_signature_t, dh_signature_t);
67 
68 OM_uint32
69 __verify_sig(dh_token_t, dh_qop_t, dh_key_set_t, dh_signature_t);
70 
71 OM_uint32
72 __get_sig_size(dh_qop_t, unsigned int *);
73 
74 OM_uint32
75 __mk_sig(dh_qop_t, char *, long, gss_buffer_t, dh_key_set_t, dh_signature_t);
76 
77 OM_uint32
78 __alloc_sig(dh_qop_t, dh_signature_t);
79 
80 bool_t
81 __dh_is_valid_QOP(dh_qop_t);
82 
83 void
84 __free_signature(dh_signature_t);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* _CRYPTO_H_ */
91