161961e0fSrobinson /*
261961e0fSrobinson * CDDL HEADER START
361961e0fSrobinson *
461961e0fSrobinson * The contents of this file are subject to the terms of the
561961e0fSrobinson * Common Development and Distribution License, Version 1.0 only
661961e0fSrobinson * (the "License"). You may not use this file except in compliance
761961e0fSrobinson * with the License.
861961e0fSrobinson *
961961e0fSrobinson * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1061961e0fSrobinson * or http://www.opensolaris.org/os/licensing.
1161961e0fSrobinson * See the License for the specific language governing permissions
1261961e0fSrobinson * and limitations under the License.
1361961e0fSrobinson *
1461961e0fSrobinson * When distributing Covered Code, include this CDDL HEADER in each
1561961e0fSrobinson * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1661961e0fSrobinson * If applicable, add the following below this CDDL HEADER, with the
1761961e0fSrobinson * fields enclosed by brackets "[]" replaced with your own identifying
1861961e0fSrobinson * information: Portions Copyright [yyyy] [name of copyright owner]
1961961e0fSrobinson *
2061961e0fSrobinson * CDDL HEADER END
2161961e0fSrobinson */
2261961e0fSrobinson
2361961e0fSrobinson /*
24*e8031f0aSraf * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2561961e0fSrobinson * Use is subject to license terms.
2661961e0fSrobinson */
2761961e0fSrobinson
2861961e0fSrobinson #pragma ident "%Z%%M% %I% %E% SMI"
2961961e0fSrobinson
30*e8031f0aSraf #include "mt.h"
3161961e0fSrobinson #include <rpc/rpc.h>
3261961e0fSrobinson #include <rpc/key_prot.h>
3361961e0fSrobinson
3461961e0fSrobinson /*
3561961e0fSrobinson * Originally ompiled from key_prot.x using rpcgen.
3661961e0fSrobinson */
3761961e0fSrobinson
3861961e0fSrobinson bool_t
xdr_keystatus(XDR * xdrs,keystatus * objp)3961961e0fSrobinson xdr_keystatus(XDR *xdrs, keystatus *objp)
4061961e0fSrobinson {
4161961e0fSrobinson return (xdr_enum(xdrs, (enum_t *)objp));
4261961e0fSrobinson }
4361961e0fSrobinson
4461961e0fSrobinson bool_t
xdr_keybuf(XDR * xdrs,keybuf objp)4561961e0fSrobinson xdr_keybuf(XDR *xdrs, keybuf objp)
4661961e0fSrobinson {
4761961e0fSrobinson return (xdr_opaque(xdrs, objp, HEXKEYBYTES));
4861961e0fSrobinson }
4961961e0fSrobinson
5061961e0fSrobinson bool_t
xdr_keybuf3(XDR * xdrs,keybuf3 * objp)5161961e0fSrobinson xdr_keybuf3(XDR *xdrs, keybuf3 *objp)
5261961e0fSrobinson {
5361961e0fSrobinson return (xdr_bytes(xdrs, (char **)&objp->keybuf3_val,
5461961e0fSrobinson (uint_t *)&objp->keybuf3_len, ~0));
5561961e0fSrobinson }
5661961e0fSrobinson
5761961e0fSrobinson bool_t
xdr_netnamestr(XDR * xdrs,netnamestr * objp)5861961e0fSrobinson xdr_netnamestr(XDR *xdrs, netnamestr *objp)
5961961e0fSrobinson {
6061961e0fSrobinson return (xdr_string(xdrs, objp, MAXNETNAMELEN));
6161961e0fSrobinson }
6261961e0fSrobinson
6361961e0fSrobinson bool_t
xdr_keylen_t(XDR * xdrs,keylen_t * objp)6461961e0fSrobinson xdr_keylen_t(XDR *xdrs, keylen_t *objp)
6561961e0fSrobinson {
6661961e0fSrobinson return (xdr_int(xdrs, objp));
6761961e0fSrobinson }
6861961e0fSrobinson
6961961e0fSrobinson bool_t
xdr_algtype_t(XDR * xdrs,algtype_t * objp)7061961e0fSrobinson xdr_algtype_t(XDR *xdrs, algtype_t *objp)
7161961e0fSrobinson {
7261961e0fSrobinson return (xdr_int(xdrs, objp));
7361961e0fSrobinson }
7461961e0fSrobinson
7561961e0fSrobinson bool_t
xdr_mechtype(XDR * xdrs,mechtype * objp)7661961e0fSrobinson xdr_mechtype(XDR *xdrs, mechtype *objp)
7761961e0fSrobinson {
7861961e0fSrobinson if (!xdr_keylen_t(xdrs, &objp->keylen))
7961961e0fSrobinson return (FALSE);
8061961e0fSrobinson return (xdr_algtype_t(xdrs, &objp->algtype));
8161961e0fSrobinson }
8261961e0fSrobinson
8361961e0fSrobinson bool_t
xdr_keynum_t(XDR * xdrs,keynum_t * objp)8461961e0fSrobinson xdr_keynum_t(XDR *xdrs, keynum_t *objp)
8561961e0fSrobinson {
8661961e0fSrobinson return (xdr_int(xdrs, objp));
8761961e0fSrobinson }
8861961e0fSrobinson
8961961e0fSrobinson bool_t
xdr_deskeyarray(XDR * xdrs,deskeyarray * objp)9061961e0fSrobinson xdr_deskeyarray(XDR *xdrs, deskeyarray *objp)
9161961e0fSrobinson {
9261961e0fSrobinson return (xdr_array(xdrs, (char **)&objp->deskeyarray_val,
9361961e0fSrobinson (uint_t *)&objp->deskeyarray_len, ~0,
9461961e0fSrobinson sizeof (des_block), (xdrproc_t)xdr_des_block));
9561961e0fSrobinson }
9661961e0fSrobinson
9761961e0fSrobinson bool_t
xdr_cryptkeyarg(XDR * xdrs,cryptkeyarg * objp)9861961e0fSrobinson xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp)
9961961e0fSrobinson {
10061961e0fSrobinson if (!xdr_netnamestr(xdrs, &objp->remotename))
10161961e0fSrobinson return (FALSE);
10261961e0fSrobinson return (xdr_des_block(xdrs, &objp->deskey));
10361961e0fSrobinson }
10461961e0fSrobinson
10561961e0fSrobinson bool_t
xdr_cryptkeyarg2(XDR * xdrs,cryptkeyarg2 * objp)10661961e0fSrobinson xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp)
10761961e0fSrobinson {
10861961e0fSrobinson if (!xdr_netnamestr(xdrs, &objp->remotename))
10961961e0fSrobinson return (FALSE);
11061961e0fSrobinson if (!xdr_netobj(xdrs, &objp->remotekey))
11161961e0fSrobinson return (FALSE);
11261961e0fSrobinson return (xdr_des_block(xdrs, &objp->deskey));
11361961e0fSrobinson }
11461961e0fSrobinson
11561961e0fSrobinson bool_t
xdr_cryptkeyarg3(XDR * xdrs,cryptkeyarg3 * objp)11661961e0fSrobinson xdr_cryptkeyarg3(XDR *xdrs, cryptkeyarg3 *objp)
11761961e0fSrobinson {
11861961e0fSrobinson if (!xdr_netnamestr(xdrs, &objp->remotename))
11961961e0fSrobinson return (FALSE);
12061961e0fSrobinson if (!xdr_keybuf3(xdrs, &objp->remotekey))
12161961e0fSrobinson return (FALSE);
12261961e0fSrobinson if (!xdr_deskeyarray(xdrs, &objp->deskey))
12361961e0fSrobinson return (FALSE);
12461961e0fSrobinson if (!xdr_algtype_t(xdrs, &objp->algtype))
12561961e0fSrobinson return (FALSE);
12661961e0fSrobinson return (xdr_keylen_t(xdrs, &objp->keylen));
12761961e0fSrobinson }
12861961e0fSrobinson
12961961e0fSrobinson bool_t
xdr_cryptkeyres(XDR * xdrs,cryptkeyres * objp)13061961e0fSrobinson xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp)
13161961e0fSrobinson {
13261961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
13361961e0fSrobinson return (FALSE);
13461961e0fSrobinson if (objp->status != KEY_SUCCESS)
13561961e0fSrobinson return (TRUE);
13661961e0fSrobinson return (xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey));
13761961e0fSrobinson }
13861961e0fSrobinson
13961961e0fSrobinson bool_t
xdr_cryptkeyres3(XDR * xdrs,cryptkeyres3 * objp)14061961e0fSrobinson xdr_cryptkeyres3(XDR *xdrs, cryptkeyres3 *objp)
14161961e0fSrobinson {
14261961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
14361961e0fSrobinson return (FALSE);
14461961e0fSrobinson if (objp->status != KEY_SUCCESS)
14561961e0fSrobinson return (TRUE);
14661961e0fSrobinson return (xdr_deskeyarray(xdrs, &objp->cryptkeyres3_u.deskey));
14761961e0fSrobinson }
14861961e0fSrobinson
14961961e0fSrobinson bool_t
xdr_unixcred(XDR * xdrs,unixcred * objp)15061961e0fSrobinson xdr_unixcred(XDR *xdrs, unixcred *objp)
15161961e0fSrobinson {
15261961e0fSrobinson if (!xdr_u_int(xdrs, &objp->uid))
15361961e0fSrobinson return (FALSE);
15461961e0fSrobinson if (!xdr_u_int(xdrs, &objp->gid))
15561961e0fSrobinson return (FALSE);
15661961e0fSrobinson return (xdr_array(xdrs, (char **)&objp->gids.gids_val,
15761961e0fSrobinson (uint_t *)&objp->gids.gids_len, MAXGIDS,
15861961e0fSrobinson sizeof (uint_t), (xdrproc_t)xdr_u_int));
15961961e0fSrobinson }
16061961e0fSrobinson
16161961e0fSrobinson bool_t
xdr_unixcred3(XDR * xdrs,unixcred3 * objp)16261961e0fSrobinson xdr_unixcred3(XDR *xdrs, unixcred3 *objp)
16361961e0fSrobinson {
16461961e0fSrobinson if (!xdr_u_int(xdrs, &objp->uid))
16561961e0fSrobinson return (FALSE);
16661961e0fSrobinson if (!xdr_u_int(xdrs, &objp->gid))
16761961e0fSrobinson return (FALSE);
16861961e0fSrobinson return (xdr_array(xdrs, (char **)&objp->gids.gids_val,
16961961e0fSrobinson (uint_t *)&objp->gids.gids_len, ~0,
17061961e0fSrobinson sizeof (uint_t), (xdrproc_t)xdr_u_int));
17161961e0fSrobinson }
17261961e0fSrobinson
17361961e0fSrobinson bool_t
xdr_getcredres(XDR * xdrs,getcredres * objp)17461961e0fSrobinson xdr_getcredres(XDR *xdrs, getcredres *objp)
17561961e0fSrobinson {
17661961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
17761961e0fSrobinson return (FALSE);
17861961e0fSrobinson if (objp->status != KEY_SUCCESS)
17961961e0fSrobinson return (TRUE);
18061961e0fSrobinson return (xdr_unixcred(xdrs, &objp->getcredres_u.cred));
18161961e0fSrobinson }
18261961e0fSrobinson
18361961e0fSrobinson bool_t
xdr_getcredres3(XDR * xdrs,getcredres3 * objp)18461961e0fSrobinson xdr_getcredres3(XDR *xdrs, getcredres3 *objp)
18561961e0fSrobinson {
18661961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
18761961e0fSrobinson return (FALSE);
18861961e0fSrobinson if (objp->status != KEY_SUCCESS)
18961961e0fSrobinson return (TRUE);
19061961e0fSrobinson return (xdr_unixcred3(xdrs, &objp->getcredres3_u.cred));
19161961e0fSrobinson }
19261961e0fSrobinson
19361961e0fSrobinson bool_t
xdr_key_netstarg(XDR * xdrs,key_netstarg * objp)19461961e0fSrobinson xdr_key_netstarg(XDR *xdrs, key_netstarg *objp)
19561961e0fSrobinson {
19661961e0fSrobinson if (!xdr_keybuf(xdrs, objp->st_priv_key))
19761961e0fSrobinson return (FALSE);
19861961e0fSrobinson if (!xdr_keybuf(xdrs, objp->st_pub_key))
19961961e0fSrobinson return (FALSE);
20061961e0fSrobinson return (xdr_netnamestr(xdrs, &objp->st_netname));
20161961e0fSrobinson }
20261961e0fSrobinson
20361961e0fSrobinson bool_t
xdr_key_netstarg3(XDR * xdrs,key_netstarg3 * objp)20461961e0fSrobinson xdr_key_netstarg3(XDR *xdrs, key_netstarg3 *objp)
20561961e0fSrobinson {
20661961e0fSrobinson if (!xdr_keybuf3(xdrs, &objp->st_priv_key))
20761961e0fSrobinson return (FALSE);
20861961e0fSrobinson if (!xdr_keybuf3(xdrs, &objp->st_pub_key))
20961961e0fSrobinson return (FALSE);
21061961e0fSrobinson if (!xdr_netnamestr(xdrs, &objp->st_netname))
21161961e0fSrobinson return (FALSE);
21261961e0fSrobinson if (!xdr_algtype_t(xdrs, &objp->algtype))
21361961e0fSrobinson return (FALSE);
21461961e0fSrobinson if (!xdr_keylen_t(xdrs, &objp->keylen))
21561961e0fSrobinson return (FALSE);
21661961e0fSrobinson return (xdr_des_block(xdrs, &objp->userkey));
21761961e0fSrobinson }
21861961e0fSrobinson
21961961e0fSrobinson bool_t
xdr_key_netstres(XDR * xdrs,key_netstres * objp)22061961e0fSrobinson xdr_key_netstres(XDR *xdrs, key_netstres *objp)
22161961e0fSrobinson {
22261961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
22361961e0fSrobinson return (FALSE);
22461961e0fSrobinson switch (objp->status) {
22561961e0fSrobinson case KEY_SUCCESS:
22661961e0fSrobinson if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
22761961e0fSrobinson return (FALSE);
22861961e0fSrobinson break;
22961961e0fSrobinson }
23061961e0fSrobinson return (TRUE);
23161961e0fSrobinson }
23261961e0fSrobinson
23361961e0fSrobinson bool_t
xdr_key_netstres3(XDR * xdrs,key_netstres3 * objp)23461961e0fSrobinson xdr_key_netstres3(XDR *xdrs, key_netstres3 *objp)
23561961e0fSrobinson {
23661961e0fSrobinson if (!xdr_keystatus(xdrs, &objp->status))
23761961e0fSrobinson return (FALSE);
23861961e0fSrobinson if (objp->status != KEY_SUCCESS)
23961961e0fSrobinson return (TRUE);
24061961e0fSrobinson return (xdr_key_netstarg3(xdrs, &objp->key_netstres3_u.knet));
24161961e0fSrobinson }
24261961e0fSrobinson
24361961e0fSrobinson bool_t
xdr_deskeyarg3(XDR * xdrs,deskeyarg3 * objp)24461961e0fSrobinson xdr_deskeyarg3(XDR *xdrs, deskeyarg3 *objp)
24561961e0fSrobinson {
24661961e0fSrobinson if (!xdr_keybuf3(xdrs, &objp->pub_key))
24761961e0fSrobinson return (FALSE);
24861961e0fSrobinson if (!xdr_int(xdrs, &objp->nkeys))
24961961e0fSrobinson return (FALSE);
25061961e0fSrobinson if (!xdr_algtype_t(xdrs, &objp->algtype))
25161961e0fSrobinson return (FALSE);
25261961e0fSrobinson return (xdr_keylen_t(xdrs, &objp->keylen));
25361961e0fSrobinson }
25461961e0fSrobinson
25561961e0fSrobinson bool_t
xdr_setkeyarg3(XDR * xdrs,setkeyarg3 * objp)25661961e0fSrobinson xdr_setkeyarg3(XDR *xdrs, setkeyarg3 *objp)
25761961e0fSrobinson {
25861961e0fSrobinson if (!xdr_keybuf3(xdrs, &objp->key))
25961961e0fSrobinson return (FALSE);
26061961e0fSrobinson if (!xdr_des_block(xdrs, &objp->userkey))
26161961e0fSrobinson return (FALSE);
26261961e0fSrobinson if (!xdr_algtype_t(xdrs, &objp->algtype))
26361961e0fSrobinson return (FALSE);
26461961e0fSrobinson return (xdr_keylen_t(xdrs, &objp->keylen));
26561961e0fSrobinson }
266