user settings, custom rand gen, by tyto diff

This commit is contained in:
toddouska
2014-04-04 15:10:08 -07:00
parent c4f483aaa2
commit 562b017776
6 changed files with 412 additions and 436 deletions

View File

@@ -674,17 +674,21 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return 0;
}
#elif defined(CYASSL_TYTO)
#elif defined(CUSTOM_RAND_GENERATE)
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
/* Implement your own random generation function
* word32 rand_gen(void);
* #define CUSTOM_RAND_GENERATE rand_gen */
for (i = 0; i < sz; i++ )
output[i] = rand_gen();
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
return 0;
}
for (i = 0; i < sz; i++ )
output[i] = CUSTOM_RAND_GENERATE();
return 0;
}
#elif defined(NO_DEV_RANDOM)

View File

@@ -125,9 +125,7 @@
#define printf dc_log_printf
#endif
#ifndef CYASSL_TYTO
#include "ctaocrypt/test/test.h"
#endif
#include "ctaocrypt/test/test.h"
typedef struct testVector {

View File

@@ -58,7 +58,7 @@ CYASSL_API int CyaSSL_SetLoggingCb(CyaSSL_Logging_cb log_function);
#define CYASSL_ENTER(m)
#define CYASSL_LEAVE(m, r)
#define CYASSL_ERROR(e)
#define CYASSL_ERROR(e) printf("Cyassl Error 0x%x\n", e);
#define CYASSL_MSG(m)
#endif /* DEBUG_CYASSL */

View File

@@ -97,6 +97,11 @@
#endif
#ifdef CYASSL_USER_SETTINGS
#include <user_settings.h>
#endif
#ifdef COMVERGE
#define THREADX
#define HAVE_NETX
@@ -185,41 +190,6 @@
#define CYASSL_CMSIS_RTOS
#endif
#ifdef CYASSL_TYTO
#include "rand.h"
#define FREERTOS
#define NO_FILESYSTEM
#define NO_MAIN_DRIVER
#define CYASSL_USER_IO
#define NO_DEV_RANDOM
#define HAVE_ECC
#define HAVE_ECC_ENCRYPT
#define ECC_SHAMIR
#define HAVE_HKDF
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#define FP_MAX_BITS 512
#define NO_OLD_TLS
#define NO_MD4
#define NO_RABBIT
#define NO_HC128
#define NO_RSA
#define NO_DSA
#define NO_PWDBASED
#define NO_PSK
#define FP_LUT 4
#define FP_MAX_BITS 512
/* remove features */
#define NO_OLD_TLS
#define NO_MD4
#define NO_RABBIT
#define NO_HC128
#define NO_RSA
#define NO_DSA
#define NO_PWDBASED
#define NO_PSK
#endif
#ifdef CYASSL_EROAD
#define FREESCALE_MQX

View File

@@ -211,9 +211,7 @@ enum {
#endif
#ifndef CTYPE_USER
#ifndef CYASSL_TYTO
#include <ctype.h>
#endif
#include <ctype.h>
#if defined(HAVE_ECC) || defined(HAVE_OCSP)
#define XTOUPPER(c) toupper((c))
#define XISALPHA(c) isalpha((c))

View File

@@ -124,6 +124,9 @@ static volatile int initRefCount = 0;
static CyaSSL_Mutex count_mutex; /* init ref count mutex */
#undef CYASSL_MSG
#define CYASSL_MSG(m) printf("%s\n", m);
CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD* method)
{
@@ -10745,18 +10748,21 @@ static int initGlobalRNG = 0;
}
err = mp_sub_d((mp_int*)rsa->p->internal, 1, &tmp);
if (err != MP_OKAY)
if (err != MP_OKAY) {
CYASSL_MSG("mp_sub_d error");
}
else
err = mp_mod((mp_int*)rsa->d->internal, &tmp,
(mp_int*)rsa->dmp1->internal);
if (err != MP_OKAY)
if (err != MP_OKAY) {
CYASSL_MSG("mp_mod error");
}
else
err = mp_sub_d((mp_int*)rsa->q->internal, 1, &tmp);
if (err != MP_OKAY)
if (err != MP_OKAY) {
CYASSL_MSG("mp_sub_d error");
}
else
err = mp_mod((mp_int*)rsa->d->internal, &tmp,
(mp_int*)rsa->dmq1->internal);