Lines 1-1480
Link Here
|
1 |
--- lib/include/base64.h.orig 2013-12-27 16:38:14.000000000 +0000 |
|
|
2 |
+++ lib/include/base64.h 2013-12-27 16:38:30.000000000 +0000 |
3 |
@@ -1,46 +0,0 @@ |
4 |
-/********************************************************* |
5 |
- * Copyright (C) 2004 VMware, Inc. All rights reserved. |
6 |
- * |
7 |
- * This program is free software; you can redistribute it and/or modify it |
8 |
- * under the terms of the GNU Lesser General Public License as published |
9 |
- * by the Free Software Foundation version 2.1 and no later version. |
10 |
- * |
11 |
- * This program is distributed in the hope that it will be useful, but |
12 |
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
13 |
- * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public |
14 |
- * License for more details. |
15 |
- * |
16 |
- * You should have received a copy of the GNU Lesser General Public License |
17 |
- * along with this program; if not, write to the Free Software Foundation, Inc., |
18 |
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
- * |
20 |
- *********************************************************/ |
21 |
- |
22 |
-/* |
23 |
- * base64.h -- |
24 |
- * |
25 |
- * Functions to base64 encode/decode buffers. Implemented in |
26 |
- * lib/misc/base64.c. |
27 |
- */ |
28 |
- |
29 |
-#ifndef _BASE64_H |
30 |
-#define _BASE64_H |
31 |
- |
32 |
-Bool Base64_Encode(uint8 const *src, size_t srcLength, |
33 |
- char *target, size_t targSize, |
34 |
- size_t *dataLength); |
35 |
-Bool Base64_Decode(char const *src, |
36 |
- uint8 *target, size_t targSize, |
37 |
- size_t *dataLength); |
38 |
-Bool Base64_ChunkDecode(char const *src, size_t inSize, |
39 |
- uint8 *target, size_t targSize, |
40 |
- size_t *dataLength); |
41 |
-Bool Base64_ValidEncoding(char const *src, size_t srcLength); |
42 |
-size_t Base64_EncodedLength(uint8 const *src, size_t srcLength); |
43 |
-size_t Base64_DecodedLength(char const *src, size_t srcLength); |
44 |
-Bool Base64_EasyEncode(const uint8 *src, size_t srcLength, |
45 |
- char **target); |
46 |
-Bool Base64_EasyDecode(const char *src, |
47 |
- uint8 **target, size_t *targSize); |
48 |
- |
49 |
-#endif |
50 |
--- lib/misc/base64.c.orig 2013-12-27 16:38:22.000000000 +0000 |
51 |
+++ lib/misc/base64.c 2013-12-27 16:38:36.000000000 +0000 |
52 |
@@ -1,634 +0,0 @@ |
53 |
-/* |
54 |
- * Copyright (c) 1996, 1998 by Internet Software Consortium. |
55 |
- * |
56 |
- * Permission to use, copy, modify, and distribute this software for any |
57 |
- * purpose with or without fee is hereby granted, provided that the above |
58 |
- * copyright notice and this permission notice appear in all copies. |
59 |
- * |
60 |
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
61 |
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
62 |
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
63 |
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
64 |
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
65 |
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
66 |
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
67 |
- * SOFTWARE. |
68 |
- */ |
69 |
- |
70 |
-/* |
71 |
- * Portions Copyright (c) 1995 by International Business Machines, Inc. |
72 |
- * |
73 |
- * International Business Machines, Inc. (hereinafter called IBM) grants |
74 |
- * permission under its copyrights to use, copy, modify, and distribute this |
75 |
- * Software with or without fee, provided that the above copyright notice and |
76 |
- * all paragraphs of this notice appear in all copies, and that the name of IBM |
77 |
- * not be used in connection with the marketing of any product incorporating |
78 |
- * the Software or modifications thereof, without specific, written prior |
79 |
- * permission. |
80 |
- * |
81 |
- * To the extent it has a right to do so, IBM grants an immunity from suit |
82 |
- * under its patents, if any, for the use, sale or manufacture of products to |
83 |
- * the extent that such products are used for performing Domain Name System |
84 |
- * dynamic updates in TCP/IP networks by means of the Software. No immunity is |
85 |
- * granted for any product per se or for any other function of any product. |
86 |
- * |
87 |
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, |
88 |
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
89 |
- * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, |
90 |
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING |
91 |
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN |
92 |
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. |
93 |
- */ |
94 |
- |
95 |
-#include <sys/types.h> |
96 |
- |
97 |
-#include <ctype.h> |
98 |
-#include <stdio.h> |
99 |
-#include <stdlib.h> |
100 |
-#include <string.h> |
101 |
-#include "vm_basic_types.h" |
102 |
-#include "vm_assert.h" |
103 |
-#include "base64.h" |
104 |
- |
105 |
-static const char Base64[] = |
106 |
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
107 |
-static const char Pad64 = '='; |
108 |
- |
109 |
-// Special markers |
110 |
-enum { |
111 |
- ILLEGAL = -1, EOM = -2, WS = -3 |
112 |
-}; |
113 |
- |
114 |
-/* |
115 |
- * Reverse byte map used for decoding. Except for specials (negative values), contains the index |
116 |
- * into Base64[] where given value is found, ie: base64Reverse[Base64[n]] = n, for 0 <= n < 64 |
117 |
- * |
118 |
- * This static initialization replaces, and should have identical result to, this runtime init: |
119 |
- * |
120 |
- * for (i = 0; i < 256; ++i) { |
121 |
- * base64Reverse[i] = isspace(i) ? WS : ILLEGAL; |
122 |
- * } |
123 |
- * base64Reverse['\0'] = EOM; |
124 |
- * base64Reverse['='] = EOM; |
125 |
- * for (i = 0; Base64[i]; ++i) { |
126 |
- * base64Reverse[(unsigned)Base64[i]] = (char) i; |
127 |
- * } |
128 |
- */ |
129 |
- |
130 |
-static const signed char base64Reverse[256] = { |
131 |
- EOM, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 00-07 */ |
132 |
- ILLEGAL, WS, WS, WS, WS, WS, ILLEGAL, ILLEGAL, /* 08-0F */ |
133 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 10-17 */ |
134 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 18-1F */ |
135 |
- WS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 20-27 */ |
136 |
- ILLEGAL, ILLEGAL, ILLEGAL, 62, ILLEGAL, ILLEGAL, ILLEGAL, 63, /* 28-2F */ |
137 |
- 52, 53, 54, 55, 56, 57, 58, 59, /* 30-37 */ |
138 |
- 60, 61, ILLEGAL, ILLEGAL, ILLEGAL, EOM, ILLEGAL, ILLEGAL, /* 38-3F */ |
139 |
- ILLEGAL, 0, 1, 2, 3, 4, 5, 6, /* 40-47 */ |
140 |
- 7, 8, 9, 10, 11, 12, 13, 14, /* 48-4F */ |
141 |
- 15, 16, 17, 18, 19, 20, 21, 22, /* 50-57 */ |
142 |
- 23, 24, 25, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 58-5F */ |
143 |
- ILLEGAL, 26, 27, 28, 29, 30, 31, 32, /* 60-67 */ |
144 |
- 33, 34, 35, 36, 37, 38, 39, 40, /* 68-6F */ |
145 |
- 41, 42, 43, 44, 45, 46, 47, 48, /* 70-77 */ |
146 |
- 49, 50, 51, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 78-7F */ |
147 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 80-87 */ |
148 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 88-8F */ |
149 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 90-97 */ |
150 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 98-9F */ |
151 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* A0-A7 */ |
152 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* A8-AF */ |
153 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* B0-B7 */ |
154 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* B8-BF */ |
155 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* C0-C7 */ |
156 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* C8-CF */ |
157 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* D0-D7 */ |
158 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* D8-DF */ |
159 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* E0-E7 */ |
160 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* E8-EF */ |
161 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* F0-F7 */ |
162 |
- ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL }; /* F8-FF */ |
163 |
- |
164 |
-/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) |
165 |
- The following encoding technique is taken from RFC 1521 by Borenstein |
166 |
- and Freed. It is reproduced here in a slightly edited form for |
167 |
- convenience. |
168 |
- |
169 |
- A 65-character subset of US-ASCII is used, enabling 6 bits to be |
170 |
- represented per printable character. (The extra 65th character, "=", |
171 |
- is used to signify a special processing function.) |
172 |
- |
173 |
- The encoding process represents 24-bit groups of input bits as output |
174 |
- strings of 4 encoded characters. Proceeding from left to right, a |
175 |
- 24-bit input group is formed by concatenating 3 8-bit input groups. |
176 |
- These 24 bits are then treated as 4 concatenated 6-bit groups, each |
177 |
- of which is translated into a single digit in the base64 alphabet. |
178 |
- |
179 |
- Each 6-bit group is used as an index into an array of 64 printable |
180 |
- characters. The character referenced by the index is placed in the |
181 |
- output string. |
182 |
- |
183 |
- Table 1: The Base64 Alphabet |
184 |
- |
185 |
- Value Encoding Value Encoding Value Encoding Value Encoding |
186 |
- 0 A 17 R 34 i 51 z |
187 |
- 1 B 18 S 35 j 52 0 |
188 |
- 2 C 19 T 36 k 53 1 |
189 |
- 3 D 20 U 37 l 54 2 |
190 |
- 4 E 21 V 38 m 55 3 |
191 |
- 5 F 22 W 39 n 56 4 |
192 |
- 6 G 23 X 40 o 57 5 |
193 |
- 7 H 24 Y 41 p 58 6 |
194 |
- 8 I 25 Z 42 q 59 7 |
195 |
- 9 J 26 a 43 r 60 8 |
196 |
- 10 K 27 b 44 s 61 9 |
197 |
- 11 L 28 c 45 t 62 + |
198 |
- 12 M 29 d 46 u 63 / |
199 |
- 13 N 30 e 47 v |
200 |
- 14 O 31 f 48 w (pad) = |
201 |
- 15 P 32 g 49 x |
202 |
- 16 Q 33 h 50 y |
203 |
- |
204 |
- Special processing is performed if fewer than 24 bits are available |
205 |
- at the end of the data being encoded. A full encoding quantum is |
206 |
- always completed at the end of a quantity. When fewer than 24 input |
207 |
- bits are available in an input group, zero bits are added (on the |
208 |
- right) to form an integral number of 6-bit groups. Padding at the |
209 |
- end of the data is performed using the '=' character. |
210 |
- |
211 |
- Since all base64 input is an integral number of octets, only the |
212 |
- ------------------------------------------------- |
213 |
- following cases can arise: |
214 |
- |
215 |
- (1) the final quantum of encoding input is an integral |
216 |
- multiple of 24 bits; here, the final unit of encoded |
217 |
- output will be an integral multiple of 4 characters |
218 |
- with no "=" padding, |
219 |
- (2) the final quantum of encoding input is exactly 8 bits; |
220 |
- here, the final unit of encoded output will be two |
221 |
- characters followed by two "=" padding characters, or |
222 |
- (3) the final quantum of encoding input is exactly 16 bits; |
223 |
- here, the final unit of encoded output will be three |
224 |
- characters followed by one "=" padding character. |
225 |
-*/ |
226 |
- |
227 |
-/* |
228 |
- *---------------------------------------------------------------------------- |
229 |
- * |
230 |
- * Base64_Encode -- |
231 |
- * |
232 |
- * Base64-encodes srcLength bytes from src and stores result in dst. |
233 |
- * |
234 |
- * Results: |
235 |
- * TRUE if the destination held enough space for the decoded result, |
236 |
- * FALSE otherwise. |
237 |
- * |
238 |
- * Side effects: |
239 |
- * Updates dstSize with the number of encoded bytes (excluding the |
240 |
- * terminating '\0'). |
241 |
- * |
242 |
- *---------------------------------------------------------------------------- |
243 |
- */ |
244 |
- |
245 |
-Bool |
246 |
-Base64_Encode(uint8 const *src, // IN: |
247 |
- size_t srcSize, // IN: |
248 |
- char *dst, // OUT: |
249 |
- size_t dstMax, // IN: max result length, including NUL byte |
250 |
- size_t *dstSize) // OUT: result length, may be NULL |
251 |
-{ |
252 |
- char *dst0 = dst; |
253 |
- |
254 |
- ASSERT(src || srcSize == 0); |
255 |
- ASSERT(dst); |
256 |
- |
257 |
- if (4 * ((srcSize + 2) / 3) >= dstMax) { |
258 |
- if (dstSize) { |
259 |
- *dstSize = 0; |
260 |
- } |
261 |
- |
262 |
- return FALSE; |
263 |
- } |
264 |
- |
265 |
- while (LIKELY(srcSize > 2)) { |
266 |
- dst[0] = Base64[src[0] >> 2]; |
267 |
- dst[1] = Base64[(src[0] & 0x03) << 4 | src[1] >> 4]; |
268 |
- dst[2] = Base64[(src[1] & 0x0f) << 2 | src[2] >> 6]; |
269 |
- dst[3] = Base64[src[2] & 0x3f]; |
270 |
- |
271 |
- srcSize -= 3; |
272 |
- src += 3; |
273 |
- dst += 4; |
274 |
- } |
275 |
- |
276 |
- /* Now we worry about padding. */ |
277 |
- if (LIKELY(srcSize--)) { |
278 |
- uint8 src1 = srcSize ? src[1] : 0; |
279 |
- |
280 |
- dst[0] = Base64[src[0] >> 2]; |
281 |
- dst[1] = Base64[(src[0] & 0x03) << 4 | src1 >> 4]; |
282 |
- dst[2] = srcSize ? Base64[(src1 & 0x0f) << 2] : Pad64; |
283 |
- dst[3] = Pad64; |
284 |
- dst += 4; |
285 |
- } |
286 |
- |
287 |
- dst[0] = '\0'; /* Returned value doesn't count \0. */ |
288 |
- if (dstSize) { |
289 |
- *dstSize = dst - dst0; |
290 |
- } |
291 |
- |
292 |
- return TRUE; |
293 |
-} |
294 |
- |
295 |
- |
296 |
-#ifdef __I_WANT_TO_TEST_THIS__ |
297 |
-main() |
298 |
-{ |
299 |
- struct { |
300 |
- char *in, *out; |
301 |
- } tests[] = { |
302 |
- {"", ""}, |
303 |
- {"MQ==", "1"}, |
304 |
- {"MTI=", "12"}, |
305 |
- {"MTIz", "123"}, |
306 |
- {"MTIzNA==", "1234"}, |
307 |
- {"SGVsbG8gRWR3YXJkIGFuZCBKb2huIQ==","Hello Edward and John!"}, |
308 |
- {NULL, NULL} |
309 |
- }, *test; |
310 |
- |
311 |
- size_t bufMax; |
312 |
- if (1) { |
313 |
- for (bufMax = 0; bufMax < 7; ++bufMax) { |
314 |
- char buf[999]; |
315 |
- size_t bufSize; |
316 |
- |
317 |
- if (bufMax == 6) { |
318 |
- bufMax = sizeof buf; |
319 |
- } |
320 |
- |
321 |
- printf("\nBuffer size %ld:\n", bufMax); |
322 |
- |
323 |
- test = tests; |
324 |
- for (; test->in; ++test) { |
325 |
- Bool r; |
326 |
- |
327 |
- r = Base64_Decode(test->in, buf, bufMax, &bufSize); |
328 |
- |
329 |
- if ((bufMax > strlen(test->out)) && (bufSize < strlen(test->out))) { |
330 |
- printf("Decoding of %s failed. Decoded size %ld < expected %ld\n", |
331 |
- test->in, bufSize, strlen(test->out)); |
332 |
- } |
333 |
- if (memcmp(test->out, buf, bufSize) != 0) { |
334 |
- printf("Decoding of %s failed. Got %s (%ld), not %s\n", |
335 |
- test->in, buf, bufSize, test->out); |
336 |
- } else { |
337 |
- printf("Good: %s -> %s (%ld)\n", test->in, buf, bufSize); |
338 |
- } |
339 |
- |
340 |
- r = Base64_Encode(test->out, strlen(test->out), |
341 |
- buf, bufMax, &bufSize); |
342 |
- buf[bufMax] = 0; |
343 |
- |
344 |
- if (bufMax <= strlen(test->in) && r == 0) { |
345 |
- printf("Good: %s. Failed for bufMax %ld (required %ld)\n", test->out, bufMax, strlen(test->in)); |
346 |
- } else { |
347 |
- if (!r || bufSize != strlen(test->in) || |
348 |
- strncmp(test->in, buf, bufSize) != 0) { |
349 |
- printf("Encoding of %s failed. r = %d. Got %s (%ld), not %s\n", |
350 |
- test->out, r, buf, bufSize, test->in); |
351 |
- } else { |
352 |
- printf("Good: %s -> %s (%ld)\n", test->out, buf, bufSize); |
353 |
- } |
354 |
- } |
355 |
- } |
356 |
- } |
357 |
- } |
358 |
- |
359 |
- for (bufMax = 0; bufMax < 100000; ++bufMax) { |
360 |
- char random_in[8000]; |
361 |
- char random_out[16000]; |
362 |
- size_t bufSize; |
363 |
- |
364 |
- Bool r = Base64_Encode(random_in, sizeof random_in, |
365 |
- random_out, sizeof random_out, &bufSize); |
366 |
- |
367 |
- if (!r) { |
368 |
- printf("Encoding failed.\n"); |
369 |
- } |
370 |
- } |
371 |
-} |
372 |
-#endif |
373 |
- |
374 |
- |
375 |
-/* |
376 |
- *---------------------------------------------------------------------------- |
377 |
- * |
378 |
- * Base64_Decode -- |
379 |
- * |
380 |
- * Skips all whitespace anywhere. Converts characters, four at |
381 |
- * a time, starting at (or after) src from base - 64 numbers into three |
382 |
- * 8 bit bytes in the target area. Returns the number of data bytes |
383 |
- * stored at the target in the provided out parameter. |
384 |
- * |
385 |
- * Results: |
386 |
- * TRUE on success, FALSE on failure. |
387 |
- * |
388 |
- * Side effects: |
389 |
- * None. |
390 |
- * |
391 |
- *---------------------------------------------------------------------------- |
392 |
- */ |
393 |
- |
394 |
-Bool |
395 |
-Base64_Decode(char const *in, // IN: |
396 |
- uint8 *out, // OUT: |
397 |
- size_t outSize, // IN: |
398 |
- size_t *dataLength) // OUT: |
399 |
-{ |
400 |
- return Base64_ChunkDecode(in, -1, out, outSize, dataLength); |
401 |
-} |
402 |
- |
403 |
- |
404 |
-/* |
405 |
- *---------------------------------------------------------------------------- |
406 |
- * |
407 |
- * Base64_ChunkDecode -- |
408 |
- * |
409 |
- * Skips all whitespace anywhere. Converts characters, four at |
410 |
- * a time, starting at (or after) src from base - 64 numbers into three |
411 |
- * 8 bit bytes in the target area. Conversion stops after inSize (which |
412 |
- * must be a multiple of 4) characters, or an EOM marker. Returns the |
413 |
- * number of data bytes stored at the target in the provided out parameter. |
414 |
- * |
415 |
- * Results: |
416 |
- * TRUE on success, FALSE on failure. |
417 |
- * |
418 |
- * Side effects: |
419 |
- * None. |
420 |
- * |
421 |
- *---------------------------------------------------------------------------- |
422 |
- */ |
423 |
- |
424 |
-Bool |
425 |
-Base64_ChunkDecode(char const *in, // IN: |
426 |
- size_t inSize, // IN: |
427 |
- uint8 *out, // OUT: |
428 |
- size_t outSize, // IN: |
429 |
- size_t *dataLength) // OUT: |
430 |
-{ |
431 |
- uint32 b = 0; |
432 |
- int n = 0; |
433 |
- uintptr_t i = 0; |
434 |
- size_t inputIndex = 0; |
435 |
- |
436 |
- ASSERT(in); |
437 |
- ASSERT(out || outSize == 0); |
438 |
- ASSERT(dataLength); |
439 |
- ASSERT((inSize == -1) || (inSize % 4) == 0); |
440 |
- *dataLength = 0; |
441 |
- |
442 |
- i = 0; |
443 |
- for (;inputIndex < inSize;) { |
444 |
- int p = base64Reverse[(unsigned char)in[inputIndex]]; |
445 |
- |
446 |
- if (UNLIKELY(p < 0)) { |
447 |
- switch (p) { |
448 |
- case WS: |
449 |
- inputIndex++; |
450 |
- break; |
451 |
- case EOM: |
452 |
- *dataLength = i; |
453 |
- return TRUE; |
454 |
- case ILLEGAL: |
455 |
- default: |
456 |
- return FALSE; |
457 |
- } |
458 |
- } else { |
459 |
- inputIndex++; |
460 |
- if (UNLIKELY(i >= outSize)) { |
461 |
- return FALSE; |
462 |
- } |
463 |
- b = (b << 6) | p; |
464 |
- n += 6; |
465 |
- if (LIKELY(n >= 8)) { |
466 |
- n -= 8; |
467 |
- out[i++] = b >> n; |
468 |
- } |
469 |
- } |
470 |
- } |
471 |
- *dataLength = i; |
472 |
- return TRUE; |
473 |
-} |
474 |
- |
475 |
- |
476 |
-/* |
477 |
- *---------------------------------------------------------------------------- |
478 |
- * |
479 |
- * Base64_ValidEncoding -- |
480 |
- * |
481 |
- * Returns TRUE if the specified input buffer is valid Base64 input. |
482 |
- * |
483 |
- * Results: |
484 |
- * TRUE or FALSE. |
485 |
- * |
486 |
- * Side effects: |
487 |
- * None. |
488 |
- * |
489 |
- *---------------------------------------------------------------------------- |
490 |
- */ |
491 |
- |
492 |
-Bool |
493 |
-Base64_ValidEncoding(char const *src, // IN: |
494 |
- size_t srcLength) // IN: |
495 |
-{ |
496 |
- size_t i; |
497 |
- |
498 |
- ASSERT(src); |
499 |
- for (i = 0; i < srcLength; i++) { |
500 |
- uint8 c = src[i]; /* MSVC CRT will die on negative arguments to is* */ |
501 |
- |
502 |
- if (!isalpha(c) && !isdigit(c) && |
503 |
- c != '+' && c != '=' && c != '/') { |
504 |
- return FALSE; |
505 |
- } |
506 |
- } |
507 |
- |
508 |
- return TRUE; |
509 |
-} |
510 |
- |
511 |
- |
512 |
-/* |
513 |
- *---------------------------------------------------------------------------- |
514 |
- * |
515 |
- * Base64_EncodedLength -- |
516 |
- * |
517 |
- * Given a binary buffer, how many bytes would it take to encode it. |
518 |
- * |
519 |
- * Results: |
520 |
- * Number of bytes needed to encode, including terminating NUL byte. |
521 |
- * |
522 |
- * Side effects: |
523 |
- * None. |
524 |
- * |
525 |
- *---------------------------------------------------------------------------- |
526 |
- */ |
527 |
- |
528 |
-size_t |
529 |
-Base64_EncodedLength(uint8 const *src, // IN: |
530 |
- size_t srcLength) // IN: |
531 |
-{ |
532 |
- return ((srcLength + 2) / 3 * 4) + 1; |
533 |
-} |
534 |
- |
535 |
- |
536 |
-/* |
537 |
- *---------------------------------------------------------------------------- |
538 |
- * |
539 |
- * Base64_DecodedLength -- |
540 |
- * |
541 |
- * Given a base64 encoded string, how many bytes do we need to decode it. |
542 |
- * Assumes no whitespace. This is not necessarily the length of the |
543 |
- * decoded data (Base64_Decode requires a few extra bytes... don't blame |
544 |
- * me, I didn't write it). |
545 |
- * |
546 |
- * Results: |
547 |
- * Number of bytes needed to decode input. |
548 |
- * |
549 |
- * Side effects: |
550 |
- * None. |
551 |
- * |
552 |
- *---------------------------------------------------------------------------- |
553 |
- */ |
554 |
- |
555 |
-size_t |
556 |
-Base64_DecodedLength(char const *src, // IN: |
557 |
- size_t srcLength) // IN: |
558 |
-{ |
559 |
- size_t length; |
560 |
- |
561 |
- ASSERT(src); |
562 |
- |
563 |
- length = srcLength / 4 * 3; |
564 |
- // PR 303173 - do the following check to avoid a negative value returned |
565 |
- // from this function. Note: length can only be in a multiple of 3 |
566 |
- if (length > 2) { |
567 |
- if (src[srcLength-1] == '=') { |
568 |
- length--; |
569 |
- } |
570 |
- if (src[srcLength-2] == '=') { |
571 |
- length--; |
572 |
- } |
573 |
- } |
574 |
- return length; |
575 |
-} |
576 |
- |
577 |
- |
578 |
-/* |
579 |
- *----------------------------------------------------------------------------- |
580 |
- * |
581 |
- * Base64_EasyEncode -- |
582 |
- * |
583 |
- * Base64-encode 'data' into a NUL-terminated string. |
584 |
- * |
585 |
- * Results: |
586 |
- * On success: TRUE. '*target' is set to an allocated string, that the |
587 |
- * caller must eventually free(). |
588 |
- * On failure: FALSE. '*target' is set to NULL. |
589 |
- * |
590 |
- * Side effects: |
591 |
- * None. |
592 |
- * |
593 |
- *----------------------------------------------------------------------------- |
594 |
- */ |
595 |
- |
596 |
-Bool |
597 |
-Base64_EasyEncode(const uint8 *src, // IN: data to encode |
598 |
- size_t srcLength, // IN: data size |
599 |
- char **target) // OUT: encoded string |
600 |
-{ |
601 |
- Bool succeeded = FALSE; |
602 |
- size_t size; |
603 |
- |
604 |
- ASSERT(src); |
605 |
- ASSERT(target); |
606 |
- |
607 |
- size = Base64_EncodedLength(src, srcLength); |
608 |
- |
609 |
- *target = (char *) malloc(size); |
610 |
- |
611 |
- if (!*target) { |
612 |
- goto exit; |
613 |
- } |
614 |
- |
615 |
- if (!Base64_Encode(src, srcLength, *target, size, NULL)) { |
616 |
- goto exit; |
617 |
- } |
618 |
- |
619 |
- succeeded = TRUE; |
620 |
- |
621 |
-exit: |
622 |
- if (!succeeded) { |
623 |
- free(*target); |
624 |
- *target = NULL; |
625 |
- } |
626 |
- |
627 |
- return succeeded; |
628 |
-} |
629 |
- |
630 |
- |
631 |
-/* |
632 |
- *----------------------------------------------------------------------------- |
633 |
- * |
634 |
- * Base64_EasyDecode -- |
635 |
- * |
636 |
- * Base64-decode 'src' into a buffer. |
637 |
- * |
638 |
- * Results: |
639 |
- * TRUE on success, FALSE otherwise, plus the decoded data on success. |
640 |
- * Caller must free 'target' with free(). |
641 |
- * |
642 |
- * Side effects: |
643 |
- * None. |
644 |
- * |
645 |
- *----------------------------------------------------------------------------- |
646 |
- */ |
647 |
- |
648 |
-Bool |
649 |
-Base64_EasyDecode(const char *src, // IN: data to decode |
650 |
- uint8 **target, // OUT: decoded data |
651 |
- size_t *targSize) // OUT: data size |
652 |
-{ |
653 |
- Bool succeeded = FALSE; |
654 |
- size_t theDataSize; |
655 |
- uint8 *theData; |
656 |
- |
657 |
- ASSERT(src); |
658 |
- ASSERT(target); |
659 |
- ASSERT(targSize); |
660 |
- |
661 |
- theDataSize = Base64_DecodedLength(src, strlen(src)); |
662 |
- |
663 |
- theData = (uint8 *) malloc(theDataSize); |
664 |
- |
665 |
- if (!theData) { |
666 |
- goto exit; |
667 |
- } |
668 |
- |
669 |
- if (!Base64_Decode(src, theData, theDataSize, &theDataSize)) { |
670 |
- free(theData); |
671 |
- goto exit; |
672 |
- } |
673 |
- |
674 |
- *target = theData; |
675 |
- *targSize = theDataSize; |
676 |
- |
677 |
- succeeded = TRUE; |
678 |
- |
679 |
-exit: |
680 |
- if (!succeeded) { |
681 |
- *target = NULL; |
682 |
- *targSize = 0; |
683 |
- } |
684 |
- |
685 |
- return succeeded; |
686 |
-} |
687 |
--- lib/include/ovmbase64.h.orig 2013-12-27 16:39:12.000000000 +0000 |
688 |
+++ lib/include/ovmbase64.h 2013-12-27 16:39:46.000000000 +0000 |
689 |
@@ -0,0 +1,46 @@ |
690 |
+/********************************************************* |
691 |
+ * Copyright (C) 2004 VMware, Inc. All rights reserved. |
692 |
+ * |
693 |
+ * This program is free software; you can redistribute it and/or modify it |
694 |
+ * under the terms of the GNU Lesser General Public License as published |
695 |
+ * by the Free Software Foundation version 2.1 and no later version. |
696 |
+ * |
697 |
+ * This program is distributed in the hope that it will be useful, but |
698 |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
699 |
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public |
700 |
+ * License for more details. |
701 |
+ * |
702 |
+ * You should have received a copy of the GNU Lesser General Public License |
703 |
+ * along with this program; if not, write to the Free Software Foundation, Inc., |
704 |
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
705 |
+ * |
706 |
+ *********************************************************/ |
707 |
+ |
708 |
+/* |
709 |
+ * base64.h -- |
710 |
+ * |
711 |
+ * Functions to base64 encode/decode buffers. Implemented in |
712 |
+ * lib/misc/base64.c. |
713 |
+ */ |
714 |
+ |
715 |
+#ifndef _BASE64_H |
716 |
+#define _BASE64_H |
717 |
+ |
718 |
+Bool Base64_Encode(uint8 const *src, size_t srcLength, |
719 |
+ char *target, size_t targSize, |
720 |
+ size_t *dataLength); |
721 |
+Bool Base64_Decode(char const *src, |
722 |
+ uint8 *target, size_t targSize, |
723 |
+ size_t *dataLength); |
724 |
+Bool Base64_ChunkDecode(char const *src, size_t inSize, |
725 |
+ uint8 *target, size_t targSize, |
726 |
+ size_t *dataLength); |
727 |
+Bool Base64_ValidEncoding(char const *src, size_t srcLength); |
728 |
+size_t Base64_EncodedLength(uint8 const *src, size_t srcLength); |
729 |
+size_t Base64_DecodedLength(char const *src, size_t srcLength); |
730 |
+Bool Base64_EasyEncode(const uint8 *src, size_t srcLength, |
731 |
+ char **target); |
732 |
+Bool Base64_EasyDecode(const char *src, |
733 |
+ uint8 **target, size_t *targSize); |
734 |
+ |
735 |
+#endif |
736 |
--- lib/misc/ovmbase64.c.orig 2013-12-27 16:39:33.000000000 +0000 |
737 |
+++ lib/misc/ovmbase64.c 2013-12-27 16:39:56.000000000 +0000 |
738 |
@@ -0,0 +1,634 @@ |
739 |
+/* |
740 |
+ * Copyright (c) 1996, 1998 by Internet Software Consortium. |
741 |
+ * |
742 |
+ * Permission to use, copy, modify, and distribute this software for any |
743 |
+ * purpose with or without fee is hereby granted, provided that the above |
744 |
+ * copyright notice and this permission notice appear in all copies. |
745 |
+ * |
746 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS |
747 |
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
748 |
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE |
749 |
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
750 |
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
751 |
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
752 |
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
753 |
+ * SOFTWARE. |
754 |
+ */ |
755 |
+ |
756 |
+/* |
757 |
+ * Portions Copyright (c) 1995 by International Business Machines, Inc. |
758 |
+ * |
759 |
+ * International Business Machines, Inc. (hereinafter called IBM) grants |
760 |
+ * permission under its copyrights to use, copy, modify, and distribute this |
761 |
+ * Software with or without fee, provided that the above copyright notice and |
762 |
+ * all paragraphs of this notice appear in all copies, and that the name of IBM |
763 |
+ * not be used in connection with the marketing of any product incorporating |
764 |
+ * the Software or modifications thereof, without specific, written prior |
765 |
+ * permission. |
766 |
+ * |
767 |
+ * To the extent it has a right to do so, IBM grants an immunity from suit |
768 |
+ * under its patents, if any, for the use, sale or manufacture of products to |
769 |
+ * the extent that such products are used for performing Domain Name System |
770 |
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is |
771 |
+ * granted for any product per se or for any other function of any product. |
772 |
+ * |
773 |
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, |
774 |
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
775 |
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, |
776 |
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING |
777 |
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN |
778 |
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. |
779 |
+ */ |
780 |
+ |
781 |
+#include <sys/types.h> |
782 |
+ |
783 |
+#include <ctype.h> |
784 |
+#include <stdio.h> |
785 |
+#include <stdlib.h> |
786 |
+#include <string.h> |
787 |
+#include "vm_basic_types.h" |
788 |
+#include "vm_assert.h" |
789 |
+#include "base64.h" |
790 |
+ |
791 |
+static const char Base64[] = |
792 |
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
793 |
+static const char Pad64 = '='; |
794 |
+ |
795 |
+// Special markers |
796 |
+enum { |
797 |
+ ILLEGAL = -1, EOM = -2, WS = -3 |
798 |
+}; |
799 |
+ |
800 |
+/* |
801 |
+ * Reverse byte map used for decoding. Except for specials (negative values), contains the index |
802 |
+ * into Base64[] where given value is found, ie: base64Reverse[Base64[n]] = n, for 0 <= n < 64 |
803 |
+ * |
804 |
+ * This static initialization replaces, and should have identical result to, this runtime init: |
805 |
+ * |
806 |
+ * for (i = 0; i < 256; ++i) { |
807 |
+ * base64Reverse[i] = isspace(i) ? WS : ILLEGAL; |
808 |
+ * } |
809 |
+ * base64Reverse['\0'] = EOM; |
810 |
+ * base64Reverse['='] = EOM; |
811 |
+ * for (i = 0; Base64[i]; ++i) { |
812 |
+ * base64Reverse[(unsigned)Base64[i]] = (char) i; |
813 |
+ * } |
814 |
+ */ |
815 |
+ |
816 |
+static const signed char base64Reverse[256] = { |
817 |
+ EOM, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 00-07 */ |
818 |
+ ILLEGAL, WS, WS, WS, WS, WS, ILLEGAL, ILLEGAL, /* 08-0F */ |
819 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 10-17 */ |
820 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 18-1F */ |
821 |
+ WS, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 20-27 */ |
822 |
+ ILLEGAL, ILLEGAL, ILLEGAL, 62, ILLEGAL, ILLEGAL, ILLEGAL, 63, /* 28-2F */ |
823 |
+ 52, 53, 54, 55, 56, 57, 58, 59, /* 30-37 */ |
824 |
+ 60, 61, ILLEGAL, ILLEGAL, ILLEGAL, EOM, ILLEGAL, ILLEGAL, /* 38-3F */ |
825 |
+ ILLEGAL, 0, 1, 2, 3, 4, 5, 6, /* 40-47 */ |
826 |
+ 7, 8, 9, 10, 11, 12, 13, 14, /* 48-4F */ |
827 |
+ 15, 16, 17, 18, 19, 20, 21, 22, /* 50-57 */ |
828 |
+ 23, 24, 25, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 58-5F */ |
829 |
+ ILLEGAL, 26, 27, 28, 29, 30, 31, 32, /* 60-67 */ |
830 |
+ 33, 34, 35, 36, 37, 38, 39, 40, /* 68-6F */ |
831 |
+ 41, 42, 43, 44, 45, 46, 47, 48, /* 70-77 */ |
832 |
+ 49, 50, 51, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 78-7F */ |
833 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 80-87 */ |
834 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 88-8F */ |
835 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 90-97 */ |
836 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* 98-9F */ |
837 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* A0-A7 */ |
838 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* A8-AF */ |
839 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* B0-B7 */ |
840 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* B8-BF */ |
841 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* C0-C7 */ |
842 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* C8-CF */ |
843 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* D0-D7 */ |
844 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* D8-DF */ |
845 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* E0-E7 */ |
846 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* E8-EF */ |
847 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, /* F0-F7 */ |
848 |
+ ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL }; /* F8-FF */ |
849 |
+ |
850 |
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) |
851 |
+ The following encoding technique is taken from RFC 1521 by Borenstein |
852 |
+ and Freed. It is reproduced here in a slightly edited form for |
853 |
+ convenience. |
854 |
+ |
855 |
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be |
856 |
+ represented per printable character. (The extra 65th character, "=", |
857 |
+ is used to signify a special processing function.) |
858 |
+ |
859 |
+ The encoding process represents 24-bit groups of input bits as output |
860 |
+ strings of 4 encoded characters. Proceeding from left to right, a |
861 |
+ 24-bit input group is formed by concatenating 3 8-bit input groups. |
862 |
+ These 24 bits are then treated as 4 concatenated 6-bit groups, each |
863 |
+ of which is translated into a single digit in the base64 alphabet. |
864 |
+ |
865 |
+ Each 6-bit group is used as an index into an array of 64 printable |
866 |
+ characters. The character referenced by the index is placed in the |
867 |
+ output string. |
868 |
+ |
869 |
+ Table 1: The Base64 Alphabet |
870 |
+ |
871 |
+ Value Encoding Value Encoding Value Encoding Value Encoding |
872 |
+ 0 A 17 R 34 i 51 z |
873 |
+ 1 B 18 S 35 j 52 0 |
874 |
+ 2 C 19 T 36 k 53 1 |
875 |
+ 3 D 20 U 37 l 54 2 |
876 |
+ 4 E 21 V 38 m 55 3 |
877 |
+ 5 F 22 W 39 n 56 4 |
878 |
+ 6 G 23 X 40 o 57 5 |
879 |
+ 7 H 24 Y 41 p 58 6 |
880 |
+ 8 I 25 Z 42 q 59 7 |
881 |
+ 9 J 26 a 43 r 60 8 |
882 |
+ 10 K 27 b 44 s 61 9 |
883 |
+ 11 L 28 c 45 t 62 + |
884 |
+ 12 M 29 d 46 u 63 / |
885 |
+ 13 N 30 e 47 v |
886 |
+ 14 O 31 f 48 w (pad) = |
887 |
+ 15 P 32 g 49 x |
888 |
+ 16 Q 33 h 50 y |
889 |
+ |
890 |
+ Special processing is performed if fewer than 24 bits are available |
891 |
+ at the end of the data being encoded. A full encoding quantum is |
892 |
+ always completed at the end of a quantity. When fewer than 24 input |
893 |
+ bits are available in an input group, zero bits are added (on the |
894 |
+ right) to form an integral number of 6-bit groups. Padding at the |
895 |
+ end of the data is performed using the '=' character. |
896 |
+ |
897 |
+ Since all base64 input is an integral number of octets, only the |
898 |
+ ------------------------------------------------- |
899 |
+ following cases can arise: |
900 |
+ |
901 |
+ (1) the final quantum of encoding input is an integral |
902 |
+ multiple of 24 bits; here, the final unit of encoded |
903 |
+ output will be an integral multiple of 4 characters |
904 |
+ with no "=" padding, |
905 |
+ (2) the final quantum of encoding input is exactly 8 bits; |
906 |
+ here, the final unit of encoded output will be two |
907 |
+ characters followed by two "=" padding characters, or |
908 |
+ (3) the final quantum of encoding input is exactly 16 bits; |
909 |
+ here, the final unit of encoded output will be three |
910 |
+ characters followed by one "=" padding character. |
911 |
+*/ |
912 |
+ |
913 |
+/* |
914 |
+ *---------------------------------------------------------------------------- |
915 |
+ * |
916 |
+ * Base64_Encode -- |
917 |
+ * |
918 |
+ * Base64-encodes srcLength bytes from src and stores result in dst. |
919 |
+ * |
920 |
+ * Results: |
921 |
+ * TRUE if the destination held enough space for the decoded result, |
922 |
+ * FALSE otherwise. |
923 |
+ * |
924 |
+ * Side effects: |
925 |
+ * Updates dstSize with the number of encoded bytes (excluding the |
926 |
+ * terminating '\0'). |
927 |
+ * |
928 |
+ *---------------------------------------------------------------------------- |
929 |
+ */ |
930 |
+ |
931 |
+Bool |
932 |
+Base64_Encode(uint8 const *src, // IN: |
933 |
+ size_t srcSize, // IN: |
934 |
+ char *dst, // OUT: |
935 |
+ size_t dstMax, // IN: max result length, including NUL byte |
936 |
+ size_t *dstSize) // OUT: result length, may be NULL |
937 |
+{ |
938 |
+ char *dst0 = dst; |
939 |
+ |
940 |
+ ASSERT(src || srcSize == 0); |
941 |
+ ASSERT(dst); |
942 |
+ |
943 |
+ if (4 * ((srcSize + 2) / 3) >= dstMax) { |
944 |
+ if (dstSize) { |
945 |
+ *dstSize = 0; |
946 |
+ } |
947 |
+ |
948 |
+ return FALSE; |
949 |
+ } |
950 |
+ |
951 |
+ while (LIKELY(srcSize > 2)) { |
952 |
+ dst[0] = Base64[src[0] >> 2]; |
953 |
+ dst[1] = Base64[(src[0] & 0x03) << 4 | src[1] >> 4]; |
954 |
+ dst[2] = Base64[(src[1] & 0x0f) << 2 | src[2] >> 6]; |
955 |
+ dst[3] = Base64[src[2] & 0x3f]; |
956 |
+ |
957 |
+ srcSize -= 3; |
958 |
+ src += 3; |
959 |
+ dst += 4; |
960 |
+ } |
961 |
+ |
962 |
+ /* Now we worry about padding. */ |
963 |
+ if (LIKELY(srcSize--)) { |
964 |
+ uint8 src1 = srcSize ? src[1] : 0; |
965 |
+ |
966 |
+ dst[0] = Base64[src[0] >> 2]; |
967 |
+ dst[1] = Base64[(src[0] & 0x03) << 4 | src1 >> 4]; |
968 |
+ dst[2] = srcSize ? Base64[(src1 & 0x0f) << 2] : Pad64; |
969 |
+ dst[3] = Pad64; |
970 |
+ dst += 4; |
971 |
+ } |
972 |
+ |
973 |
+ dst[0] = '\0'; /* Returned value doesn't count \0. */ |
974 |
+ if (dstSize) { |
975 |
+ *dstSize = dst - dst0; |
976 |
+ } |
977 |
+ |
978 |
+ return TRUE; |
979 |
+} |
980 |
+ |
981 |
+ |
982 |
+#ifdef __I_WANT_TO_TEST_THIS__ |
983 |
+main() |
984 |
+{ |
985 |
+ struct { |
986 |
+ char *in, *out; |
987 |
+ } tests[] = { |
988 |
+ {"", ""}, |
989 |
+ {"MQ==", "1"}, |
990 |
+ {"MTI=", "12"}, |
991 |
+ {"MTIz", "123"}, |
992 |
+ {"MTIzNA==", "1234"}, |
993 |
+ {"SGVsbG8gRWR3YXJkIGFuZCBKb2huIQ==","Hello Edward and John!"}, |
994 |
+ {NULL, NULL} |
995 |
+ }, *test; |
996 |
+ |
997 |
+ size_t bufMax; |
998 |
+ if (1) { |
999 |
+ for (bufMax = 0; bufMax < 7; ++bufMax) { |
1000 |
+ char buf[999]; |
1001 |
+ size_t bufSize; |
1002 |
+ |
1003 |
+ if (bufMax == 6) { |
1004 |
+ bufMax = sizeof buf; |
1005 |
+ } |
1006 |
+ |
1007 |
+ printf("\nBuffer size %ld:\n", bufMax); |
1008 |
+ |
1009 |
+ test = tests; |
1010 |
+ for (; test->in; ++test) { |
1011 |
+ Bool r; |
1012 |
+ |
1013 |
+ r = Base64_Decode(test->in, buf, bufMax, &bufSize); |
1014 |
+ |
1015 |
+ if ((bufMax > strlen(test->out)) && (bufSize < strlen(test->out))) { |
1016 |
+ printf("Decoding of %s failed. Decoded size %ld < expected %ld\n", |
1017 |
+ test->in, bufSize, strlen(test->out)); |
1018 |
+ } |
1019 |
+ if (memcmp(test->out, buf, bufSize) != 0) { |
1020 |
+ printf("Decoding of %s failed. Got %s (%ld), not %s\n", |
1021 |
+ test->in, buf, bufSize, test->out); |
1022 |
+ } else { |
1023 |
+ printf("Good: %s -> %s (%ld)\n", test->in, buf, bufSize); |
1024 |
+ } |
1025 |
+ |
1026 |
+ r = Base64_Encode(test->out, strlen(test->out), |
1027 |
+ buf, bufMax, &bufSize); |
1028 |
+ buf[bufMax] = 0; |
1029 |
+ |
1030 |
+ if (bufMax <= strlen(test->in) && r == 0) { |
1031 |
+ printf("Good: %s. Failed for bufMax %ld (required %ld)\n", test->out, bufMax, strlen(test->in)); |
1032 |
+ } else { |
1033 |
+ if (!r || bufSize != strlen(test->in) || |
1034 |
+ strncmp(test->in, buf, bufSize) != 0) { |
1035 |
+ printf("Encoding of %s failed. r = %d. Got %s (%ld), not %s\n", |
1036 |
+ test->out, r, buf, bufSize, test->in); |
1037 |
+ } else { |
1038 |
+ printf("Good: %s -> %s (%ld)\n", test->out, buf, bufSize); |
1039 |
+ } |
1040 |
+ } |
1041 |
+ } |
1042 |
+ } |
1043 |
+ } |
1044 |
+ |
1045 |
+ for (bufMax = 0; bufMax < 100000; ++bufMax) { |
1046 |
+ char random_in[8000]; |
1047 |
+ char random_out[16000]; |
1048 |
+ size_t bufSize; |
1049 |
+ |
1050 |
+ Bool r = Base64_Encode(random_in, sizeof random_in, |
1051 |
+ random_out, sizeof random_out, &bufSize); |
1052 |
+ |
1053 |
+ if (!r) { |
1054 |
+ printf("Encoding failed.\n"); |
1055 |
+ } |
1056 |
+ } |
1057 |
+} |
1058 |
+#endif |
1059 |
+ |
1060 |
+ |
1061 |
+/* |
1062 |
+ *---------------------------------------------------------------------------- |
1063 |
+ * |
1064 |
+ * Base64_Decode -- |
1065 |
+ * |
1066 |
+ * Skips all whitespace anywhere. Converts characters, four at |
1067 |
+ * a time, starting at (or after) src from base - 64 numbers into three |
1068 |
+ * 8 bit bytes in the target area. Returns the number of data bytes |
1069 |
+ * stored at the target in the provided out parameter. |
1070 |
+ * |
1071 |
+ * Results: |
1072 |
+ * TRUE on success, FALSE on failure. |
1073 |
+ * |
1074 |
+ * Side effects: |
1075 |
+ * None. |
1076 |
+ * |
1077 |
+ *---------------------------------------------------------------------------- |
1078 |
+ */ |
1079 |
+ |
1080 |
+Bool |
1081 |
+Base64_Decode(char const *in, // IN: |
1082 |
+ uint8 *out, // OUT: |
1083 |
+ size_t outSize, // IN: |
1084 |
+ size_t *dataLength) // OUT: |
1085 |
+{ |
1086 |
+ return Base64_ChunkDecode(in, -1, out, outSize, dataLength); |
1087 |
+} |
1088 |
+ |
1089 |
+ |
1090 |
+/* |
1091 |
+ *---------------------------------------------------------------------------- |
1092 |
+ * |
1093 |
+ * Base64_ChunkDecode -- |
1094 |
+ * |
1095 |
+ * Skips all whitespace anywhere. Converts characters, four at |
1096 |
+ * a time, starting at (or after) src from base - 64 numbers into three |
1097 |
+ * 8 bit bytes in the target area. Conversion stops after inSize (which |
1098 |
+ * must be a multiple of 4) characters, or an EOM marker. Returns the |
1099 |
+ * number of data bytes stored at the target in the provided out parameter. |
1100 |
+ * |
1101 |
+ * Results: |
1102 |
+ * TRUE on success, FALSE on failure. |
1103 |
+ * |
1104 |
+ * Side effects: |
1105 |
+ * None. |
1106 |
+ * |
1107 |
+ *---------------------------------------------------------------------------- |
1108 |
+ */ |
1109 |
+ |
1110 |
+Bool |
1111 |
+Base64_ChunkDecode(char const *in, // IN: |
1112 |
+ size_t inSize, // IN: |
1113 |
+ uint8 *out, // OUT: |
1114 |
+ size_t outSize, // IN: |
1115 |
+ size_t *dataLength) // OUT: |
1116 |
+{ |
1117 |
+ uint32 b = 0; |
1118 |
+ int n = 0; |
1119 |
+ uintptr_t i = 0; |
1120 |
+ size_t inputIndex = 0; |
1121 |
+ |
1122 |
+ ASSERT(in); |
1123 |
+ ASSERT(out || outSize == 0); |
1124 |
+ ASSERT(dataLength); |
1125 |
+ ASSERT((inSize == -1) || (inSize % 4) == 0); |
1126 |
+ *dataLength = 0; |
1127 |
+ |
1128 |
+ i = 0; |
1129 |
+ for (;inputIndex < inSize;) { |
1130 |
+ int p = base64Reverse[(unsigned char)in[inputIndex]]; |
1131 |
+ |
1132 |
+ if (UNLIKELY(p < 0)) { |
1133 |
+ switch (p) { |
1134 |
+ case WS: |
1135 |
+ inputIndex++; |
1136 |
+ break; |
1137 |
+ case EOM: |
1138 |
+ *dataLength = i; |
1139 |
+ return TRUE; |
1140 |
+ case ILLEGAL: |
1141 |
+ default: |
1142 |
+ return FALSE; |
1143 |
+ } |
1144 |
+ } else { |
1145 |
+ inputIndex++; |
1146 |
+ if (UNLIKELY(i >= outSize)) { |
1147 |
+ return FALSE; |
1148 |
+ } |
1149 |
+ b = (b << 6) | p; |
1150 |
+ n += 6; |
1151 |
+ if (LIKELY(n >= 8)) { |
1152 |
+ n -= 8; |
1153 |
+ out[i++] = b >> n; |
1154 |
+ } |
1155 |
+ } |
1156 |
+ } |
1157 |
+ *dataLength = i; |
1158 |
+ return TRUE; |
1159 |
+} |
1160 |
+ |
1161 |
+ |
1162 |
+/* |
1163 |
+ *---------------------------------------------------------------------------- |
1164 |
+ * |
1165 |
+ * Base64_ValidEncoding -- |
1166 |
+ * |
1167 |
+ * Returns TRUE if the specified input buffer is valid Base64 input. |
1168 |
+ * |
1169 |
+ * Results: |
1170 |
+ * TRUE or FALSE. |
1171 |
+ * |
1172 |
+ * Side effects: |
1173 |
+ * None. |
1174 |
+ * |
1175 |
+ *---------------------------------------------------------------------------- |
1176 |
+ */ |
1177 |
+ |
1178 |
+Bool |
1179 |
+Base64_ValidEncoding(char const *src, // IN: |
1180 |
+ size_t srcLength) // IN: |
1181 |
+{ |
1182 |
+ size_t i; |
1183 |
+ |
1184 |
+ ASSERT(src); |
1185 |
+ for (i = 0; i < srcLength; i++) { |
1186 |
+ uint8 c = src[i]; /* MSVC CRT will die on negative arguments to is* */ |
1187 |
+ |
1188 |
+ if (!isalpha(c) && !isdigit(c) && |
1189 |
+ c != '+' && c != '=' && c != '/') { |
1190 |
+ return FALSE; |
1191 |
+ } |
1192 |
+ } |
1193 |
+ |
1194 |
+ return TRUE; |
1195 |
+} |
1196 |
+ |
1197 |
+ |
1198 |
+/* |
1199 |
+ *---------------------------------------------------------------------------- |
1200 |
+ * |
1201 |
+ * Base64_EncodedLength -- |
1202 |
+ * |
1203 |
+ * Given a binary buffer, how many bytes would it take to encode it. |
1204 |
+ * |
1205 |
+ * Results: |
1206 |
+ * Number of bytes needed to encode, including terminating NUL byte. |
1207 |
+ * |
1208 |
+ * Side effects: |
1209 |
+ * None. |
1210 |
+ * |
1211 |
+ *---------------------------------------------------------------------------- |
1212 |
+ */ |
1213 |
+ |
1214 |
+size_t |
1215 |
+Base64_EncodedLength(uint8 const *src, // IN: |
1216 |
+ size_t srcLength) // IN: |
1217 |
+{ |
1218 |
+ return ((srcLength + 2) / 3 * 4) + 1; |
1219 |
+} |
1220 |
+ |
1221 |
+ |
1222 |
+/* |
1223 |
+ *---------------------------------------------------------------------------- |
1224 |
+ * |
1225 |
+ * Base64_DecodedLength -- |
1226 |
+ * |
1227 |
+ * Given a base64 encoded string, how many bytes do we need to decode it. |
1228 |
+ * Assumes no whitespace. This is not necessarily the length of the |
1229 |
+ * decoded data (Base64_Decode requires a few extra bytes... don't blame |
1230 |
+ * me, I didn't write it). |
1231 |
+ * |
1232 |
+ * Results: |
1233 |
+ * Number of bytes needed to decode input. |
1234 |
+ * |
1235 |
+ * Side effects: |
1236 |
+ * None. |
1237 |
+ * |
1238 |
+ *---------------------------------------------------------------------------- |
1239 |
+ */ |
1240 |
+ |
1241 |
+size_t |
1242 |
+Base64_DecodedLength(char const *src, // IN: |
1243 |
+ size_t srcLength) // IN: |
1244 |
+{ |
1245 |
+ size_t length; |
1246 |
+ |
1247 |
+ ASSERT(src); |
1248 |
+ |
1249 |
+ length = srcLength / 4 * 3; |
1250 |
+ // PR 303173 - do the following check to avoid a negative value returned |
1251 |
+ // from this function. Note: length can only be in a multiple of 3 |
1252 |
+ if (length > 2) { |
1253 |
+ if (src[srcLength-1] == '=') { |
1254 |
+ length--; |
1255 |
+ } |
1256 |
+ if (src[srcLength-2] == '=') { |
1257 |
+ length--; |
1258 |
+ } |
1259 |
+ } |
1260 |
+ return length; |
1261 |
+} |
1262 |
+ |
1263 |
+ |
1264 |
+/* |
1265 |
+ *----------------------------------------------------------------------------- |
1266 |
+ * |
1267 |
+ * Base64_EasyEncode -- |
1268 |
+ * |
1269 |
+ * Base64-encode 'data' into a NUL-terminated string. |
1270 |
+ * |
1271 |
+ * Results: |
1272 |
+ * On success: TRUE. '*target' is set to an allocated string, that the |
1273 |
+ * caller must eventually free(). |
1274 |
+ * On failure: FALSE. '*target' is set to NULL. |
1275 |
+ * |
1276 |
+ * Side effects: |
1277 |
+ * None. |
1278 |
+ * |
1279 |
+ *----------------------------------------------------------------------------- |
1280 |
+ */ |
1281 |
+ |
1282 |
+Bool |
1283 |
+Base64_EasyEncode(const uint8 *src, // IN: data to encode |
1284 |
+ size_t srcLength, // IN: data size |
1285 |
+ char **target) // OUT: encoded string |
1286 |
+{ |
1287 |
+ Bool succeeded = FALSE; |
1288 |
+ size_t size; |
1289 |
+ |
1290 |
+ ASSERT(src); |
1291 |
+ ASSERT(target); |
1292 |
+ |
1293 |
+ size = Base64_EncodedLength(src, srcLength); |
1294 |
+ |
1295 |
+ *target = (char *) malloc(size); |
1296 |
+ |
1297 |
+ if (!*target) { |
1298 |
+ goto exit; |
1299 |
+ } |
1300 |
+ |
1301 |
+ if (!Base64_Encode(src, srcLength, *target, size, NULL)) { |
1302 |
+ goto exit; |
1303 |
+ } |
1304 |
+ |
1305 |
+ succeeded = TRUE; |
1306 |
+ |
1307 |
+exit: |
1308 |
+ if (!succeeded) { |
1309 |
+ free(*target); |
1310 |
+ *target = NULL; |
1311 |
+ } |
1312 |
+ |
1313 |
+ return succeeded; |
1314 |
+} |
1315 |
+ |
1316 |
+ |
1317 |
+/* |
1318 |
+ *----------------------------------------------------------------------------- |
1319 |
+ * |
1320 |
+ * Base64_EasyDecode -- |
1321 |
+ * |
1322 |
+ * Base64-decode 'src' into a buffer. |
1323 |
+ * |
1324 |
+ * Results: |
1325 |
+ * TRUE on success, FALSE otherwise, plus the decoded data on success. |
1326 |
+ * Caller must free 'target' with free(). |
1327 |
+ * |
1328 |
+ * Side effects: |
1329 |
+ * None. |
1330 |
+ * |
1331 |
+ *----------------------------------------------------------------------------- |
1332 |
+ */ |
1333 |
+ |
1334 |
+Bool |
1335 |
+Base64_EasyDecode(const char *src, // IN: data to decode |
1336 |
+ uint8 **target, // OUT: decoded data |
1337 |
+ size_t *targSize) // OUT: data size |
1338 |
+{ |
1339 |
+ Bool succeeded = FALSE; |
1340 |
+ size_t theDataSize; |
1341 |
+ uint8 *theData; |
1342 |
+ |
1343 |
+ ASSERT(src); |
1344 |
+ ASSERT(target); |
1345 |
+ ASSERT(targSize); |
1346 |
+ |
1347 |
+ theDataSize = Base64_DecodedLength(src, strlen(src)); |
1348 |
+ |
1349 |
+ theData = (uint8 *) malloc(theDataSize); |
1350 |
+ |
1351 |
+ if (!theData) { |
1352 |
+ goto exit; |
1353 |
+ } |
1354 |
+ |
1355 |
+ if (!Base64_Decode(src, theData, theDataSize, &theDataSize)) { |
1356 |
+ free(theData); |
1357 |
+ goto exit; |
1358 |
+ } |
1359 |
+ |
1360 |
+ *target = theData; |
1361 |
+ *targSize = theDataSize; |
1362 |
+ |
1363 |
+ succeeded = TRUE; |
1364 |
+ |
1365 |
+exit: |
1366 |
+ if (!succeeded) { |
1367 |
+ *target = NULL; |
1368 |
+ *targSize = 0; |
1369 |
+ } |
1370 |
+ |
1371 |
+ return succeeded; |
1372 |
+} |
1373 |
--- lib/foundryMsg/foundryMsg.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1374 |
+++ lib/foundryMsg/foundryMsg.c 2013-12-27 16:41:30.000000000 +0000 |
1375 |
@@ -29,7 +29,7 @@ |
1376 |
#include "vm_version.h" |
1377 |
#include "util.h" |
1378 |
#include "str.h" |
1379 |
-#include "base64.h" |
1380 |
+#include "ovmbase64.h" |
1381 |
|
1382 |
#include "vixOpenSource.h" |
1383 |
#include "vixCommands.h" |
1384 |
--- lib/file/file.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1385 |
+++ lib/file/file.c 2013-12-27 16:41:39.000000000 +0000 |
1386 |
@@ -60,7 +60,7 @@ |
1387 |
#include "fileIO.h" |
1388 |
#include "fileInt.h" |
1389 |
#include "dynbuf.h" |
1390 |
-#include "base64.h" |
1391 |
+#include "ovmbase64.h" |
1392 |
#include "timeutil.h" |
1393 |
#include "hostinfo.h" |
1394 |
#include "hostType.h" |
1395 |
--- lib/misc/Makefile.in.orig 2013-09-23 15:51:46.000000000 +0000 |
1396 |
+++ lib/misc/Makefile.in 2013-12-27 16:57:14.000000000 +0000 |
1397 |
@@ -82,7 +82,7 @@ |
1398 |
CONFIG_CLEAN_VPATH_FILES = |
1399 |
LTLIBRARIES = $(noinst_LTLIBRARIES) |
1400 |
libMisc_la_LIBADD = |
1401 |
-am_libMisc_la_OBJECTS = atomic.lo base64.lo codeset.lo codesetBase.lo \ |
1402 |
+am_libMisc_la_OBJECTS = atomic.lo ovmbase64.lo codeset.lo codesetBase.lo \ |
1403 |
codesetOld.lo dynarray.lo dynbuf.lo escape.lo hashTable.lo \ |
1404 |
hostinfo.lo hostinfoHV.lo hostinfoPosix.lo hostname.lo \ |
1405 |
hostType.lo idLinux.lo iovector.lo logFixed.lo machineID.lo \ |
1406 |
@@ -301,7 +301,7 @@ |
1407 |
top_builddir = @top_builddir@ |
1408 |
top_srcdir = @top_srcdir@ |
1409 |
noinst_LTLIBRARIES = libMisc.la |
1410 |
-libMisc_la_SOURCES = atomic.c base64.c codeset.c codesetBase.c \ |
1411 |
+libMisc_la_SOURCES = atomic.c ovmbase64.c codeset.c codesetBase.c \ |
1412 |
codesetOld.c dynarray.c dynbuf.c escape.c hashTable.c \ |
1413 |
hostinfo.c hostinfoHV.c hostinfoPosix.c hostname.c hostType.c \ |
1414 |
idLinux.c iovector.c logFixed.c machineID.c miscSolaris.c \ |
1415 |
--- lib/misc/Makefile.am.orig 2013-12-27 16:40:58.000000000 +0000 |
1416 |
+++ lib/misc/Makefile.am 2013-12-27 16:42:00.000000000 +0000 |
1417 |
@@ -19,7 +19,7 @@ |
1418 |
|
1419 |
libMisc_la_SOURCES = |
1420 |
libMisc_la_SOURCES += atomic.c |
1421 |
-libMisc_la_SOURCES += base64.c |
1422 |
+libMisc_la_SOURCES += ovmbase64.c |
1423 |
libMisc_la_SOURCES += codeset.c |
1424 |
libMisc_la_SOURCES += codesetBase.c |
1425 |
libMisc_la_SOURCES += codesetOld.c |
1426 |
--- lib/user/util.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1427 |
+++ lib/user/util.c 2013-12-27 16:42:25.000000000 +0000 |
1428 |
@@ -69,7 +69,7 @@ |
1429 |
#include "file.h" |
1430 |
#include "util_shared.h" |
1431 |
#include "escape.h" |
1432 |
-#include "base64.h" |
1433 |
+#include "ovmbase64.h" |
1434 |
#include "unicode.h" |
1435 |
#include "posix.h" |
1436 |
|
1437 |
--- services/plugins/vix/foundryToolsDaemon.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1438 |
+++ services/plugins/vix/foundryToolsDaemon.c 2013-12-27 16:42:38.000000000 +0000 |
1439 |
@@ -68,7 +68,7 @@ |
1440 |
#include "guest_msg_def.h" |
1441 |
#include "conf.h" |
1442 |
#include "vixCommands.h" |
1443 |
-#include "base64.h" |
1444 |
+#include "ovmbase64.h" |
1445 |
#include "syncDriver.h" |
1446 |
#include "hgfsServerManager.h" |
1447 |
#include "hgfs.h" |
1448 |
--- services/plugins/vix/vixTools.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1449 |
+++ services/plugins/vix/vixTools.c 2013-12-27 16:42:46.000000000 +0000 |
1450 |
@@ -87,7 +87,7 @@ |
1451 |
#include "guest_msg_def.h" |
1452 |
#include "conf.h" |
1453 |
#include "vixCommands.h" |
1454 |
-#include "base64.h" |
1455 |
+#include "ovmbase64.h" |
1456 |
#include "hostinfo.h" |
1457 |
#include "hgfsServerManager.h" |
1458 |
#include "hgfs.h" |
1459 |
--- xferlogs/xferlogs.c.orig 2013-12-27 16:40:58.000000000 +0000 |
1460 |
+++ xferlogs/xferlogs.c 2013-12-27 16:43:01.000000000 +0000 |
1461 |
@@ -50,7 +50,7 @@ |
1462 |
#include "debug.h" |
1463 |
#include "rpcvmx.h" |
1464 |
#include "rpcout.h" |
1465 |
-#include "base64.h" |
1466 |
+#include "ovmbase64.h" |
1467 |
#include "str.h" |
1468 |
#include "strutil.h" |
1469 |
|
1470 |
--- lib/misc/ovmbase64.c.orig 2013-12-27 16:50:49.000000000 +0000 |
1471 |
+++ lib/misc/ovmbase64.c 2013-12-27 16:50:58.000000000 +0000 |
1472 |
@@ -48,7 +48,7 @@ |
1473 |
#include <string.h> |
1474 |
#include "vm_basic_types.h" |
1475 |
#include "vm_assert.h" |
1476 |
-#include "base64.h" |
1477 |
+#include "ovmbase64.h" |
1478 |
|
1479 |
static const char Base64[] = |
1480 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |