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




 40         if (context_handle == GSS_C_NO_CONTEXT)
 41                 return (GSS_S_NO_CONTEXT); 
 42 






 43         /*
 44          * select the approprate underlying mechanism routine and
 45          * call it.
 46          */
 47 
 48         ctx = (gss_union_ctx_id_t) context_handle;
 49         mech = __gss_get_mechanism(ctx->mech_type);
 50 
 51         if (mech) {
 52                 if (mech->gss_seal)
 53                         status = mech->gss_seal(
 54                                                 mech->context,
 55                                                 minor_status,
 56                                                 ctx->internal_ctx_id,
 57                                                 conf_req_flag,
 58                                                 qop_req,
 59                                                 input_message_buffer,
 60                                                 conf_state,
 61                                                 output_message_buffer);
 62                 else
 63                         status = GSS_S_BAD_BINDINGS; 
 64 
 65                 return (status);
 66         }
 67 /* EXPORT DELETE END */
 68 
 69         return (GSS_S_NO_CONTEXT); 
 70 }
 71 
 72 OM_uint32 INTERFACE 
 73 gss_wrap(minor_status,
 74                 context_handle,
 75                 conf_req_flag,
 76                 qop_req,
 77                 input_message_buffer,
 78                 conf_state,
 79                 output_message_buffer)
 80 
 81 OM_uint32 *                     minor_status;
 82 const gss_ctx_id_t              context_handle;
 83 int                             conf_req_flag;
 84 gss_qop_t                       qop_req;
 85 const gss_buffer_t              input_message_buffer;
 86 int *                           conf_state;
 87 gss_buffer_t                    output_message_buffer;
 88 
 89 {
 90                 return gss_seal(minor_status, context_handle, conf_req_flag, 
 91                                 (int) qop_req, input_message_buffer, conf_state, 

 92                                 output_message_buffer);
 93 }
 94 
 95 /*
 96  * New for V2
 97  */
 98 OM_uint32 INTERFACE 
 99 gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,
