Merge pull request #1527 from kojo1/RenesasCSPlus

Renesas CS+ projects
This commit is contained in:
Chris Conlon
2018-05-09 10:07:16 -06:00
committed by GitHub
13 changed files with 4124 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
wolfssl_lib:
Build wolfssl_lib.lib
test:
Get missing files
- create DUMMY project
- copy all files under DUMMY project except DUMMY.*
- uncomment "Use SIM I/O" lines in resetprg.c
- set heap size in sbrk.h
- set stack size in stacksct.h
Build test wolfCrypt

View File

@@ -0,0 +1,2 @@
int strncasecmp(const char *s1, const char * s2, unsigned int sz);

View File

@@ -0,0 +1 @@
/* DUMMY Header */

View File

@@ -0,0 +1,46 @@
#define NO_MAIN_DRIVER
#define BENCH_EMBEDDED
#define NO_WRITEV
#define WOLFSSL_USER_IO
#define NO_DEV_RANDOM
#define USE_CERT_BUFFERS_2048
#define WOLFSSL_USER_CURRTIME
#define SIZEOF_LONG_LONG 8
#define NO_WOLFSSL_DIR
#define WOLFSSL_NO_CURRDIR
#define NO_FILESYSTEM
#define WOLFSSL_LOG_PRINTF
/* #define DEBUG_WOLFSSL */
#define OPENSSL_EXTRA
#define WOLFSSL_SMALL_STACK
#define WOLFSSL_DH_CONST
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES
#define USER_TIME
#define XTIME time
#define USE_WOLF_SUSECONDS_T
#define USE_WOLF_TIMEVAL_T
#define WOLFSSL_USER_CURRTIME /* for benchmark */
#define WOLFSSL_GENSEED_FORTEST /* Wardning: define your own seed gen */
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#define WC_RSA_BLINDING
#define SINGLE_THREADED /* or define RTOS option */
/* #define WOLFSSL_CMSIS_RTOS */
/* #define NO_DH */
#define HAVE_AESGCM
#define WOLFSSL_SHA512
#define HAVE_ECC
#define HAVE_CURVE25519
#define CURVE25519_SMALL
#define HAVE_ED25519

View File

@@ -0,0 +1,41 @@
/* wolfssl_dummy.c
*
* Copyright (C) 2006-2017 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
typedef unsigned long time_t;
#define YEAR 2018
#define MON 5
static int tick = 0;
time_t time(time_t *t)
{
return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++;
}
#include <ctype.h>
int strncasecmp(const char *s1, const char * s2, unsigned int sz)
{
for( ; sz>0; sz--)
if(toupper(s1++) != toupper(s2++))
return 1;
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
/***********************************************************************/
/* */
/* FILE :Main.c or Main.cpp */
/* DATE :Tue, Oct 31, 2006 */
/* DESCRIPTION :Main Program */
/* CPU TYPE : */
/* */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/* */
/***********************************************************************/
#include "typedefine.h"
#ifdef __cplusplus
#include <ios> // Remove the comment when you use ios
_SINT ios_base::Init::init_cnt; // Remove the comment when you use ios
#endif
#include "stdio.h"
void main(void);
#ifdef __cplusplus
extern "C" {
void abort(void);
}
#endif
typedef struct func_args {
int argc;
char** argv;
int return_code;
} func_args;
void wolfcrypt_test(func_args args);
void main(void)
{
func_args args = { 1 };
printf("Start wolfCrypt Test\n");
wolfcrypt_test(args);
printf("End wolfCrypt Test\n");
}
#ifdef __cplusplus
void abort(void)
{
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -5978,14 +5978,14 @@ ProtocolVersion MakeDTLSv1_2(void)
#else #else
/* Posix style time */ /* Posix style time */
#ifndef USER_TIME
#include <time.h> #include <time.h>
#endif
word32 LowResTimer(void) word32 LowResTimer(void)
{ {
return (word32)time(0); return (word32)XTIME(0);
} }
#endif #endif

View File

@@ -8590,6 +8590,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int with_header)
byte curve[MAX_ALGO_SZ]; byte curve[MAX_ALGO_SZ];
byte pub[ECC_BUFSIZE]; byte pub[ECC_BUFSIZE];
#endif #endif
int ret;
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
pub = (byte*)XMALLOC(ECC_BUFSIZE, key->heap, DYNAMIC_TYPE_TMP_BUFFER); pub = (byte*)XMALLOC(ECC_BUFSIZE, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
@@ -8597,7 +8598,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int with_header)
return MEMORY_E; return MEMORY_E;
#endif #endif
int ret = wc_ecc_export_x963(key, pub, &pubSz); ret = wc_ecc_export_x963(key, pub, &pubSz);
if (ret != 0) { if (ret != 0) {
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER); XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);

View File

@@ -55,7 +55,11 @@ void lm_copy(byte* x, const byte* a)
x[i] = a[i]; x[i] = a[i];
} }
#ifndef FREESCALE_LTC_ECC #if ((defined(HAVE_CURVE25519) && !defined(CURVE25519_SMALL)) || \
(defined(HAVE_ED25519) && !defined(ED25519_SMALL))) && \
!defined(FREESCALE_LTC_ECC)
/* to be Complementary to fe_operations.c */
#else
void fe_init() void fe_init()
{ {
} }

View File

@@ -119,6 +119,7 @@ void fe_0(fe h)
#if ((defined(HAVE_CURVE25519) && !defined(CURVE25519_SMALL)) || \ #if ((defined(HAVE_CURVE25519) && !defined(CURVE25519_SMALL)) || \
(defined(HAVE_ED25519) && !defined(ED25519_SMALL))) && \ (defined(HAVE_ED25519) && !defined(ED25519_SMALL))) && \
!defined(FREESCALE_LTC_ECC) !defined(FREESCALE_LTC_ECC)
/* to be Complementary to fe_low_mem.c */
void fe_init() void fe_init()
{ {
} }

View File

@@ -460,8 +460,18 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#if defined(USE_WOLF_TIME_T) #if defined(USE_WOLF_TIME_T)
typedef long time_t; typedef long time_t;
#endif #endif
#if defined(USE_WOLF_SUSECONDS_T)
typedef long suseconds_t;
#endif
#if defined(USE_WOLF_TIMEVAL_T)
struct timeval
{
time_t tv_sec;
suseconds_t tv_usec;
};
#endif
/* forward declarations */ /* forward declarations */
#if defined(USER_TIME) #if defined(USER_TIME)
struct tm* gmtime(const time_t* timer); struct tm* gmtime(const time_t* timer);
extern time_t XTIME(time_t * timer); extern time_t XTIME(time_t * timer);