ctaocrypt/{benchmark,src,test} files fro MDK5

This commit is contained in:
Takashi Kojo
2013-10-24 17:20:12 +09:00
parent e4a3599a6b
commit 3ed2085e77
4 changed files with 41 additions and 27 deletions

View File

@ -51,6 +51,12 @@
#include "cavium_common.h"
#include "cavium_ioctl.h"
#endif
#if defined(CYASSL_MDK_ARM)
extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
#define fopen CyaSSL_fopen
#endif
#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
/* include test cert and key buffers for use with NO_FILESYSTEM */
#if defined(CYASSL_MDK_ARM)
@ -909,7 +915,7 @@ void bench_eccKeyGen(void)
ecc_key genKey;
double start, total, each, milliEach;
int i;
const int genTimes = 100;
const int genTimes = 5;
/* 256 bit */
start = current_time(1);
@ -933,7 +939,7 @@ void bench_eccKeyAgree(void)
ecc_key genKey, genKey2;
double start, total, each, milliEach;
int i, ret;
const int agreeTimes = 100;
const int agreeTimes = 5;
byte shared[1024];
byte sig[1024];
byte digest[32];
@ -1011,13 +1017,13 @@ void bench_eccKeyAgree(void)
double current_time(int reset)
{
(void)reset;
static int init = 0;
static LARGE_INTEGER freq;
LARGE_INTEGER count;
(void)reset;
if (!init) {
QueryPerformanceFrequency(&freq);
init = 1;
@ -1060,10 +1066,9 @@ void bench_eccKeyAgree(void)
double current_time(int reset)
{
struct timeval tv;
(void) reset;
struct timeval tv;
gettimeofday(&tv, 0);
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;

View File

@ -106,7 +106,11 @@
#define XGMTIME(c) gmtime((c))
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
#elif defined(CYASSL_MDK_ARM)
#include <rtl.h>
#if defined(CYASSL_MDK5)
#include "cmsis_os.h"
#else
#include <rtl.h>
#endif
#undef RNG
#include "cyassl_MDK_ARM.h"
#undef RNG

View File

@ -75,7 +75,7 @@ void* CyaSSL_Malloc(size_t size)
#ifdef CYASSL_MALLOC_CHECK
if (res == NULL)
printf("CyaSSL_malloc failed\n");
puts("CyaSSL_malloc failed");
#endif
return res;

View File

@ -74,6 +74,12 @@
#include <cyassl/openssl/des.h>
#endif
#if defined(CYASSL_MDK_ARM)
#include <stdio.h>
#include <stdlib.h>
extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
#define fopen CyaSSL_fopen
#endif
#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
/* include test cert and key buffers for use with NO_FILESYSTEM */
@ -2465,24 +2471,23 @@ byte GetEntropy(ENTROPY_CMD cmd, byte* out)
static const char* caKeyFile = "a:\\certs\\ca-key.der";
static const char* caCertFile = "a:\\certs\\ca-cert.pem";
#endif
#elif defined(CYASSL_MKD_SHELL)
static char* clientKey = "certs/client-key.der";
static char* clientCert = "certs/client-cert.der";
void set_clientKey(char *key) { clientKey = key ; } /* set by shell command */
void set_clientCert(char *cert) { clientCert = cert ; } /* set by shell command */
#ifdef CYASSL_CERT_GEN
static char* caKeyFile = "certs/ca-key.der";
static char* caCertFile = "certs/ca-cert.pem";
void set_caKeyFile (char * key) { caKeyFile = key ; } /* set by shell command */
void set_caCertFile(char * cert) { caCertFile = cert ; } /* set by shell command */
#endif
#else
static const char* clientKey = "./certs/client-key.der";
static const char* clientCert = "./certs/client-cert.der";
#ifdef CYASSL_CERT_GEN
static const char* caKeyFile = "./certs/ca-key.der";
static const char* caCertFile = "./certs/ca-cert.pem";
#endif
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && defined(CYASSL_MKD_SHELL)
static char* clientKey = "certs/client-key.der";
static char* clientCert = "certs/client-cert.der";
void set_clientKey(char *key) { clientKey = key ; } /* set by shell command */
void set_clientCert(char *cert) { clientCert = cert ; } /* set by shell command */
#ifdef CYASSL_CERT_GEN
static char* caKeyFile = "certs/ca-key.der";
static char* caCertFile = "certs/ca-cert.pem";
void set_caKeyFile (char * key) { caKeyFile = key ; } /* set by shell command */
void set_caCertFile(char * cert) { caCertFile = cert ; } /* set by shell command */
#endif
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
static const char* clientKey = "./certs/client-key.der";
static const char* clientCert = "./certs/client-cert.der";
#ifdef CYASSL_CERT_GEN
static const char* caKeyFile = "./certs/ca-key.der";
static const char* caCertFile = "./certs/ca-cert.pem";
#endif
#endif
@ -2723,7 +2728,7 @@ int rsa_test(void)
int pemSz;
size_t bytes3;
word32 idx3 = 0;
FILE* file3 ;
FILE* file3 ;
#ifdef CYASSL_TEST_CERT
DecodedCert decode;
#endif