100                                 qop_req, req_output_size, max_input_size)
101         OM_uint32               *minor_status;
102         const gss_ctx_id_t      context_handle;
103         int                     conf_req_flag;
104         gss_qop_t               qop_req;
105         OM_uint32               req_output_size;
106         OM_uint32               *max_input_size;
107 {
108         OM_uint32               status; 
109         gss_union_ctx_id_t      ctx;
110         gss_mechanism           mech;
111 
112         gss_initialize(); 


113 
114         if (context_handle == GSS_C_NO_CONTEXT)
115                 return (GSS_S_NO_CONTEXT); 
116 



117         /*
118          * select the approprate underlying mechanism routine and
119          * call it.
120          */
121 
122         ctx = (gss_union_ctx_id_t) context_handle;
123         mech = __gss_get_mechanism(ctx->mech_type);
124 
125         if (!mech)
126                 return (GSS_S_NO_CONTEXT); 
127 
128         if (!mech->gss_wrap_size_limit)
129                 return (GSS_S_BAD_BINDINGS); 
130 
131         status = mech->gss_wrap_size_limit(mech->context, minor_status, 
132                                                         context_handle, 
133                                                         conf_req_flag, 
134                                                         qop_req, 
135                                                         req_output_size, 
136                                                         max_input_size); 
137         return (status); 
138 }
  1 /*
  2  * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
  3  * All rights reserved.
  4  */
  5 
  6 #pragma ident   "@(#)g_seal.c   1.19    98/04/21 SMI" 
  7 
  8 /*
  9  *  glue routine for gss_seal
 10  */
 11 
 12 #include <mechglueP.h>
 13 
 14 /*ARGSUSED*/
 15 OM_uint32 
 16 gss_seal(minor_status,
 17                 context_handle,
 18                 conf_req_flag,
 19                 qop_req,
 20                 input_message_buffer,
 21                 conf_state,
 22                 output_message_buffer)
 23 
 24 OM_uint32 *                     minor_status;
 25 gss_ctx_id_t                    context_handle;
 26 int                             conf_req_flag;
 27 int                             qop_req;
 28 gss_buffer_t                    input_message_buffer;
 29 int *                           conf_state;
 30 gss_buffer_t                    output_message_buffer;

 31 {
 32 /* EXPORT DELETE START */
 33 
 34         OM_uint32               status;
 35         gss_union_ctx_id_t      ctx;
 36         gss_mechanism           mech;
 37 
 38 
 39         if (minor_status == NULL)
 40                 return (GSS_S_CALL_INACCESSIBLE_WRITE);
 41         *minor_status = 0;
 42 
 43         if (context_handle == GSS_C_NO_CONTEXT)
 44                 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); 
 45 
 46         if (input_message_buffer == NULL)
 47                 return (GSS_S_CALL_INACCESSIBLE_READ);
 48 
 49         if (output_message_buffer == NULL)
 50                 return (GSS_S_CALL_INACCESSIBLE_WRITE);
 51 
 52         /*
 53          * select the approprate underlying mechanism routine and
 54          * call it.
 55          */
 56 
 57         ctx = (gss_union_ctx_id_t) context_handle;
 58         mech = __gss_get_mechanism(ctx->mech_type);
 59 
 60         if (mech) {
 61                 if (mech->gss_seal)
 62                         status = mech->gss_seal(
 63                                                 mech->context,
 64                                                 minor_status,
 65                                                 ctx->internal_ctx_id,
 66                                                 conf_req_flag,
 67                                                 qop_req,
 68                                                 input_message_buffer,
 69                                                 conf_state,
 70                                                 output_message_buffer);
 71                 else
 72                         status = GSS_S_UNAVAILABLE; 
 73 
 74                 return (status);
 75         }
 76 /* EXPORT DELETE END */
 77 
 78         return (GSS_S_BAD_MECH); 
 79 }
 80 
 81 OM_uint32 
 82 gss_wrap(minor_status,
 83                 context_handle,
 84                 conf_req_flag,
 85                 qop_req,
 86                 input_message_buffer,
 87                 conf_state,
 88                 output_message_buffer)
 89 
 90 OM_uint32 *                     minor_status;
 91 const gss_ctx_id_t              context_handle;
 92 int                             conf_req_flag;
 93 gss_qop_t                       qop_req;
 94 const gss_buffer_t              input_message_buffer;
 95 int *                           conf_state;
 96 gss_buffer_t                    output_message_buffer;
 97 
 98 {
 99         return gss_seal(minor_status, (gss_ctx_id_t)context_handle, 
100                         conf_req_flag, (int) qop_req, 
101                         (gss_buffer_t)input_message_buffer, conf_state, 
102                         output_message_buffer);
103 }
104 
105 /*
106  * New for V2
107  */
108 OM_uint32 
109 gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,
110                                 qop_req, req_output_size, max_input_size)
111         OM_uint32               *minor_status;
112         const gss_ctx_id_t      context_handle;
113         int                     conf_req_flag;
114         gss_qop_t               qop_req;
115         OM_uint32               req_output_size;
116         OM_uint32               *max_input_size;
117 {

118         gss_union_ctx_id_t      ctx;
119         gss_mechanism           mech;
120 
121         if (minor_status == NULL) 
122                 return (GSS_S_CALL_INACCESSIBLE_WRITE); 
123         *minor_status = 0; 
124 
125         if (context_handle == GSS_C_NO_CONTEXT)
126                 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); 
127 
128         if (max_input_size == NULL)
129                 return (GSS_S_CALL_INACCESSIBLE_WRITE);
130 
131         /*
132          * select the approprate underlying mechanism routine and
133          * call it.
134          */
135 
136         ctx = (gss_union_ctx_id_t) context_handle;
137         mech = __gss_get_mechanism(ctx->mech_type);
138 
139         if (!mech)
140                 return (GSS_S_BAD_MECH); 
141 
142         if (!mech->gss_wrap_size_limit)
143                 return (GSS_S_UNAVAILABLE); 
144 
145         return (mech->gss_wrap_size_limit(mech->context, minor_status, 
146                                 ctx->internal_ctx_id, conf_req_flag, qop_req, 
147                                 req_output_size, max_input_size)); 




148 }