Sdiff g_unseal.c
  1 /*
  2  * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
  3  * All rights reserved.
  4  */
  5 
  6 #pragma ident   "@(#)g_unseal.c 1.14    04/09/08 SMI" 
  7 
  8 /*
  9  *  glue routine gss_unseal
 10  */
 11 
 12 #include <mechglueP.h>
 13 
 14 OM_uint32
 15 gss_unseal(minor_status,
 16                 context_handle,
 17                 input_message_buffer,
 18                 output_message_buffer,
 19                 conf_state,
 20                 qop_state)
 21 
 22 OM_uint32 *             minor_status;
 23 gss_ctx_id_t            context_handle;
 24 gss_buffer_t            input_message_buffer;
 25 gss_buffer_t            output_message_buffer;
 26 int *                   conf_state;
 27 int *                   qop_state;
 28 
 29 {
 30 /* EXPORT DELETE START */
 31         OM_uint32               status;
 32         gss_union_ctx_id_t      ctx;
 33         gss_mechanism           mech;
 34 
 35         g_initialize(); 


 36 
 37         if (context_handle == GSS_C_NO_CONTEXT)
 38                 return GSS_C_NO_CONTEXT; 
 39 









 40         /*
 41          * select the approprate underlying mechanism routine and
 42          * call it.
 43          */
 44 
 45         ctx = (gss_union_ctx_id_t) context_handle;
 46         mech = __gss_get_mechanism(ctx->mech_type);
 47 
 48         if (mech) {
 49                 if (mech->gss_unseal)
 50                         status = mech->gss_unseal(
 51                                                 mech->context,
 52                                                 minor_status,
 53                                                 ctx->internal_ctx_id,
 54                                                 input_message_buffer,
 55                                                 output_message_buffer,
 56                                                 conf_state,
 57                                                 qop_state);
 58                 else
 59                         status = GSS_S_BAD_BINDINGS; 
 60 
 61                 return (status);
 62         }
 63 
 64 /* EXPORT DELETE END */
 65 
 66         return (GSS_S_NO_CONTEXT); 
 67 }
 68 
 69 OM_uint32
 70 gss_unwrap(minor_status,
 71                 context_handle,
 72                 input_message_buffer,
 73                 output_message_buffer,
 74                 conf_state,
 75                 qop_state)
 76 
 77 OM_uint32 *             minor_status;
 78 gss_ctx_id_t            context_handle; 
 79 gss_buffer_t            input_message_buffer; 
 80 gss_buffer_t            output_message_buffer;
 81 int *                   conf_state;
 82 gss_qop_t *             qop_state;
 83 
 84 {
 85         return (gss_unseal(minor_status, context_handle, 
 86                                 input_message_buffer, output_message_buffer, 
 87                                 conf_state, (int *) qop_state)); 
 88 }
  1 /*
  2  * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
  3  * All rights reserved.
  4  */
  5 
  6 #pragma ident   "@(#)g_unseal.c 1.13    98/01/22 SMI" 
  7 
  8 /*
  9  *  glue routine gss_unseal
 10  */
 11 
 12 #include <mechglueP.h>
 13 
 14 OM_uint32
 15 gss_unseal(minor_status,
 16                 context_handle,
 17                 input_message_buffer,
 18                 output_message_buffer,
 19                 conf_state,
 20                 qop_state)
 21 
 22 OM_uint32 *             minor_status;
 23 gss_ctx_id_t            context_handle;
 24 gss_buffer_t            input_message_buffer;
 25 gss_buffer_t            output_message_buffer;
 26 int *                   conf_state;
 27 int *                   qop_state;
 28 
 29 {
 30 /* EXPORT DELETE START */
 31         OM_uint32               status;
 32         gss_union_ctx_id_t      ctx;
 33         gss_mechanism           mech;
 34 
 35         if (minor_status == NULL) 
 36                 return (GSS_S_CALL_INACCESSIBLE_WRITE); 
 37         *minor_status = 0; 
 38 
 39         if (context_handle == GSS_C_NO_CONTEXT)
 40                 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); 
 41 
 42         if (GSS_EMPTY_BUFFER(input_message_buffer))
 43                 return (GSS_S_CALL_INACCESSIBLE_READ);
 44 
 45         if (output_message_buffer == NULL)
 46                 return (GSS_S_CALL_INACCESSIBLE_WRITE);
 47 
 48         output_message_buffer->length = 0;
 49         output_message_buffer->value = NULL;
 50 
 51         /*
 52          * select the approprate underlying mechanism routine and
 53          * call it.
 54          */
 55 
 56         ctx = (gss_union_ctx_id_t) context_handle;
 57         mech = __gss_get_mechanism(ctx->mech_type);
 58 
 59         if (mech) {
 60                 if (mech->gss_unseal)
 61                         status = mech->gss_unseal(
 62                                                 mech->context,
 63                                                 minor_status,
 64                                                 ctx->internal_ctx_id,
 65                                                 input_message_buffer,
 66                                                 output_message_buffer,
 67                                                 conf_state,
 68                                                 qop_state);
 69                 else
 70                         status = GSS_S_UNAVAILABLE; 
 71 
 72                 return (status);
 73         }
 74 
 75 /* EXPORT DELETE END */
 76 
 77         return (GSS_S_BAD_MECH); 
 78 }
 79 
 80 OM_uint32
 81 gss_unwrap(minor_status,
 82                 context_handle,
 83                 input_message_buffer,
 84                 output_message_buffer,
 85                 conf_state,
 86                 qop_state)
 87 
 88 OM_uint32 *             minor_status;
 89 const gss_ctx_id_t      context_handle; 
 90 const gss_buffer_t      input_message_buffer; 
 91 gss_buffer_t            output_message_buffer;
 92 int *                   conf_state;
 93 gss_qop_t *             qop_state;
 94 
 95 {
 96         return (gss_unseal(minor_status, (gss_ctx_id_t)context_handle, 
 97                         (gss_buffer_t)input_message_buffer, 
 98                         output_message_buffer, conf_state, (int *) qop_state)); 
 99 }