[package] block-mount: fsck.sh should only call pi_include() if dir /lib/functions...
[openwrt.git] / package / px5g / src / polarssl / base64.h
1 /**
2 * \file base64.h
3 *
4 * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
5 *
6 * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * * Neither the names of PolarSSL or XySSL nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 #ifndef POLARSSL_BASE64_H
36 #define POLARSSL_BASE64_H
37
38 #define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010
39 #define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46 * \brief Encode a buffer into base64 format
47 *
48 * \param dst destination buffer
49 * \param dlen size of the buffer
50 * \param src source buffer
51 * \param slen amount of data to be encoded
52 *
53 * \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
54 * *dlen is always updated to reflect the amount
55 * of data that has (or would have) been written.
56 *
57 * \note Call this function with *dlen = 0 to obtain the
58 * required buffer size in *dlen
59 */
60 int base64_encode( unsigned char *dst, int *dlen,
61 unsigned char *src, int slen );
62
63 /**
64 * \brief Decode a base64-formatted buffer
65 *
66 * \param dst destination buffer
67 * \param dlen size of the buffer
68 * \param src source buffer
69 * \param slen amount of data to be decoded
70 *
71 * \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
72 * POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
73 * correct. *dlen is always updated to reflect the amount
74 * of data that has (or would have) been written.
75 *
76 * \note Call this function with *dlen = 0 to obtain the
77 * required buffer size in *dlen
78 */
79 int base64_decode( unsigned char *dst, int *dlen,
80 unsigned char *src, int slen );
81
82 /**
83 * \brief Checkup routine
84 *
85 * \return 0 if successful, or 1 if the test failed
86 */
87 int base64_self_test( int verbose );
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif /* base64.h */
This page took 0.071201 seconds and 5 git commands to generate.