xref: /illumos-gate/usr/src/uts/common/rpc/sec/key_prot.c (revision 9164a50bf932130cbb5097a16f6986873ce0e6e5)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Please do not edit this file.
29  * It was generated using rpcgen.
30  */
31 
32 #include <rpc/key_prot.h>
33 /* @(#)key_prot.x	1.10 90/01/03 Copyright (c)  1990, 1991 SMI */
34 
35 /*
36  * Compiled from key_prot.x using rpcgen.
37  * DO NOT EDIT THIS FILE!
38  * This is NOT source code!
39  */
40 
41 bool_t
42 xdr_keystatus(XDR *xdrs, keystatus *objp)
43 {
44 	if (!xdr_enum(xdrs, (enum_t *)objp))
45 		return (FALSE);
46 	return (TRUE);
47 }
48 
49 bool_t
50 xdr_keybuf(XDR *xdrs, keybuf objp)
51 {
52 	if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
53 		return (FALSE);
54 	return (TRUE);
55 }
56 
57 bool_t
58 xdr_netnamestr(XDR *xdrs, netnamestr *objp)
59 {
60 	if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
61 		return (FALSE);
62 
63 	return (TRUE);
64 }
65 
66 bool_t
67 xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp)
68 {
69 	if (!xdr_netnamestr(xdrs, &objp->remotename))
70 		return (FALSE);
71 	if (!xdr_des_block(xdrs, &objp->deskey))
72 		return (FALSE);
73 	return (TRUE);
74 }
75 
76 bool_t
77 xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp)
78 {
79 	if (!xdr_netnamestr(xdrs, &objp->remotename))
80 		return (FALSE);
81 	if (!xdr_netobj(xdrs, &objp->remotekey))
82 		return (FALSE);
83 	if (!xdr_des_block(xdrs, &objp->deskey))
84 		return (FALSE);
85 	return (TRUE);
86 }
87 
88 bool_t
89 xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp)
90 {
91 	if (!xdr_keystatus(xdrs, &objp->status))
92 		return (FALSE);
93 	switch (objp->status) {
94 	case KEY_SUCCESS:
95 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
96 			return (FALSE);
97 		break;
98 	default:
99 		break;
100 	}
101 	return (TRUE);
102 }
103 
104 bool_t
105 xdr_unixcred(XDR *xdrs, unixcred *objp)
106 {
107 	if (!xdr_u_int(xdrs, &objp->uid))
108 		return (FALSE);
109 	if (!xdr_u_int(xdrs, &objp->gid))
110 		return (FALSE);
111 	if (!xdr_array(xdrs, (char **)&objp->gids.gids_val,
112 	    (uint_t *)&objp->gids.gids_len, MAXGIDS,
113 	    sizeof (uint_t), (xdrproc_t)xdr_u_int))
114 		return (FALSE);
115 	return (TRUE);
116 }
117 
118 bool_t
119 xdr_getcredres(XDR *xdrs, getcredres *objp)
120 {
121 	if (!xdr_keystatus(xdrs, &objp->status))
122 		return (FALSE);
123 	switch (objp->status) {
124 	case KEY_SUCCESS:
125 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
126 			return (FALSE);
127 		break;
128 	default:
129 		break;
130 	}
131 	return (TRUE);
132 }
133 
134 bool_t
135 xdr_key_netstarg(XDR *xdrs, key_netstarg *objp)
136 {
137 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
138 		return (FALSE);
139 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
140 		return (FALSE);
141 
142 
143 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
144 		return (FALSE);
145 
146 	return (TRUE);
147 }
148 
149 bool_t
150 xdr_key_netstres(XDR *xdrs, key_netstres *objp)
151 {
152 	if (!xdr_keystatus(xdrs, &objp->status))
153 		return (FALSE);
154 	switch (objp->status) {
155 	case KEY_SUCCESS:
156 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
157 			return (FALSE);
158 		break;
159 	default:
160 		break;
161 	}
162 	return (TRUE);
163 }
164