4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <rpc/key_prot.h>
35 * Originally ompiled from key_prot.x using rpcgen.
39 xdr_keystatus(XDR
*xdrs
, keystatus
*objp
)
41 return (xdr_enum(xdrs
, (enum_t
*)objp
));
45 xdr_keybuf(XDR
*xdrs
, keybuf objp
)
47 return (xdr_opaque(xdrs
, objp
, HEXKEYBYTES
));
51 xdr_keybuf3(XDR
*xdrs
, keybuf3
*objp
)
53 return (xdr_bytes(xdrs
, (char **)&objp
->keybuf3_val
,
54 (uint_t
*)&objp
->keybuf3_len
, ~0));
58 xdr_netnamestr(XDR
*xdrs
, netnamestr
*objp
)
60 return (xdr_string(xdrs
, objp
, MAXNETNAMELEN
));
64 xdr_keylen_t(XDR
*xdrs
, keylen_t
*objp
)
66 return (xdr_int(xdrs
, objp
));
70 xdr_algtype_t(XDR
*xdrs
, algtype_t
*objp
)
72 return (xdr_int(xdrs
, objp
));
76 xdr_mechtype(XDR
*xdrs
, mechtype
*objp
)
78 if (!xdr_keylen_t(xdrs
, &objp
->keylen
))
80 return (xdr_algtype_t(xdrs
, &objp
->algtype
));
84 xdr_keynum_t(XDR
*xdrs
, keynum_t
*objp
)
86 return (xdr_int(xdrs
, objp
));
90 xdr_deskeyarray(XDR
*xdrs
, deskeyarray
*objp
)
92 return (xdr_array(xdrs
, (char **)&objp
->deskeyarray_val
,
93 (uint_t
*)&objp
->deskeyarray_len
, ~0,
94 sizeof (des_block
), (xdrproc_t
)xdr_des_block
));
98 xdr_cryptkeyarg(XDR
*xdrs
, cryptkeyarg
*objp
)
100 if (!xdr_netnamestr(xdrs
, &objp
->remotename
))
102 return (xdr_des_block(xdrs
, &objp
->deskey
));
106 xdr_cryptkeyarg2(XDR
*xdrs
, cryptkeyarg2
*objp
)
108 if (!xdr_netnamestr(xdrs
, &objp
->remotename
))
110 if (!xdr_netobj(xdrs
, &objp
->remotekey
))
112 return (xdr_des_block(xdrs
, &objp
->deskey
));
116 xdr_cryptkeyarg3(XDR
*xdrs
, cryptkeyarg3
*objp
)
118 if (!xdr_netnamestr(xdrs
, &objp
->remotename
))
120 if (!xdr_keybuf3(xdrs
, &objp
->remotekey
))
122 if (!xdr_deskeyarray(xdrs
, &objp
->deskey
))
124 if (!xdr_algtype_t(xdrs
, &objp
->algtype
))
126 return (xdr_keylen_t(xdrs
, &objp
->keylen
));
130 xdr_cryptkeyres(XDR
*xdrs
, cryptkeyres
*objp
)
132 if (!xdr_keystatus(xdrs
, &objp
->status
))
134 if (objp
->status
!= KEY_SUCCESS
)
136 return (xdr_des_block(xdrs
, &objp
->cryptkeyres_u
.deskey
));
140 xdr_cryptkeyres3(XDR
*xdrs
, cryptkeyres3
*objp
)
142 if (!xdr_keystatus(xdrs
, &objp
->status
))
144 if (objp
->status
!= KEY_SUCCESS
)
146 return (xdr_deskeyarray(xdrs
, &objp
->cryptkeyres3_u
.deskey
));
150 xdr_unixcred(XDR
*xdrs
, unixcred
*objp
)
152 if (!xdr_u_int(xdrs
, &objp
->uid
))
154 if (!xdr_u_int(xdrs
, &objp
->gid
))
156 return (xdr_array(xdrs
, (char **)&objp
->gids
.gids_val
,
157 (uint_t
*)&objp
->gids
.gids_len
, MAXGIDS
,
158 sizeof (uint_t
), (xdrproc_t
)xdr_u_int
));
162 xdr_unixcred3(XDR
*xdrs
, unixcred3
*objp
)
164 if (!xdr_u_int(xdrs
, &objp
->uid
))
166 if (!xdr_u_int(xdrs
, &objp
->gid
))
168 return (xdr_array(xdrs
, (char **)&objp
->gids
.gids_val
,
169 (uint_t
*)&objp
->gids
.gids_len
, ~0,
170 sizeof (uint_t
), (xdrproc_t
)xdr_u_int
));
174 xdr_getcredres(XDR
*xdrs
, getcredres
*objp
)
176 if (!xdr_keystatus(xdrs
, &objp
->status
))
178 if (objp
->status
!= KEY_SUCCESS
)
180 return (xdr_unixcred(xdrs
, &objp
->getcredres_u
.cred
));
184 xdr_getcredres3(XDR
*xdrs
, getcredres3
*objp
)
186 if (!xdr_keystatus(xdrs
, &objp
->status
))
188 if (objp
->status
!= KEY_SUCCESS
)
190 return (xdr_unixcred3(xdrs
, &objp
->getcredres3_u
.cred
));
194 xdr_key_netstarg(XDR
*xdrs
, key_netstarg
*objp
)
196 if (!xdr_keybuf(xdrs
, objp
->st_priv_key
))
198 if (!xdr_keybuf(xdrs
, objp
->st_pub_key
))
200 return (xdr_netnamestr(xdrs
, &objp
->st_netname
));
204 xdr_key_netstarg3(XDR
*xdrs
, key_netstarg3
*objp
)
206 if (!xdr_keybuf3(xdrs
, &objp
->st_priv_key
))
208 if (!xdr_keybuf3(xdrs
, &objp
->st_pub_key
))
210 if (!xdr_netnamestr(xdrs
, &objp
->st_netname
))
212 if (!xdr_algtype_t(xdrs
, &objp
->algtype
))
214 if (!xdr_keylen_t(xdrs
, &objp
->keylen
))
216 return (xdr_des_block(xdrs
, &objp
->userkey
));
220 xdr_key_netstres(XDR
*xdrs
, key_netstres
*objp
)
222 if (!xdr_keystatus(xdrs
, &objp
->status
))
224 switch (objp
->status
) {
226 if (!xdr_key_netstarg(xdrs
, &objp
->key_netstres_u
.knet
))
234 xdr_key_netstres3(XDR
*xdrs
, key_netstres3
*objp
)
236 if (!xdr_keystatus(xdrs
, &objp
->status
))
238 if (objp
->status
!= KEY_SUCCESS
)
240 return (xdr_key_netstarg3(xdrs
, &objp
->key_netstres3_u
.knet
));
244 xdr_deskeyarg3(XDR
*xdrs
, deskeyarg3
*objp
)
246 if (!xdr_keybuf3(xdrs
, &objp
->pub_key
))
248 if (!xdr_int(xdrs
, &objp
->nkeys
))
250 if (!xdr_algtype_t(xdrs
, &objp
->algtype
))
252 return (xdr_keylen_t(xdrs
, &objp
->keylen
));
256 xdr_setkeyarg3(XDR
*xdrs
, setkeyarg3
*objp
)
258 if (!xdr_keybuf3(xdrs
, &objp
->key
))
260 if (!xdr_des_block(xdrs
, &objp
->userkey
))
262 if (!xdr_algtype_t(xdrs
, &objp
->algtype
))
264 return (xdr_keylen_t(xdrs
, &objp
->keylen
));