1 | /* coding.h
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2015 wolfSSL Inc.
|
---|
4 | *
|
---|
5 | * This file is part of wolfSSL. (formerly known as CyaSSL)
|
---|
6 | *
|
---|
7 | * wolfSSL is free software; you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation; either version 2 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * wolfSSL is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with this program; if not, write to the Free Software
|
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | #ifndef WOLF_CRYPT_CODING_H
|
---|
24 | #define WOLF_CRYPT_CODING_H
|
---|
25 |
|
---|
26 | #include <wolfssl/wolfcrypt/types.h>
|
---|
27 |
|
---|
28 | #ifdef __cplusplus
|
---|
29 | extern "C" {
|
---|
30 | #endif
|
---|
31 |
|
---|
32 |
|
---|
33 | WOLFSSL_API int Base64_Decode(const byte* in, word32 inLen, byte* out,
|
---|
34 | word32* outLen);
|
---|
35 |
|
---|
36 | #if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN) || defined(HAVE_WEBSERVER) || !defined(NO_DSA)
|
---|
37 | #ifndef WOLFSSL_BASE64_ENCODE
|
---|
38 | #define WOLFSSL_BASE64_ENCODE
|
---|
39 | #endif
|
---|
40 | #endif
|
---|
41 |
|
---|
42 |
|
---|
43 | #ifdef WOLFSSL_BASE64_ENCODE
|
---|
44 | enum Escaped {
|
---|
45 | WC_STD_ENC = 0, /* normal \n line ending encoding */
|
---|
46 | WC_ESC_NL_ENC, /* use escape sequence encoding */
|
---|
47 | WC_NO_NL_ENC /* no encoding at all */
|
---|
48 | }; /* Encoding types */
|
---|
49 |
|
---|
50 | /* encode isn't */
|
---|
51 | WOLFSSL_API
|
---|
52 | int Base64_Encode(const byte* in, word32 inLen, byte* out,
|
---|
53 | word32* outLen);
|
---|
54 | WOLFSSL_API
|
---|
55 | int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out,
|
---|
56 | word32* outLen);
|
---|
57 | WOLFSSL_API
|
---|
58 | int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out,
|
---|
59 | word32* outLen);
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS)
|
---|
63 | WOLFSSL_API
|
---|
64 | int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
---|
65 | WOLFSSL_API
|
---|
66 | int Base16_Encode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
---|
67 | #endif
|
---|
68 |
|
---|
69 |
|
---|
70 | #ifdef __cplusplus
|
---|
71 | } /* extern "C" */
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | #endif /* WOLF_CRYPT_CODING_H */
|
---|
75 |
|
---|