[337] | 1 | /* coding.h
|
---|
| 2 | *
|
---|
| 3 | * Copyright (C) 2006-2017 wolfSSL Inc.
|
---|
| 4 | *
|
---|
| 5 | * This file is part of wolfSSL.
|
---|
| 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-1335, USA
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | #ifndef WOLF_CRYPT_CODING_H
|
---|
| 25 | #define WOLF_CRYPT_CODING_H
|
---|
| 26 |
|
---|
| 27 | #include <wolfssl/wolfcrypt/types.h>
|
---|
| 28 |
|
---|
| 29 | #ifdef __cplusplus
|
---|
| 30 | extern "C" {
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | WOLFSSL_API int Base64_Decode(const byte* in, word32 inLen, byte* out,
|
---|
| 35 | word32* outLen);
|
---|
| 36 |
|
---|
| 37 | #if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(WOLFSSL_KEY_GEN) \
|
---|
| 38 | || defined(WOLFSSL_CERT_GEN) || defined(HAVE_WEBSERVER) || !defined(NO_DSA)
|
---|
| 39 | #ifndef WOLFSSL_BASE64_ENCODE
|
---|
| 40 | #define WOLFSSL_BASE64_ENCODE
|
---|
| 41 | #endif
|
---|
| 42 | #endif
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | #ifdef WOLFSSL_BASE64_ENCODE
|
---|
| 46 | enum Escaped {
|
---|
| 47 | WC_STD_ENC = 0, /* normal \n line ending encoding */
|
---|
| 48 | WC_ESC_NL_ENC, /* use escape sequence encoding */
|
---|
| 49 | WC_NO_NL_ENC /* no encoding at all */
|
---|
| 50 | }; /* Encoding types */
|
---|
| 51 |
|
---|
| 52 | /* encode isn't */
|
---|
| 53 | WOLFSSL_API
|
---|
| 54 | int Base64_Encode(const byte* in, word32 inLen, byte* out,
|
---|
| 55 | word32* outLen);
|
---|
| 56 | WOLFSSL_API
|
---|
| 57 | int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out,
|
---|
| 58 | word32* outLen);
|
---|
| 59 | WOLFSSL_API
|
---|
| 60 | int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out,
|
---|
| 61 | word32* outLen);
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) \
|
---|
| 65 | || defined(HAVE_ECC_CDH)
|
---|
| 66 | WOLFSSL_API
|
---|
| 67 | int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
---|
| 68 | WOLFSSL_API
|
---|
| 69 | int Base16_Encode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
---|
| 70 | #endif
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | #ifdef __cplusplus
|
---|
| 74 | } /* extern "C" */
|
---|
| 75 | #endif
|
---|
| 76 |
|
---|
| 77 | #endif /* WOLF_CRYPT_CODING_H */
|
---|
| 78 |
|
---|