|
Packit |
fd8b60 |
/* #pragma ident "@(#)g_sign.c 1.14 98/04/23 SMI" */
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* Copyright 1996 by Sun Microsystems, Inc.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* Permission to use, copy, modify, distribute, and sell this software
|
|
Packit |
fd8b60 |
* and its documentation for any purpose is hereby granted without fee,
|
|
Packit |
fd8b60 |
* provided that the above copyright notice appears in all copies and
|
|
Packit |
fd8b60 |
* that both that copyright notice and this permission notice appear in
|
|
Packit |
fd8b60 |
* supporting documentation, and that the name of Sun Microsystems not be used
|
|
Packit |
fd8b60 |
* in advertising or publicity pertaining to distribution of the software
|
|
Packit |
fd8b60 |
* without specific, written prior permission. Sun Microsystems makes no
|
|
Packit |
fd8b60 |
* representations about the suitability of this software for any
|
|
Packit |
fd8b60 |
* purpose. It is provided "as is" without express or implied warranty.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
Packit |
fd8b60 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
Packit |
fd8b60 |
* EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
Packit |
fd8b60 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
|
Packit |
fd8b60 |
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
Packit |
fd8b60 |
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
Packit |
fd8b60 |
* PERFORMANCE OF THIS SOFTWARE.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* glue routine gss_get_mic
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#include "mglueP.h"
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
static OM_uint32
|
|
Packit |
fd8b60 |
val_get_mic_args(
|
|
Packit |
fd8b60 |
OM_uint32 *minor_status,
|
|
Packit |
fd8b60 |
gss_ctx_id_t context_handle,
|
|
Packit |
fd8b60 |
gss_qop_t qop_req,
|
|
Packit |
fd8b60 |
gss_buffer_t message_buffer,
|
|
Packit |
fd8b60 |
gss_buffer_t msg_token)
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/* Initialize outputs. */
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (minor_status != NULL)
|
|
Packit |
fd8b60 |
*minor_status = 0;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (msg_token != GSS_C_NO_BUFFER) {
|
|
Packit |
fd8b60 |
msg_token->value = NULL;
|
|
Packit |
fd8b60 |
msg_token->length = 0;
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/* Validate arguments. */
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (minor_status == NULL)
|
|
Packit |
fd8b60 |
return (GSS_S_CALL_INACCESSIBLE_WRITE);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (context_handle == GSS_C_NO_CONTEXT)
|
|
Packit |
fd8b60 |
return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (message_buffer == GSS_C_NO_BUFFER)
|
|
Packit |
fd8b60 |
return (GSS_S_CALL_INACCESSIBLE_READ);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (msg_token == GSS_C_NO_BUFFER)
|
|
Packit |
fd8b60 |
return (GSS_S_CALL_INACCESSIBLE_WRITE);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
return (GSS_S_COMPLETE);
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
OM_uint32 KRB5_CALLCONV
|
|
Packit |
fd8b60 |
gss_get_mic (minor_status,
|
|
Packit |
fd8b60 |
context_handle,
|
|
Packit |
fd8b60 |
qop_req,
|
|
Packit |
fd8b60 |
message_buffer,
|
|
Packit |
fd8b60 |
msg_token)
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
OM_uint32 * minor_status;
|
|
Packit |
fd8b60 |
gss_ctx_id_t context_handle;
|
|
Packit |
fd8b60 |
gss_qop_t qop_req;
|
|
Packit |
fd8b60 |
gss_buffer_t message_buffer;
|
|
Packit |
fd8b60 |
gss_buffer_t msg_token;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
OM_uint32 status;
|
|
Packit |
fd8b60 |
gss_union_ctx_id_t ctx;
|
|
Packit |
fd8b60 |
gss_mechanism mech;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
status = val_get_mic_args(minor_status, context_handle,
|
|
Packit |
fd8b60 |
qop_req, message_buffer, msg_token);
|
|
Packit |
fd8b60 |
if (status != GSS_S_COMPLETE)
|
|
Packit |
fd8b60 |
return (status);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* select the approprate underlying mechanism routine and
|
|
Packit |
fd8b60 |
* call it.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
ctx = (gss_union_ctx_id_t) context_handle;
|
|
Packit |
fd8b60 |
if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)
|
|
Packit |
fd8b60 |
return (GSS_S_NO_CONTEXT);
|
|
Packit |
fd8b60 |
mech = gssint_get_mechanism (ctx->mech_type);
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
if (mech) {
|
|
Packit |
fd8b60 |
if (mech->gss_get_mic) {
|
|
Packit |
fd8b60 |
status = mech->gss_get_mic(
|
|
Packit |
fd8b60 |
minor_status,
|
|
Packit |
fd8b60 |
ctx->internal_ctx_id,
|
|
Packit |
fd8b60 |
qop_req,
|
|
Packit |
fd8b60 |
message_buffer,
|
|
Packit |
fd8b60 |
msg_token);
|
|
Packit |
fd8b60 |
if (status != GSS_S_COMPLETE)
|
|
Packit |
fd8b60 |
map_error(minor_status, mech);
|
|
Packit |
fd8b60 |
} else
|
|
Packit |
fd8b60 |
status = GSS_S_UNAVAILABLE;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
return(status);
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
return (GSS_S_BAD_MECH);
|
|
Packit |
fd8b60 |
}
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
OM_uint32 KRB5_CALLCONV
|
|
Packit |
fd8b60 |
gss_sign (minor_status,
|
|
Packit |
fd8b60 |
context_handle,
|
|
Packit |
fd8b60 |
qop_req,
|
|
Packit |
fd8b60 |
message_buffer,
|
|
Packit |
fd8b60 |
msg_token)
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
OM_uint32 * minor_status;
|
|
Packit |
fd8b60 |
gss_ctx_id_t context_handle;
|
|
Packit |
fd8b60 |
int qop_req;
|
|
Packit |
fd8b60 |
gss_buffer_t message_buffer;
|
|
Packit |
fd8b60 |
gss_buffer_t msg_token;
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
{
|
|
Packit |
fd8b60 |
return (gss_get_mic(minor_status, context_handle, (gss_qop_t) qop_req,
|
|
Packit |
fd8b60 |
message_buffer, msg_token));
|
|
Packit |
fd8b60 |
}
|