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