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