Print this page
first pass
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libgss/g_seal.c
+++ new/usr/src/lib/libgss/g_seal.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 /*
26 26 * glue routine for gss_seal
27 27 */
28 28
29 29 #include <mechglueP.h>
30 30 #include "gssapiP_generic.h"
31 31
32 32
33 33 static OM_uint32
34 34 val_seal_args(
35 35 OM_uint32 *minor_status,
36 36 gss_ctx_id_t context_handle,
37 37 gss_buffer_t input_message_buffer,
38 38 gss_buffer_t output_message_buffer)
39 39 {
40 40
41 41 /* Initialize outputs. */
42 42
43 43 if (minor_status != NULL)
44 44 *minor_status = 0;
45 45
46 46 if (output_message_buffer != GSS_C_NO_BUFFER) {
47 47 output_message_buffer->length = 0;
48 48 output_message_buffer->value = NULL;
49 49 }
50 50
51 51 /* Validate arguments. */
52 52
53 53 if (minor_status == NULL)
54 54 return (GSS_S_CALL_INACCESSIBLE_WRITE);
55 55
56 56 if (context_handle == GSS_C_NO_CONTEXT)
57 57 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
58 58
59 59 if (input_message_buffer == GSS_C_NO_BUFFER)
60 60 return (GSS_S_CALL_INACCESSIBLE_READ);
61 61
62 62 if (output_message_buffer == GSS_C_NO_BUFFER)
63 63 return (GSS_S_CALL_INACCESSIBLE_WRITE);
64 64
65 65 return (GSS_S_COMPLETE);
66 66 }
67 67
68 68 /*ARGSUSED*/
69 69 OM_uint32
70 70 gss_seal(minor_status,
71 71 context_handle,
72 72 conf_req_flag,
73 73 qop_req,
74 74 input_message_buffer,
75 75 conf_state,
↓ open down ↓ |
75 lines elided |
↑ open up ↑ |
76 76 output_message_buffer)
77 77
78 78 OM_uint32 * minor_status;
79 79 gss_ctx_id_t context_handle;
80 80 int conf_req_flag;
81 81 int qop_req;
82 82 gss_buffer_t input_message_buffer;
83 83 int * conf_state;
84 84 gss_buffer_t output_message_buffer;
85 85 {
86 -/* EXPORT DELETE START */
87 -
88 86 OM_uint32 status;
89 87 gss_union_ctx_id_t ctx;
90 88 gss_mechanism mech;
91 89
92 90 status = val_seal_args(minor_status,
93 91 context_handle,
94 92 input_message_buffer,
95 93 output_message_buffer);
96 94 if (status != GSS_S_COMPLETE)
97 95 return (status);
98 96
99 97 /*
100 98 * select the approprate underlying mechanism routine and
101 99 * call it.
102 100 */
103 101
104 102 ctx = (gss_union_ctx_id_t) context_handle;
105 103 mech = __gss_get_mechanism(ctx->mech_type);
106 104
107 105 if (mech) {
108 106 if (mech->gss_seal) {
109 107 status = mech->gss_seal(
110 108 mech->context,
111 109 minor_status,
112 110 ctx->internal_ctx_id,
113 111 conf_req_flag,
114 112 qop_req,
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
115 113 input_message_buffer,
116 114 conf_state,
117 115 output_message_buffer);
118 116 if (status != GSS_S_COMPLETE)
119 117 map_error(minor_status, mech);
120 118 } else
121 119 status = GSS_S_UNAVAILABLE;
122 120
123 121 return (status);
124 122 }
125 -/* EXPORT DELETE END */
126 123
127 124 return (GSS_S_BAD_MECH);
128 125 }
129 126
130 127 OM_uint32
131 128 gss_wrap(minor_status,
132 129 context_handle,
133 130 conf_req_flag,
134 131 qop_req,
135 132 input_message_buffer,
136 133 conf_state,
137 134 output_message_buffer)
138 135
139 136 OM_uint32 * minor_status;
140 137 const gss_ctx_id_t context_handle;
141 138 int conf_req_flag;
142 139 gss_qop_t qop_req;
143 140 const gss_buffer_t input_message_buffer;
144 141 int * conf_state;
145 142 gss_buffer_t output_message_buffer;
146 143
147 144 {
148 145 return gss_seal(minor_status, (gss_ctx_id_t)context_handle,
149 146 conf_req_flag, (int) qop_req,
150 147 (gss_buffer_t)input_message_buffer, conf_state,
151 148 output_message_buffer);
152 149 }
153 150
154 151 /*
155 152 * New for V2
156 153 */
157 154 OM_uint32
158 155 gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,
159 156 qop_req, req_output_size, max_input_size)
160 157 OM_uint32 *minor_status;
161 158 const gss_ctx_id_t context_handle;
162 159 int conf_req_flag;
163 160 gss_qop_t qop_req;
164 161 OM_uint32 req_output_size;
165 162 OM_uint32 *max_input_size;
166 163 {
167 164 gss_union_ctx_id_t ctx;
168 165 gss_mechanism mech;
169 166 OM_uint32 major_status;
170 167
171 168 if (minor_status == NULL)
172 169 return (GSS_S_CALL_INACCESSIBLE_WRITE);
173 170 *minor_status = 0;
174 171
175 172 if (context_handle == GSS_C_NO_CONTEXT)
176 173 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
177 174
178 175 if (max_input_size == NULL)
179 176 return (GSS_S_CALL_INACCESSIBLE_WRITE);
180 177
181 178 /*
182 179 * select the approprate underlying mechanism routine and
183 180 * call it.
184 181 */
185 182
186 183 ctx = (gss_union_ctx_id_t) context_handle;
187 184 mech = __gss_get_mechanism(ctx->mech_type);
188 185
189 186 if (!mech)
190 187 return (GSS_S_BAD_MECH);
191 188
192 189 if (mech->gss_wrap_size_limit)
193 190 major_status = mech->gss_wrap_size_limit(mech->context,
194 191 minor_status,
195 192 ctx->internal_ctx_id,
196 193 conf_req_flag, qop_req,
197 194 req_output_size,
198 195 max_input_size);
199 196 else
200 197 major_status = GSS_S_UNAVAILABLE;
201 198 if (major_status != GSS_S_COMPLETE)
202 199 map_error(minor_status, mech);
203 200 return major_status;
204 201 }
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX