Merge pull request #211 from lchristina26/master

GenerateSeed() Function for VxWorks compatibility
This commit is contained in:
toddouska
2015-12-15 15:59:20 -08:00
2 changed files with 29 additions and 2 deletions

View File

@@ -50,11 +50,21 @@ wolfcrypt directories. Uncheck the following:
\#ifdef WOLFSSL\_VXWORKS block, a new GenerateSeed() function will need to be defined \#ifdef WOLFSSL\_VXWORKS block, a new GenerateSeed() function will need to be defined
in wolfcrypt/src/random.c. in wolfcrypt/src/random.c.
8. Include Entropy:
- Create a new project, similar to step 1 but choose VxWorks Source Build Project as the type of project instead of VxWorks Image Project.
- In the project directory, double click "Source Build Configuration" and under os > core > CORE\_KERNEL Menu > VxWorks Kernel Component Configuration find "Inject entropy in interrupts". Double click this.
- Go back to your VIP project. Right click the project and select "Properties".
- In "Properties", select "Project References". Check the box next to the new project you created. Click "Ok".
- Rebuild the project.
####3 Testing wolfSSL with VxWorks: ####3 Testing wolfSSL with VxWorks:
#####3.1 wolfCrypt Test and Benchmark Applications #####3.1 wolfCrypt Test and Benchmark Applications
The wolfCrypt test application will test each of the cryptographic algorithms The wolfCrypt test application will test each of the cryptographic algorithms
and output the status for each as a success or failure. The benchmark application will output the runtime of and output the status for each as a success or failure. The benchmark application will output the runtime of the cryptographic algorithms in milliseconds.
the cryptographic algorithms in milliseconds.
1. Include the following at the top of usrAppInit.c: 1. Include the following at the top of usrAppInit.c:

View File

@@ -1285,6 +1285,23 @@ 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;
/* RANDOM ENTORPY INJECT component must be enabled in VSB project */
status = randBytes (output, sz);
if (status == ERROR) {
WOLFSSL_MSG("Random seed failed! Enable RANDOM ENTROPY INJECT.");
return RNG_FAILURE_E;
}
return 0;
}
#elif defined(CUSTOM_RAND_GENERATE) #elif defined(CUSTOM_RAND_GENERATE)
/* Implement your own random generation function /* Implement your own random generation function