mirror of https://github.com/wolfSSL/wolfssl.git
Fixes for Arduino. Don't use C99 for Arduino. Enhanced the script to create as new folder in `IDE/ARDUINO/wolfSSL`. Updated README.md.
parent
b63d3173a1
commit
cf9c352d91
|
@ -237,3 +237,6 @@ IDE/LINUX-SGX/*.a
|
||||||
wolfcrypt/src/port/intel/qat_test
|
wolfcrypt/src/port/intel/qat_test
|
||||||
/mplabx/wolfssl.X/dist/default/
|
/mplabx/wolfssl.X/dist/default/
|
||||||
/mplabx/wolfcrypt_test.X/dist/default/
|
/mplabx/wolfcrypt_test.X/dist/default/
|
||||||
|
|
||||||
|
# Arduino Generated Files
|
||||||
|
/IDE/ARDUINO/wolfSSL
|
||||||
|
|
|
@ -4,22 +4,23 @@
|
||||||
This is a shell script that will re-organize the wolfSSL library to be
|
This is a shell script that will re-organize the wolfSSL library to be
|
||||||
compatible with Arduino projects. The Arduino IDE requires a library's source
|
compatible with Arduino projects. The Arduino IDE requires a library's source
|
||||||
files to be in the library's root directory with a header file in the name of
|
files to be in the library's root directory with a header file in the name of
|
||||||
the library. This script moves all src/ files to the root wolfssl directory and
|
the library. This script moves all src/ files to the `IDE/ARDUINO/wolfSSL`
|
||||||
creates a stub header file called wolfssl.h.
|
directory and creates a stub header file called `wolfssl.h`.
|
||||||
|
|
||||||
Step 1: To configure wolfSSL with Arduino, enter the following from within the
|
Step 1: To configure wolfSSL with Arduino, enter the following from within the
|
||||||
wolfssl/IDE/ARDUINO directory:
|
wolfssl/IDE/ARDUINO directory:
|
||||||
|
|
||||||
./wolfssl-arduino.sh
|
`./wolfssl-arduino.sh`
|
||||||
|
|
||||||
|
|
||||||
Step 2: Edit <wolfssl-root>/wolfssl/wolfcrypt/settings.h uncomment the define for
|
Step 2: Edit `<wolfssl-root>/IDE/ARDUINO/wolfSSL/wolfssl/wolfcrypt/settings.h` uncomment the define for `WOLFSSL_ARDUINO`
|
||||||
WOLFSSL_ARDUINO
|
If building for Intel Galileo platform also uncomment the define for `INTEL_GALILEO`.
|
||||||
|
|
||||||
also uncomment the define for INTEL_GALILEO if building for that platform
|
|
||||||
|
|
||||||
#####Including wolfSSL in Arduino Libraries (for Arduino version 1.6.6)
|
#####Including wolfSSL in Arduino Libraries (for Arduino version 1.6.6)
|
||||||
1. Copy the wolfSSL directory into Arduino/libraries (or wherever Arduino searches for libraries).
|
|
||||||
2. In the Arduino IDE:
|
1. In the Arduino IDE:
|
||||||
- Go to ```Sketch > Include Libraries > Manage Libraries```. This refreshes your changes to the libraries.
|
- In `Sketch -> Include Library -> Add .ZIP Library...` and choose the
|
||||||
- Next go to ```Sketch > Include Libraries > wolfSSL```. This includes wolfSSL in your sketch.
|
`IDE/ARDUNIO/wolfSSL` folder.
|
||||||
|
- In `Sketch -> Include Library` choose wolfSSL.
|
||||||
|
|
||||||
|
An example wolfSSL client INO sketch exists here: `sketches/wolfssl_client/wolfssl_client.ino`
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* wolfssl_client.ino
|
/* wolfssl_client.ino
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
* Copyright (C) 2006-2018 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
* This file is part of wolfSSL.
|
* This file is part of wolfSSL.
|
||||||
*
|
*
|
||||||
|
@ -142,4 +142,3 @@ void loop() {
|
||||||
}
|
}
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,20 +7,29 @@
|
||||||
DIR=${PWD##*/}
|
DIR=${PWD##*/}
|
||||||
|
|
||||||
if [ "$DIR" = "ARDUINO" ]; then
|
if [ "$DIR" = "ARDUINO" ]; then
|
||||||
cp ../../src/*.c ../../
|
rm -rf wolfSSL
|
||||||
cp ../../wolfcrypt/src/*.c ../../
|
mkdir wolfSSL
|
||||||
echo "/* stub header file for Arduino compatibility */" >> ../../wolfssl.h
|
|
||||||
|
cp ../../src/*.c ./wolfSSL
|
||||||
|
cp ../../wolfcrypt/src/*.c ./wolfSSL
|
||||||
|
|
||||||
|
mkdir wolfSSL/wolfssl
|
||||||
|
cp ../../wolfssl/*.h ./wolfSSL/wolfssl
|
||||||
|
mkdir wolfSSL/wolfssl/wolfcrypt
|
||||||
|
cp ../../wolfssl/wolfcrypt/*.h ./wolfSSL/wolfssl/wolfcrypt
|
||||||
|
|
||||||
|
# support misc.c as include in wolfcrypt/src
|
||||||
|
mkdir ./wolfSSL/wolfcrypt
|
||||||
|
mkdir ./wolfSSL/wolfcrypt/src
|
||||||
|
cp ../../wolfcrypt/src/misc.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 "#include <wolfssl/wolfcrypt/settings.h>" >> ./wolfSSL/wolfssl.h
|
||||||
|
echo "#include <wolfssl/ssl.h>" >> ./wolfSSL/wolfssl.h
|
||||||
else
|
else
|
||||||
echo "ERROR: You must be in the IDE/ARDUINO directory to run this script"
|
echo "ERROR: You must be in the IDE/ARDUINO directory to run this script"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#UPDATED: 19 Apr 2017 to remove bio.c and evp.c from the root directory since
|
|
||||||
# they are included inline and should not be compiled directly
|
|
||||||
|
|
||||||
ARDUINO_DIR=${PWD}
|
|
||||||
cd ../../
|
|
||||||
rm bio.c
|
|
||||||
rm evp.c
|
|
||||||
cd $ARDUINO_DIR
|
|
||||||
# end script in the origin directory for any future functionality that may be added.
|
|
||||||
#End UPDATE: 19 Apr 2017
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* detect C99 */
|
/* detect C99 */
|
||||||
#if !defined(WOLF_C99) && defined(__STDC_VERSION__)
|
#if !defined(WOLF_C99) && defined(__STDC_VERSION__) && !defined(WOLFSSL_ARDUINO)
|
||||||
#if __STDC_VERSION__ >= 199901L
|
#if __STDC_VERSION__ >= 199901L
|
||||||
#define WOLF_C99
|
#define WOLF_C99
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue