17c478bd9Sstevel@tonic-gate /*
2*ab9b2e15Sgtb  * Copyright 2007 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  * Copyright 1993 by OpenVision Technologies, Inc.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, distribute, and sell this software
107c478bd9Sstevel@tonic-gate  * and its documentation for any purpose is hereby granted without fee,
117c478bd9Sstevel@tonic-gate  * provided that the above copyright notice appears in all copies and
127c478bd9Sstevel@tonic-gate  * that both that copyright notice and this permission notice appear in
137c478bd9Sstevel@tonic-gate  * supporting documentation, and that the name of OpenVision not be used
147c478bd9Sstevel@tonic-gate  * in advertising or publicity pertaining to distribution of the software
157c478bd9Sstevel@tonic-gate  * without specific, written prior permission. OpenVision makes no
167c478bd9Sstevel@tonic-gate  * representations about the suitability of this software for any
177c478bd9Sstevel@tonic-gate  * purpose.  It is provided "as is" without express or implied warranty.
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
207c478bd9Sstevel@tonic-gate  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
217c478bd9Sstevel@tonic-gate  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
227c478bd9Sstevel@tonic-gate  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
237c478bd9Sstevel@tonic-gate  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
247c478bd9Sstevel@tonic-gate  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
257c478bd9Sstevel@tonic-gate  * PERFORMANCE OF THIS SOFTWARE.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
28*ab9b2e15Sgtb #include "gssapiP_krb5.h"
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
31*ab9b2e15Sgtb  * $Id: seal.c 16171 2004-03-15 17:45:01Z raeburn $
327c478bd9Sstevel@tonic-gate  */
33*ab9b2e15Sgtb 
347c478bd9Sstevel@tonic-gate /*ARGSUSED*/
357c478bd9Sstevel@tonic-gate OM_uint32
36*ab9b2e15Sgtb krb5_gss_seal(minor_status, context_handle, conf_req_flag,
377c478bd9Sstevel@tonic-gate 	      qop_req, input_message_buffer, conf_state,
387c478bd9Sstevel@tonic-gate 	      output_message_buffer
397c478bd9Sstevel@tonic-gate #ifdef	 _KERNEL
40*ab9b2e15Sgtb 	    , gssd_ctx_verifier
417c478bd9Sstevel@tonic-gate #endif
42*ab9b2e15Sgtb 	    )
437c478bd9Sstevel@tonic-gate      OM_uint32 *minor_status;
447c478bd9Sstevel@tonic-gate      gss_ctx_id_t context_handle;
457c478bd9Sstevel@tonic-gate      int conf_req_flag;
467c478bd9Sstevel@tonic-gate      int qop_req;
477c478bd9Sstevel@tonic-gate      gss_buffer_t input_message_buffer;
487c478bd9Sstevel@tonic-gate      int *conf_state;
497c478bd9Sstevel@tonic-gate      gss_buffer_t output_message_buffer;
507c478bd9Sstevel@tonic-gate #ifdef	 _KERNEL
51*ab9b2e15Sgtb      OM_uint32 gssd_ctx_verifier;
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate {
547c478bd9Sstevel@tonic-gate #ifdef	KRB5_NO_PRIVACY
55*ab9b2e15Sgtb  	/*
56*ab9b2e15Sgtb  	 * conf_req_flag must be zero;
57*ab9b2e15Sgtb  	 * encryption is disallowed
58*ab9b2e15Sgtb   	 * for global version
59*ab9b2e15Sgtb  	*/
60*ab9b2e15Sgtb      if (conf_req_flag)
61*ab9b2e15Sgtb        return (GSS_S_FAILURE);
627c478bd9Sstevel@tonic-gate #endif
63*ab9b2e15Sgtb 
64*ab9b2e15Sgtb    return(kg_seal(minor_status, context_handle, conf_req_flag,
657c478bd9Sstevel@tonic-gate 		  qop_req, input_message_buffer, conf_state,
66*ab9b2e15Sgtb 		  output_message_buffer, KG_TOK_SEAL_MSG));
677c478bd9Sstevel@tonic-gate }
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* V2 interface */
707c478bd9Sstevel@tonic-gate OM_uint32
71*ab9b2e15Sgtb krb5_gss_wrap(minor_status, context_handle, conf_req_flag,
727c478bd9Sstevel@tonic-gate 	      qop_req, input_message_buffer, conf_state,
737c478bd9Sstevel@tonic-gate 	      output_message_buffer)
747c478bd9Sstevel@tonic-gate     OM_uint32		*minor_status;
757c478bd9Sstevel@tonic-gate     gss_ctx_id_t	context_handle;
767c478bd9Sstevel@tonic-gate     int			conf_req_flag;
777c478bd9Sstevel@tonic-gate     gss_qop_t		qop_req;
787c478bd9Sstevel@tonic-gate     gss_buffer_t	input_message_buffer;
797c478bd9Sstevel@tonic-gate     int			*conf_state;
807c478bd9Sstevel@tonic-gate     gss_buffer_t	output_message_buffer;
817c478bd9Sstevel@tonic-gate {
827c478bd9Sstevel@tonic-gate #ifdef	KRB5_NO_PRIVACY
83*ab9b2e15Sgtb      return (GSS_S_FAILURE);
847c478bd9Sstevel@tonic-gate #else
85*ab9b2e15Sgtb      return(kg_seal(minor_status, context_handle, conf_req_flag,
867c478bd9Sstevel@tonic-gate 		   (int) qop_req, input_message_buffer, conf_state,
87*ab9b2e15Sgtb 		   output_message_buffer, KG_TOK_WRAP_MSG));
887c478bd9Sstevel@tonic-gate #endif
897c478bd9Sstevel@tonic-gate }
90