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 gss_unseal
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
33 gss_unseal(minor_status
,
36 output_message_buffer
,
40 OM_uint32
* minor_status
;
41 gss_ctx_id_t context_handle
;
42 gss_buffer_t input_message_buffer
;
43 gss_buffer_t output_message_buffer
;
49 gss_union_ctx_id_t ctx
;
52 if (minor_status
!= NULL
)
55 if (output_message_buffer
!= GSS_C_NO_BUFFER
) {
56 output_message_buffer
->length
= 0;
57 output_message_buffer
->value
= NULL
;
60 if (minor_status
== NULL
)
61 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
63 if (context_handle
== GSS_C_NO_CONTEXT
)
64 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
66 if (input_message_buffer
== GSS_C_NO_BUFFER
||
67 GSS_EMPTY_BUFFER(input_message_buffer
))
68 return (GSS_S_CALL_INACCESSIBLE_READ
);
70 if (output_message_buffer
== GSS_C_NO_BUFFER
)
71 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
74 * select the approprate underlying mechanism routine and
78 ctx
= (gss_union_ctx_id_t
) context_handle
;
79 mech
= __gss_get_mechanism(ctx
->mech_type
);
82 if (mech
->gss_unseal
) {
83 status
= mech
->gss_unseal(
88 output_message_buffer
,
91 if (status
!= GSS_S_COMPLETE
)
92 map_error(minor_status
, mech
);
94 status
= GSS_S_UNAVAILABLE
;
99 return (GSS_S_BAD_MECH
);
103 gss_unwrap(minor_status
,
105 input_message_buffer
,
106 output_message_buffer
,
110 OM_uint32
* minor_status
;
111 const gss_ctx_id_t context_handle
;
112 const gss_buffer_t input_message_buffer
;
113 gss_buffer_t output_message_buffer
;
115 gss_qop_t
* qop_state
;
118 return (gss_unseal(minor_status
, (gss_ctx_id_t
)context_handle
,
119 (gss_buffer_t
)input_message_buffer
,
120 output_message_buffer
, conf_state
, (int *) qop_state
));