rpcsec_gss_misc.c revision e36d7b1181d9f0bc91b073751e5602af8e92c0ab
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1996,1997,1999,2002-2003 Sun Microsystems, Inc.
* All rights reserved. Use is subject to license terms.
*/
/*
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
*
* $Header:
* 1994/10/27 12:39:23 jik Exp $
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <rpc/rpcsec_defs.h>
/*
* The initial allocation size for dynamic allocation.
*/
#define CKU_INITSIZE 2048
/*
* The size of additional allocations, if required. It is larger to
* reduce the number of actual allocations.
*/
#define CKU_ALLOCSIZE 8192
/*
* Miscellaneous XDR routines.
*/
{
/*
* We go through this contortion because size_t is a now a ulong,
* GSS-API uses ulongs.
*/
} else {
}
return (TRUE);
}
return (FALSE);
}
{
return (FALSE);
return (TRUE);
}
{
return (FALSE);
return (TRUE);
}
{
return (FALSE);
return (TRUE);
}
/*
* Generic routine to wrap data used by client and server sides.
*/
{
char *temp_data;
/* EXPORT DELETE START */
/* EXPORT DELETE END */
int size;
/*
* We need an extra bit for the sequence number serialized first.
*/
/*
* serialize the sequence number into tmp memory
*/
goto fail;
/*
* serialize the arguments into tmp memory
*/
goto fail;
/*
* Data to be wrapped goes in in_buf. If privacy is used,
* out_buf will have wrapped data (in_buf will no longer be
* needed). If integrity is used, out_buf will have checksum
* which will follow the data in in_buf.
*/
switch (service) {
case rpc_gss_svc_privacy:
/* EXPORT DELETE START */
goto fail;
}
if (!conf_state)
/* EXPORT DELETE END */
goto fail;
/* EXPORT DELETE START */
break;
/* EXPORT DELETE END */
case rpc_gss_svc_integrity:
&out_buf)) != GSS_S_COMPLETE) {
goto fail;
}
break;
default:
goto fail;
}
/*
* write out in_buf and out_buf as needed
*/
goto fail;
}
goto fail;
fail:
return (ret);
}
/*
* Generic routine to unwrap data used by client and server sides.
*/
{
int qop = 0;
/*
* Pull out wrapped data. For privacy service, this is the
* encrypted data. For integrity service, this is the data
* followed by a checksum.
*/
return (FALSE);
}
if (service == rpc_gss_svc_privacy) {
/* EXPORT DELETE START */
&qop);
/* EXPORT DELETE END */
if (major != GSS_S_COMPLETE) {
return (FALSE);
}
/*
* Keep the returned token (unencrypted data) in in_buf.
*/
/*
* If privacy was not used, or if QOP is not what we are
* expecting, fail.
*/
goto fail;
} else if (service == rpc_gss_svc_integrity) {
return (FALSE);
}
&qop);
if (major != GSS_S_COMPLETE) {
return (FALSE);
}
/*
* If QOP is not what we are expecting, fail.
*/
goto fail;
}
/*
* The data consists of the sequence number followed by the
* arguments. Make sure sequence number is what we are
* expecting (i.e., the value in the header).
*/
goto fail;
goto fail;
/*
* Deserialize the arguments into xdr_ptr, and release in_buf.
*/
goto fail;
}
if (service == rpc_gss_svc_privacy)
else
return (TRUE);
fail:
if (service == rpc_gss_svc_privacy)
else
return (FALSE);
}