From 38ac17864e7bdd220582b4ca1b20e194c1285152 Mon Sep 17 00:00:00 2001 From: lchristina26 Date: Wed, 9 Dec 2015 13:18:42 -0700 Subject: [PATCH] added entropy, wc_GenerateSeed() for VxWorks --- wolfcrypt/src/random.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 044a77021..a9ce055bd 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -1265,6 +1265,32 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) return 0; } +#elif defined(WOLFSSL_VXWORKS) + + #include + + int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) { + STATUS status; + unsigned char seed[1024]; + int i = 0; + + for (i=0; i < sizeof(seed); i++) { + seed[i]= i*3%256; + } + /* build entropy */ + (void) randAdd(seed, 0, 0); + for (i=4; i<=sizeof(seed); i*=2) { + (void) randAdd (seed, i-1, i); + } + + status = randBytes (output, sz); + if (status == ERROR) { + return status; + } + + return 0; + } + #elif defined(CUSTOM_RAND_GENERATE) /* Implement your own random generation function