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_sign
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
34 OM_uint32
*minor_status
,
35 gss_ctx_id_t context_handle
,
36 gss_buffer_t message_buffer
,
37 gss_buffer_t msg_token
)
40 /* Initialize outputs. */
42 if (minor_status
!= NULL
)
45 if (msg_token
!= GSS_C_NO_BUFFER
) {
46 msg_token
->value
= NULL
;
47 msg_token
->length
= 0;
50 /* Validate arguments. */
52 if (minor_status
== NULL
)
53 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
55 if (context_handle
== GSS_C_NO_CONTEXT
)
56 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
58 if (message_buffer
== GSS_C_NO_BUFFER
)
59 return (GSS_S_CALL_INACCESSIBLE_READ
);
61 if (msg_token
== GSS_C_NO_BUFFER
)
62 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
64 return (GSS_S_COMPLETE
);
68 gss_sign(minor_status
,
74 OM_uint32
* minor_status
;
75 gss_ctx_id_t context_handle
;
77 gss_buffer_t message_buffer
;
78 gss_buffer_t msg_token
;
82 gss_union_ctx_id_t ctx
;
85 status
= val_sign_args(minor_status
, context_handle
,
86 message_buffer
, msg_token
);
87 if (status
!= GSS_S_COMPLETE
)
91 * select the approprate underlying mechanism routine and
95 ctx
= (gss_union_ctx_id_t
) context_handle
;
96 mech
= __gss_get_mechanism(ctx
->mech_type
);
100 status
= mech
->gss_sign(
103 ctx
->internal_ctx_id
,
107 if (status
!= GSS_S_COMPLETE
)
108 map_error(minor_status
, mech
);
110 status
= GSS_S_UNAVAILABLE
;
115 return (GSS_S_BAD_MECH
);
119 gss_get_mic(minor_status
,
125 OM_uint32
* minor_status
;
126 const gss_ctx_id_t context_handle
;
128 const gss_buffer_t message_buffer
;
129 gss_buffer_t msg_token
;
132 return (gss_sign(minor_status
, (gss_ctx_id_t
)context_handle
,
133 (int) qop_req
, (gss_buffer_t
)message_buffer
, msg_token
));