4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 * glue routine for gss_seal
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
35 OM_uint32
*minor_status
,
36 gss_ctx_id_t context_handle
,
37 gss_buffer_t input_message_buffer
,
38 gss_buffer_t output_message_buffer
)
41 /* Initialize outputs. */
43 if (minor_status
!= NULL
)
46 if (output_message_buffer
!= GSS_C_NO_BUFFER
) {
47 output_message_buffer
->length
= 0;
48 output_message_buffer
->value
= NULL
;
51 /* Validate arguments. */
53 if (minor_status
== NULL
)
54 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
56 if (context_handle
== GSS_C_NO_CONTEXT
)
57 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
59 if (input_message_buffer
== GSS_C_NO_BUFFER
)
60 return (GSS_S_CALL_INACCESSIBLE_READ
);
62 if (output_message_buffer
== GSS_C_NO_BUFFER
)
63 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
65 return (GSS_S_COMPLETE
);
70 gss_seal(minor_status
,
76 output_message_buffer
)
78 OM_uint32
* minor_status
;
79 gss_ctx_id_t context_handle
;
82 gss_buffer_t input_message_buffer
;
84 gss_buffer_t output_message_buffer
;
87 gss_union_ctx_id_t ctx
;
90 status
= val_seal_args(minor_status
,
93 output_message_buffer
);
94 if (status
!= GSS_S_COMPLETE
)
98 * select the approprate underlying mechanism routine and
102 ctx
= (gss_union_ctx_id_t
) context_handle
;
103 mech
= __gss_get_mechanism(ctx
->mech_type
);
106 if (mech
->gss_seal
) {
107 status
= mech
->gss_seal(
110 ctx
->internal_ctx_id
,
113 input_message_buffer
,
115 output_message_buffer
);
116 if (status
!= GSS_S_COMPLETE
)
117 map_error(minor_status
, mech
);
119 status
= GSS_S_UNAVAILABLE
;
124 return (GSS_S_BAD_MECH
);
128 gss_wrap(minor_status
,
132 input_message_buffer
,
134 output_message_buffer
)
136 OM_uint32
* minor_status
;
137 const gss_ctx_id_t context_handle
;
140 const gss_buffer_t input_message_buffer
;
142 gss_buffer_t output_message_buffer
;
145 return gss_seal(minor_status
, (gss_ctx_id_t
)context_handle
,
146 conf_req_flag
, (int) qop_req
,
147 (gss_buffer_t
)input_message_buffer
, conf_state
,
148 output_message_buffer
);
155 gss_wrap_size_limit(minor_status
, context_handle
, conf_req_flag
,
156 qop_req
, req_output_size
, max_input_size
)
157 OM_uint32
*minor_status
;
158 const gss_ctx_id_t context_handle
;
161 OM_uint32 req_output_size
;
162 OM_uint32
*max_input_size
;
164 gss_union_ctx_id_t ctx
;
166 OM_uint32 major_status
;
168 if (minor_status
== NULL
)
169 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
172 if (context_handle
== GSS_C_NO_CONTEXT
)
173 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
175 if (max_input_size
== NULL
)
176 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
179 * select the approprate underlying mechanism routine and
183 ctx
= (gss_union_ctx_id_t
) context_handle
;
184 mech
= __gss_get_mechanism(ctx
->mech_type
);
187 return (GSS_S_BAD_MECH
);
189 if (mech
->gss_wrap_size_limit
)
190 major_status
= mech
->gss_wrap_size_limit(mech
->context
,
192 ctx
->internal_ctx_id
,
193 conf_req_flag
, qop_req
,
197 major_status
= GSS_S_UNAVAILABLE
;
198 if (major_status
!= GSS_S_COMPLETE
)
199 map_error(minor_status
, mech
);