xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/mech/unseal.c (revision 628e3cbed6489fa1db545d8524a06cd6535af456)
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: unseal.c 16171 2004-03-15 17:45:01Z raeburn $
36  */
37 
38 /*ARGSUSED*/
39 OM_uint32
40 krb5_gss_unseal(minor_status, context_handle,
41 		input_message_buffer, output_message_buffer,
42 		conf_state, qop_state
43 #ifdef	 _KERNEL
44  		, gssd_ctx_verifier
45 #endif
46 		)
47      OM_uint32 *minor_status;
48      gss_ctx_id_t context_handle;
49      gss_buffer_t input_message_buffer;
50      gss_buffer_t output_message_buffer;
51      int *conf_state;
52      int *qop_state;
53 #ifdef	 _KERNEL
54      OM_uint32 gssd_ctx_verifier;
55 #endif
56 {
57      return(kg_unseal(minor_status, context_handle,
58 		    input_message_buffer, output_message_buffer,
59 		    conf_state, qop_state, KG_TOK_SEAL_MSG));
60 }
61 
62 /* V2 interface */
63 OM_uint32
64 krb5_gss_unwrap(minor_status, context_handle,
65 		input_message_buffer, output_message_buffer,
66 		conf_state, qop_state)
67     OM_uint32		*minor_status;
68     gss_ctx_id_t	context_handle;
69     gss_buffer_t	input_message_buffer;
70     gss_buffer_t	output_message_buffer;
71     int			*conf_state;
72     gss_qop_t		*qop_state;
73 {
74 #ifdef	KRB5_NO_PRIVACY
75     return (GSS_S_FAILURE);
76 #else
77     OM_uint32		rstat;
78     int			qstate;
79 
80     rstat = kg_unseal(minor_status, context_handle,
81 		    input_message_buffer, output_message_buffer,
82 		    conf_state, &qstate, KG_TOK_WRAP_MSG);
83     if (!rstat && qop_state)
84 	*qop_state = (gss_qop_t) qstate;
85     return(rstat);
86 #endif
87 }
88 
89 /* EXPORT DELETE END */
90