forked from wolfSSL/wolfssl
microchip pic32 port
This commit is contained in:
@@ -2435,8 +2435,8 @@ int DerToPem(const byte* der, word32 derSz, byte* output, word32 outSz,
|
|||||||
i = headerLen;
|
i = headerLen;
|
||||||
|
|
||||||
/* body */
|
/* body */
|
||||||
outLen = outSz; /* input to Base64Encode */
|
outLen = outSz; /* input to Base64_Encode */
|
||||||
if ( (err = Base64Encode(der, derSz, output + i, (word32*)&outLen)) < 0)
|
if ( (err = Base64_Encode(der, derSz, output + i, (word32*)&outLen)) < 0)
|
||||||
return err;
|
return err;
|
||||||
i += outLen;
|
i += outLen;
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ const byte base64Decode[] = { 62, BAD, BAD, BAD, 63, /* + starts at 0x2B */
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int Base64Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||||
{
|
{
|
||||||
word32 i = 0;
|
word32 i = 0;
|
||||||
word32 j = 0;
|
word32 j = 0;
|
||||||
@@ -131,7 +131,7 @@ const byte base64Encode[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
|||||||
|
|
||||||
|
|
||||||
/* porting assistance from yaSSL by Raphael HUCK */
|
/* porting assistance from yaSSL by Raphael HUCK */
|
||||||
int Base64Encode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
int Base64_Encode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||||
{
|
{
|
||||||
word32 i = 0,
|
word32 i = 0,
|
||||||
j = 0,
|
j = 0,
|
||||||
@@ -197,7 +197,7 @@ const byte hexDecode[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
|||||||
10, 11, 12, 13, 14, 15
|
10, 11, 12, 13, 14, 15
|
||||||
}; /* A starts at 0x41 not 0x3A */
|
}; /* A starts at 0x41 not 0x3A */
|
||||||
|
|
||||||
int Base16Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||||
{
|
{
|
||||||
word32 inIdx = 0;
|
word32 inIdx = 0;
|
||||||
word32 outIdx = 0;
|
word32 outIdx = 0;
|
||||||
|
@@ -31,16 +31,16 @@
|
|||||||
|
|
||||||
|
|
||||||
/* decode needed by CyaSSL */
|
/* decode needed by CyaSSL */
|
||||||
CYASSL_LOCAL int Base64Decode(const byte* in, word32 inLen, byte* out,
|
CYASSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out,
|
||||||
word32* outLen);
|
word32* outLen);
|
||||||
|
|
||||||
#if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN) || defined(HAVE_WEBSERVER)
|
#if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN) || defined(HAVE_WEBSERVER)
|
||||||
/* encode isn't */
|
/* encode isn't */
|
||||||
CYASSL_LOCAL
|
CYASSL_LOCAL
|
||||||
int Base64Encode(const byte* in, word32 inLen, byte* out,
|
int Base64_Encode(const byte* in, word32 inLen, byte* out,
|
||||||
word32* outLen);
|
word32* outLen);
|
||||||
CYASSL_LOCAL
|
CYASSL_LOCAL
|
||||||
int Base16Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -42,6 +42,9 @@
|
|||||||
/* Uncomment next line if using Mbed */
|
/* Uncomment next line if using Mbed */
|
||||||
/* #define MBED */
|
/* #define MBED */
|
||||||
|
|
||||||
|
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||||
|
/* #define MICROCHIP_PIC32 */
|
||||||
|
|
||||||
/* Uncomment next line if using FreeRTOS */
|
/* Uncomment next line if using FreeRTOS */
|
||||||
/* #define FREERTOS */
|
/* #define FREERTOS */
|
||||||
|
|
||||||
@@ -51,8 +54,6 @@
|
|||||||
/* Uncomment next line if building CyaSSL for a game console */
|
/* Uncomment next line if building CyaSSL for a game console */
|
||||||
/* #define CYASSL_GAME_BUILD */
|
/* #define CYASSL_GAME_BUILD */
|
||||||
|
|
||||||
/* Uncomment next line if builing yaSSL with autoconf and want version string */
|
|
||||||
/* #define USE_CYASSL_VERSION */
|
|
||||||
|
|
||||||
#include <cyassl/ctaocrypt/visibility.h>
|
#include <cyassl/ctaocrypt/visibility.h>
|
||||||
|
|
||||||
@@ -64,6 +65,12 @@
|
|||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROCHIP_PIC32
|
||||||
|
/* use MBED plus no filesystem */
|
||||||
|
#define MBED
|
||||||
|
#define NO_FILESYSTEM
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MBED
|
#ifdef MBED
|
||||||
#define SINGLE_THREADED
|
#define SINGLE_THREADED
|
||||||
#define CYASSL_USER_IO
|
#define CYASSL_USER_IO
|
||||||
|
@@ -19,6 +19,9 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CYASSL_SNIFFER
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -36,8 +39,6 @@
|
|||||||
#define SNPRINTF snprintf
|
#define SNPRINTF snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CYASSL_SNIFFER
|
|
||||||
|
|
||||||
#include <cyassl/openssl/ssl.h>
|
#include <cyassl/openssl/ssl.h>
|
||||||
#include <cyassl/internal.h>
|
#include <cyassl/internal.h>
|
||||||
#include <cyassl/error.h>
|
#include <cyassl/error.h>
|
||||||
|
12
src/ssl.c
12
src/ssl.c
@@ -654,8 +654,8 @@ int AddCA(CYASSL_CTX* ctx, buffer der)
|
|||||||
if (!der->buffer) return MEMORY_ERROR;
|
if (!der->buffer) return MEMORY_ERROR;
|
||||||
der->length = neededSz;
|
der->length = neededSz;
|
||||||
|
|
||||||
if (Base64Decode((byte*)headerEnd, neededSz, der->buffer,
|
if (Base64_Decode((byte*)headerEnd, neededSz, der->buffer,
|
||||||
&der->length) < 0)
|
&der->length) < 0)
|
||||||
return SSL_BAD_FILE;
|
return SSL_BAD_FILE;
|
||||||
|
|
||||||
if (pkcs8)
|
if (pkcs8)
|
||||||
@@ -818,7 +818,7 @@ int AddCA(CYASSL_CTX* ctx, buffer der)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* use file's salt for key derivation, hex decode first */
|
/* use file's salt for key derivation, hex decode first */
|
||||||
if (Base16Decode(info.iv, info.ivSz, info.iv, &info.ivSz) != 0) {
|
if (Base16_Decode(info.iv, info.ivSz, info.iv, &info.ivSz) != 0) {
|
||||||
XFREE(der.buffer, ctx->heap, dynamicType);
|
XFREE(der.buffer, ctx->heap, dynamicType);
|
||||||
return ASN_INPUT_E;
|
return ASN_INPUT_E;
|
||||||
}
|
}
|
||||||
@@ -4538,9 +4538,9 @@ int CyaSSL_get_chain_cert_pem(CYASSL_X509_CHAIN* chain, int idx,
|
|||||||
i = headerLen;
|
i = headerLen;
|
||||||
|
|
||||||
/* body */
|
/* body */
|
||||||
*outLen = inLen; /* input to Base64Encode */
|
*outLen = inLen; /* input to Base64_Encode */
|
||||||
if ( (err = Base64Encode(chain->certs[idx].buffer, chain->certs[idx].length,
|
if ( (err = Base64_Encode(chain->certs[idx].buffer,
|
||||||
buf + i, (word32*)outLen)) < 0)
|
chain->certs[idx].length, buf + i, (word32*)outLen)) < 0)
|
||||||
return err;
|
return err;
|
||||||
i += *outLen;
|
i += *outLen;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user