mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-05 13:44:41 +02:00
added entropy, wc_GenerateSeed() for VxWorks
This commit is contained in:
@@ -1265,6 +1265,32 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(WOLFSSL_VXWORKS)
|
||||||
|
|
||||||
|
#include <randomNumGen.h>
|
||||||
|
|
||||||
|
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)
|
#elif defined(CUSTOM_RAND_GENERATE)
|
||||||
|
|
||||||
/* Implement your own random generation function
|
/* Implement your own random generation function
|
||||||
|
Reference in New Issue
Block a user