xref: /titanic_44/usr/src/uts/common/rpc/sec/key_prot.c (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
33 
34 #include <rpc/key_prot.h>
35 /* @(#)key_prot.x	1.10 90/01/03 Copyright (c)  1990, 1991 SMI */
36 
37 /*
38  * Compiled from key_prot.x using rpcgen.
39  * DO NOT EDIT THIS FILE!
40  * This is NOT source code!
41  */
42 
43 bool_t
44 xdr_keystatus(XDR *xdrs, keystatus *objp)
45 {
46 	if (!xdr_enum(xdrs, (enum_t *)objp))
47 		return (FALSE);
48 	return (TRUE);
49 }
50 
51 bool_t
52 xdr_keybuf(XDR *xdrs, keybuf objp)
53 {
54 	if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
55 		return (FALSE);
56 	return (TRUE);
57 }
58 
59 bool_t
60 xdr_netnamestr(XDR *xdrs, netnamestr *objp)
61 {
62 	if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
63 		return (FALSE);
64 
65 	return (TRUE);
66 }
67 
68 bool_t
69 xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp)
70 {
71 	if (!xdr_netnamestr(xdrs, &objp->remotename))
72 		return (FALSE);
73 	if (!xdr_des_block(xdrs, &objp->deskey))
74 		return (FALSE);
75 	return (TRUE);
76 }
77 
78 bool_t
79 xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp)
80 {
81 	if (!xdr_netnamestr(xdrs, &objp->remotename))
82 		return (FALSE);
83 	if (!xdr_netobj(xdrs, &objp->remotekey))
84 		return (FALSE);
85 	if (!xdr_des_block(xdrs, &objp->deskey))
86 		return (FALSE);
87 	return (TRUE);
88 }
89 
90 bool_t
91 xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp)
92 {
93 	if (!xdr_keystatus(xdrs, &objp->status))
94 		return (FALSE);
95 	switch (objp->status) {
96 	case KEY_SUCCESS:
97 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
98 			return (FALSE);
99 		break;
100 	default:
101 		break;
102 	}
103 	return (TRUE);
104 }
105 
106 bool_t
107 xdr_unixcred(XDR *xdrs, unixcred *objp)
108 {
109 	if (!xdr_u_int(xdrs, &objp->uid))
110 		return (FALSE);
111 	if (!xdr_u_int(xdrs, &objp->gid))
112 		return (FALSE);
113 	if (!xdr_array(xdrs, (char **)&objp->gids.gids_val,
114 	    (uint_t *)&objp->gids.gids_len, MAXGIDS,
115 	    sizeof (uint_t), (xdrproc_t)xdr_u_int))
116 		return (FALSE);
117 	return (TRUE);
118 }
119 
120 bool_t
121 xdr_getcredres(XDR *xdrs, getcredres *objp)
122 {
123 	if (!xdr_keystatus(xdrs, &objp->status))
124 		return (FALSE);
125 	switch (objp->status) {
126 	case KEY_SUCCESS:
127 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
128 			return (FALSE);
129 		break;
130 	default:
131 		break;
132 	}
133 	return (TRUE);
134 }
135 
136 bool_t
137 xdr_key_netstarg(XDR *xdrs, key_netstarg *objp)
138 {
139 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
140 		return (FALSE);
141 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
142 		return (FALSE);
143 
144 
145 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
146 		return (FALSE);
147 
148 	return (TRUE);
149 }
150 
151 bool_t
152 xdr_key_netstres(XDR *xdrs, key_netstres *objp)
153 {
154 	if (!xdr_keystatus(xdrs, &objp->status))
155 		return (FALSE);
156 	switch (objp->status) {
157 	case KEY_SUCCESS:
158 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
159 			return (FALSE);
160 		break;
161 	default:
162 		break;
163 	}
164 	return (TRUE);
165 }
166