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