diff --git a/IDE/ARDUINO/README.md b/IDE/ARDUINO/README.md index 818d3b55f..a8135d750 100644 --- a/IDE/ARDUINO/README.md +++ b/IDE/ARDUINO/README.md @@ -12,9 +12,18 @@ wolfssl/IDE/ARDUINO directory: `./wolfssl-arduino.sh` +Step 2: Copy the directory wolfSSL that was just created to: +`~/Documents/Arduino/libraries/` directory so the Arduino IDE can find it. -Step 2: Edit `/IDE/ARDUINO/wolfSSL/wolfssl/wolfcrypt/settings.h` uncomment the define for `WOLFSSL_ARDUINO` -If building for Intel Galileo platform also uncomment the define for `INTEL_GALILEO`. +Step 3: Edit `/wolfSSL/user_settings.h` +If building for Intel Galileo platform add: `#define INTEL_GALILEO`. +Add any other custom settings, for a good start see the below in wolfssl root. +(See wolfssl/IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h) + +Step 4: If you experience any issues with custom user_settings.h see the wolfssl +porting guide here for more assistance: https://www.wolfssl.com/docs/porting-guide/ + +Step 5: If you still have any issues contact support@wolfssl.com for more help. ##### Including wolfSSL in Arduino Libraries (for Arduino version 1.6.6) diff --git a/IDE/ARDUINO/wolfssl-arduino.sh b/IDE/ARDUINO/wolfssl-arduino.sh index 2d84f26c0..1ba219683 100755 --- a/IDE/ARDUINO/wolfssl-arduino.sh +++ b/IDE/ARDUINO/wolfssl-arduino.sh @@ -6,6 +6,10 @@ DIR=${PWD##*/} +space(){ + echo "" >> "$1" +} + if [ "$DIR" = "ARDUINO" ]; then rm -rf wolfSSL mkdir wolfSSL @@ -22,14 +26,42 @@ if [ "$DIR" = "ARDUINO" ]; then mkdir ./wolfSSL/wolfcrypt mkdir ./wolfSSL/wolfcrypt/src cp ../../wolfcrypt/src/misc.c ./wolfSSL/wolfcrypt/src + cp ../../wolfcrypt/src/asm.c ./wolfSSL/wolfcrypt/src # put bio and evp as includes mv ./wolfSSL/bio.c ./wolfSSL/wolfssl mv ./wolfSSL/evp.c ./wolfSSL/wolfssl - echo "/* Generated wolfSSL header file for Arduino */" >> ./wolfSSL/wolfssl.h + echo "/* Generated wolfSSL header file for Arduino */" > ./wolfSSL/wolfssl.h echo "#include " >> ./wolfSSL/wolfssl.h echo "#include " >> ./wolfSSL/wolfssl.h + + echo "/* Generated wolfSSL user_settings.h file for Arduino */" > ./wolfSSL/user_settings.h + echo "#ifndef ARDUINO_USER_SETTINGS_H" >> ./wolfSSL/user_settings.h + echo "#define ARDUINO_USER_SETTINGS_H" >> ./wolfSSL/user_settings.h + space wolfSSL/user_settings.h + echo "/* Platform */" >> ./wolfSSL/user_settings.h + echo "#define WOLFSSL_ARDUINO" >> ./wolfSSL/user_settings.h + space wolfSSL/user_settings.h + echo "/* Math library (remove this to use normal math)*/" >> ./wolfSSL/user_settings.h + echo "#define USE_FAST_MATH" >> ./wolfSSL/user_settings.h + echo "#define TFM_NO_ASM" >> ./wolfSSL/user_settings.h + space wolfSSL/user_settings.h + echo "/* RNG DEFAULT !!FOR TESTING ONLY!! */" >> ./wolfSSL/user_settings.h + echo "/* comment out the error below to get started w/ bad entropy source" >> ./wolfSSL/user_settings.h + echo " * This will need fixed before distribution but is OK to test with */" >> ./wolfSSL/user_settings.h + echo "#error \"needs solved, see: https://www.wolfssl.com/docs/porting-guide/\"" >> ./wolfSSL/user_settings.h + echo "#define WOLFSSL_GENSEED_FORTEST" >> ./wolfSSL/user_settings.h + space wolfSSL/user_settings.h + echo "#endif /* ARDUINO_USER_SETTINGS_H */" >> ./wolfSSL/user_settings.h + + cp wolfSSL/wolfssl/wolfcrypt/settings.h wolfSSL/wolfssl/wolfcrypt/settings.h.bak + echo " /* wolfSSL Generated ARDUINO settings */" > ./wolfSSL/wolfssl/wolfcrypt/settings.h + echo "#define WOLFSSL_ARDUINO" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h + echo "#define WOLFSSL_USER_SETTINGS" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h + echo " /* wolfSSL Generated ARDUINO settings: END */" >> ./wolfSSL/wolfssl/wolfcrypt/settings.h + cat ./wolfSSL/wolfssl/wolfcrypt/settings.h.bak >> ./wolfSSL/wolfssl/wolfcrypt/settings.h + else echo "ERROR: You must be in the IDE/ARDUINO directory to run this script" fi diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 08a9af1e5..49c339b0a 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -437,7 +437,15 @@ #define SINGLE_THREADED #define NO_DEV_RANDOM #ifndef INTEL_GALILEO /* Galileo has time.h compatibility */ - #define TIME_OVERRIDES /* must define XTIME and XGMTIME externally */ + #define TIME_OVERRIDES + #ifndef XTIME + #error "Must define XTIME externally see porting guide" + #error "https://www.wolfssl.com/docs/porting-guide/" + #endif + #ifndef XGMTIME + #error "Must define XGMTIME externally see porting guide" + #error "https://www.wolfssl.com/docs/porting-guide/" + #endif #endif #define WOLFSSL_USER_IO #define HAVE_ECC