17c478bd9Sstevel@tonic-gate /*
2*159d09a2SMark Phalan  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate 
77c478bd9Sstevel@tonic-gate /*
87c478bd9Sstevel@tonic-gate  * Copyright 1993 by OpenVision Technologies, Inc.
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, distribute, and sell this software
117c478bd9Sstevel@tonic-gate  * and its documentation for any purpose is hereby granted without fee,
127c478bd9Sstevel@tonic-gate  * provided that the above copyright notice appears in all copies and
137c478bd9Sstevel@tonic-gate  * that both that copyright notice and this permission notice appear in
147c478bd9Sstevel@tonic-gate  * supporting documentation, and that the name of OpenVision not be used
157c478bd9Sstevel@tonic-gate  * in advertising or publicity pertaining to distribution of the software
167c478bd9Sstevel@tonic-gate  * without specific, written prior permission. OpenVision makes no
177c478bd9Sstevel@tonic-gate  * representations about the suitability of this software for any
187c478bd9Sstevel@tonic-gate  * purpose.  It is provided "as is" without express or implied warranty.
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
217c478bd9Sstevel@tonic-gate  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
227c478bd9Sstevel@tonic-gate  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
237c478bd9Sstevel@tonic-gate  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
247c478bd9Sstevel@tonic-gate  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
257c478bd9Sstevel@tonic-gate  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
267c478bd9Sstevel@tonic-gate  * PERFORMANCE OF THIS SOFTWARE.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
29ab9b2e15Sgtb #include "gssapiP_krb5.h"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
32ab9b2e15Sgtb  * $Id: unseal.c 16171 2004-03-15 17:45:01Z raeburn $
337c478bd9Sstevel@tonic-gate  */
34ab9b2e15Sgtb 
357c478bd9Sstevel@tonic-gate /*ARGSUSED*/
367c478bd9Sstevel@tonic-gate OM_uint32
krb5_gss_unseal(minor_status,context_handle,input_message_buffer,output_message_buffer,conf_state,qop_state,gssd_ctx_verifier)37ab9b2e15Sgtb krb5_gss_unseal(minor_status, context_handle,
387c478bd9Sstevel@tonic-gate 		input_message_buffer, output_message_buffer,
397c478bd9Sstevel@tonic-gate 		conf_state, qop_state
407c478bd9Sstevel@tonic-gate #ifdef	 _KERNEL
41ab9b2e15Sgtb  		, gssd_ctx_verifier
427c478bd9Sstevel@tonic-gate #endif
43ab9b2e15Sgtb 		)
447c478bd9Sstevel@tonic-gate      OM_uint32 *minor_status;
457c478bd9Sstevel@tonic-gate      gss_ctx_id_t context_handle;
467c478bd9Sstevel@tonic-gate      gss_buffer_t input_message_buffer;
477c478bd9Sstevel@tonic-gate      gss_buffer_t output_message_buffer;
487c478bd9Sstevel@tonic-gate      int *conf_state;
497c478bd9Sstevel@tonic-gate      int *qop_state;
507c478bd9Sstevel@tonic-gate #ifdef	 _KERNEL
51ab9b2e15Sgtb      OM_uint32 gssd_ctx_verifier;
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate {
54*159d09a2SMark Phalan    return(kg_unseal(minor_status, context_handle,
557c478bd9Sstevel@tonic-gate 		    input_message_buffer, output_message_buffer,
56ab9b2e15Sgtb 		    conf_state, qop_state, KG_TOK_SEAL_MSG));
577c478bd9Sstevel@tonic-gate }
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* V2 interface */
607c478bd9Sstevel@tonic-gate OM_uint32
krb5_gss_unwrap(minor_status,context_handle,input_message_buffer,output_message_buffer,conf_state,qop_state)61ab9b2e15Sgtb krb5_gss_unwrap(minor_status, context_handle,
627c478bd9Sstevel@tonic-gate 		input_message_buffer, output_message_buffer,
637c478bd9Sstevel@tonic-gate 		conf_state, qop_state)
647c478bd9Sstevel@tonic-gate     OM_uint32		*minor_status;
657c478bd9Sstevel@tonic-gate     gss_ctx_id_t	context_handle;
667c478bd9Sstevel@tonic-gate     gss_buffer_t	input_message_buffer;
677c478bd9Sstevel@tonic-gate     gss_buffer_t	output_message_buffer;
687c478bd9Sstevel@tonic-gate     int			*conf_state;
697c478bd9Sstevel@tonic-gate     gss_qop_t		*qop_state;
707c478bd9Sstevel@tonic-gate {
717c478bd9Sstevel@tonic-gate #ifdef	KRB5_NO_PRIVACY
72ab9b2e15Sgtb     return (GSS_S_FAILURE);
737c478bd9Sstevel@tonic-gate #else
74ab9b2e15Sgtb     OM_uint32		rstat;
75ab9b2e15Sgtb     int			qstate;
767c478bd9Sstevel@tonic-gate 
77ab9b2e15Sgtb     rstat = kg_unseal(minor_status, context_handle,
78*159d09a2SMark Phalan 		      input_message_buffer, output_message_buffer,
79*159d09a2SMark Phalan 		      conf_state, &qstate, KG_TOK_WRAP_MSG);
80ab9b2e15Sgtb     if (!rstat && qop_state)
817c478bd9Sstevel@tonic-gate 	*qop_state = (gss_qop_t) qstate;
82ab9b2e15Sgtb     return(rstat);
837c478bd9Sstevel@tonic-gate #endif
847c478bd9Sstevel@tonic-gate }
85