Xuyi Wang / wolfcrypt

Dependents:   OS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers coding.h Source File

coding.h

00001 /* coding.h
00002  *
00003  * Copyright (C) 2006-2017 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 /*!
00023     \file wolfssl/wolfcrypt/coding.h
00024 */
00025 
00026 #ifndef WOLF_CRYPT_CODING_H
00027 #define WOLF_CRYPT_CODING_H
00028 
00029 #include <wolfcrypt/types.h>
00030 
00031 #ifdef __cplusplus
00032     extern "C" {
00033 #endif
00034 
00035 
00036 WOLFSSL_API int Base64_Decode(const byte* in, word32 inLen, byte* out,
00037                                word32* outLen);
00038 
00039 #if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(WOLFSSL_KEY_GEN) \
00040    || defined(WOLFSSL_CERT_GEN) || defined(HAVE_WEBSERVER) || !defined(NO_DSA)
00041     #ifndef WOLFSSL_BASE64_ENCODE
00042         #define WOLFSSL_BASE64_ENCODE
00043     #endif
00044 #endif
00045 
00046 
00047 #ifdef WOLFSSL_BASE64_ENCODE
00048     enum Escaped {
00049         WC_STD_ENC = 0,       /* normal \n line ending encoding */
00050         WC_ESC_NL_ENC,        /* use escape sequence encoding   */
00051         WC_NO_NL_ENC          /* no encoding at all             */
00052     }; /* Encoding types */
00053 
00054     /* encode isn't */
00055     WOLFSSL_API
00056     int Base64_Encode(const byte* in, word32 inLen, byte* out,
00057                                   word32* outLen);
00058     WOLFSSL_API
00059     int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out,
00060                                   word32* outLen);
00061     WOLFSSL_API
00062     int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out,
00063                                   word32* outLen);
00064 #endif
00065 
00066 #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
00067     defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) || \
00068     defined(HAVE_ECC_CDH) || defined(HAVE_SELFTEST) || \
00069     defined(WOLFSSL_ENCRYPTED_KEYS)
00070     #ifndef WOLFSSL_BASE16
00071         #define WOLFSSL_BASE16
00072     #endif
00073 #endif
00074 
00075 #ifdef WOLFSSL_BASE16
00076     WOLFSSL_API
00077     int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
00078     WOLFSSL_API
00079     int Base16_Encode(const byte* in, word32 inLen, byte* out, word32* outLen);
00080 #endif
00081 
00082 
00083 #ifdef __cplusplus
00084     } /* extern "C" */
00085 #endif
00086 
00087 #endif /* WOLF_CRYPT_CODING_H */
00088 
00089