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