xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/mech/seal.c (revision ab9b2e153c3a9a2b1141fefa87925b1a9beb1236)
1 /* EXPORT DELETE START */
2 
3 /*
4  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
5  * Use is subject to license terms.
6  */
7 
8 #pragma ident	"%Z%%M%	%I%	%E% SMI"
9 
10 /*
11  * Copyright 1993 by OpenVision Technologies, Inc.
12  *
13  * Permission to use, copy, modify, distribute, and sell this software
14  * and its documentation for any purpose is hereby granted without fee,
15  * provided that the above copyright notice appears in all copies and
16  * that both that copyright notice and this permission notice appear in
17  * supporting documentation, and that the name of OpenVision not be used
18  * in advertising or publicity pertaining to distribution of the software
19  * without specific, written prior permission. OpenVision makes no
20  * representations about the suitability of this software for any
21  * purpose.  It is provided "as is" without express or implied warranty.
22  *
23  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
24  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
25  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
26  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
27  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
28  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
29  * PERFORMANCE OF THIS SOFTWARE.
30  */
31 
32 #include "gssapiP_krb5.h"
33 
34 /*
35  * $Id: seal.c 16171 2004-03-15 17:45:01Z raeburn $
36  */
37 
38 /*ARGSUSED*/
39 OM_uint32
40 krb5_gss_seal(minor_status, context_handle, conf_req_flag,
41 	      qop_req, input_message_buffer, conf_state,
42 	      output_message_buffer
43 #ifdef	 _KERNEL
44 	    , gssd_ctx_verifier
45 #endif
46 	    )
47      OM_uint32 *minor_status;
48      gss_ctx_id_t context_handle;
49      int conf_req_flag;
50      int qop_req;
51      gss_buffer_t input_message_buffer;
52      int *conf_state;
53      gss_buffer_t output_message_buffer;
54 #ifdef	 _KERNEL
55      OM_uint32 gssd_ctx_verifier;
56 #endif
57 {
58 #ifdef	KRB5_NO_PRIVACY
59  	/*
60  	 * conf_req_flag must be zero;
61  	 * encryption is disallowed
62   	 * for global version
63  	*/
64      if (conf_req_flag)
65        return (GSS_S_FAILURE);
66 #endif
67 
68    return(kg_seal(minor_status, context_handle, conf_req_flag,
69 		  qop_req, input_message_buffer, conf_state,
70 		  output_message_buffer, KG_TOK_SEAL_MSG));
71 }
72 
73 /* V2 interface */
74 OM_uint32
75 krb5_gss_wrap(minor_status, context_handle, conf_req_flag,
76 	      qop_req, input_message_buffer, conf_state,
77 	      output_message_buffer)
78     OM_uint32		*minor_status;
79     gss_ctx_id_t	context_handle;
80     int			conf_req_flag;
81     gss_qop_t		qop_req;
82     gss_buffer_t	input_message_buffer;
83     int			*conf_state;
84     gss_buffer_t	output_message_buffer;
85 {
86 #ifdef	KRB5_NO_PRIVACY
87      return (GSS_S_FAILURE);
88 #else
89      return(kg_seal(minor_status, context_handle, conf_req_flag,
90 		   (int) qop_req, input_message_buffer, conf_state,
91 		   output_message_buffer, KG_TOK_WRAP_MSG));
92 #endif
93 }
94 
95 /* EXPORT DELETE END */
96