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