From 684f9bad228ec0a6a798aa9d02cac29a265ec88f Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 2 Dec 2016 13:53:05 -0700 Subject: [PATCH 01/11] RIOT OS build and test scripts, build instructions --- .gitignore | 6 +- RIOT_Make/test-all.sh | 27 ++++++++ RIOT_Make/testsuite/README | 53 ++++++++++++++++ .../testsuite/wolf-build-and-run-test.sh | 61 +++++++++++++++++++ RIOT_Make/wolfcrypt-test/README | 49 +++++++++++++++ .../wolfcrypt-test/wolf-build-and-run-test.sh | 58 ++++++++++++++++++ testsuite/testsuite.c | 8 +++ wolfcrypt/test/test.c | 4 ++ wolfssl/ssl.h | 2 + wolfssl/wolfcrypt/settings.h | 9 +++ 10 files changed, 276 insertions(+), 1 deletion(-) create mode 100755 RIOT_Make/test-all.sh create mode 100644 RIOT_Make/testsuite/README create mode 100755 RIOT_Make/testsuite/wolf-build-and-run-test.sh create mode 100644 RIOT_Make/wolfcrypt-test/README create mode 100755 RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh diff --git a/.gitignore b/.gitignore index b22328702..a421b91ec 100644 --- a/.gitignore +++ b/.gitignore @@ -188,4 +188,8 @@ wolfcrypt/user-crypto/lib/libusercrypto.* wrapper/CSharp/x64/ # Visual Studio Code Workspace Files -*.vscode \ No newline at end of file +*.vscode + +# RIOT_OS workspace directories: +RIOT_Make/*/bin/* +RIOT_Make/*/*.c diff --git a/RIOT_Make/test-all.sh b/RIOT_Make/test-all.sh new file mode 100755 index 000000000..c8a0edae1 --- /dev/null +++ b/RIOT_Make/test-all.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +echo "Running wolfssl testsuite with RIOT" +cd testsuite/ +./wolf-build-and-run-test.sh +RESULT=$? +if [ $RESULT != 0 ] +then + echo "testsuite failed" + echo "" +fi + +cd .. + +echo "Running wolfcrypt tests with RIOT" +cd wolfcrypt-test +./wolf-build-and-run-test.sh +RESULT=$? +if [ $RESULT != 0 ] +then + echo "wolfcrypt test failed" + echo "" +fi + +cd .. + +exit 0 diff --git a/RIOT_Make/testsuite/README b/RIOT_Make/testsuite/README new file mode 100644 index 000000000..08db1ac67 --- /dev/null +++ b/RIOT_Make/testsuite/README @@ -0,0 +1,53 @@ +These are the steps to properly setup a test of wolfssl in RIOT OS: + +To test wolfSSL in RIOT build system get the RIOT source code from here: +git clone https://github.com/RIOT-OS/RIOT + +Then cd RIOT/examples + +clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl + +git clone https://github.com/wolfssl/wolfssl + +cd /RIOT/examples/wolfssl/RIOT_Make/testsuite + +run the script ./wolf-build-and-run-test.sh + +That script will perform the following steps: +1. copy the source files from: + /src + /wolfcrypt/src + /wolfcrypt/test + /testsuite + /examples/[ echoserver/echoclient/client/server ] + +2. Use the provided Makefile to build the example application: + "testwolfcrypt.elf" + This application will be located here: + /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testwolfcrypt.elf + +3. Execute that application. You should see a pass or fail. + +4. Lastly that script will cleanup the source files it copied in for building. + NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary + files. All development changes should be made to the actual source + files located in their respective directories: + /src + /wolfcrypt/src + /wolfcrypt/test + /testsuite + /examples/[ echoserver/echoclient/client/server ] + Then the script "wolf-build-and-run-test.sh" should be run again to + test those changes + If you do make changes to the temporary files those changes will be + ignored by /.gitignore + + +NOTE: This test is only for the "native" test. To build for a specific platform + cd to RIOT directory and run "make doc" to generate doxygen docs. + (You will need to install doxygen if you don't have it already) + Then open the file: RIOT/doc/doxygen/html/index.html + + This will provide you with the necessary help to setup and build for a + specific platform + diff --git a/RIOT_Make/testsuite/wolf-build-and-run-test.sh b/RIOT_Make/testsuite/wolf-build-and-run-test.sh new file mode 100755 index 000000000..2434f4c69 --- /dev/null +++ b/RIOT_Make/testsuite/wolf-build-and-run-test.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +wolf_riot_setup () { +#copy the test sources here +cp ../../wolfcrypt/test/test.c ./ +cp ../../examples/server/server.c ./ +cp ../../examples/client/client.c ./ +cp ../../examples/echoserver/echoserver.c ./ +cp ../../examples/echoclient/echoclient.c ./ + +cp ../../testsuite/testsuite.c ./ + +cp ../../wolfcrypt/src/*.c ./ + +cp ../../src/*.c ./ + +} + +wolf_riot_cleanup () { + rm ./*.c + #leave this line in for testing. Comment it out when you want to build + # a .elf for flashing to a device + make clean &> /dev/null +} +trap wolf_riot_cleanup INT TERM + +BACKUPCFLAGS=${CFLAGS} +export CFLAGS="${CFLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_RIOT_OS" + +# copy the necessary files to this directory +wolf_riot_setup + +# build the test +make &> /dev/null +RESULT=$? + [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && + make +if [ $RESULT != 0 ]; +then + wolf_riot_cleanup && echo "cleanup done" && exit 2 +fi + +# run the test +./bin/native/wolftestsuite.elf + +# confirm success or failure +export CFLAGS="${BACKUPCFLAGS}" +RESULT=$? + [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && + echo "cleanup done" && exit 2 + +echo "TEST PASSED!" + +# cleanup. All changes made should be to the files in: +# /src +# /wolfcrypt/src +# or other. Never make changes to the files copied here as they are only +# temporary. Once changes are made, to test them just run this script again. +wolf_riot_cleanup 0 + + diff --git a/RIOT_Make/wolfcrypt-test/README b/RIOT_Make/wolfcrypt-test/README new file mode 100644 index 000000000..2c4dcd31a --- /dev/null +++ b/RIOT_Make/wolfcrypt-test/README @@ -0,0 +1,49 @@ +These are the steps to properly setup a test of wolfssl in RIOT OS: + +To test wolfSSL in RIOT build system get the RIOT source code from here: +git clone https://github.com/RIOT-OS/RIOT + +Then cd RIOT/examples + +clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl + +git clone https://github.com/wolfssl/wolfssl + +cd /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test + +run the script ./wolf-build-and-run-test.sh + +That script will perform the following steps: +1. copy the source files from: + /src + /wolfcrypt/src + /wolfcrypt/test + +2. Use the provided Makefile to build the example application: + "testwolfcrypt.elf" + This application will be located here: + /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testwolfcrypt.elf + +3. Execute that application. You should see a pass or fail. + +4. Lastly that script will cleanup the source files it copied in for building. + NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary + files. All development changes should be made to the actual source + files located in their respective directories: + /src + /wolfcrypt/src + /wolfcrypt/test + Then the script "build-and-run-test.sh" should be run again to test + those changes + If you do make changes to the temporary files those changes will be + ignored by /.gitignore + +. +NOTE: This test is only for the "native" test. To build for a specific platform + cd to RIOT directory and run "make doc" to generate doxygen docs. + (You will need to install doxygen if you don't have it already) + Then open the file: RIOT/doc/doxygen/html/index.html + + This will provide you with the necessary help to setup and build for a + specific platform + diff --git a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh new file mode 100755 index 000000000..eaa5a115c --- /dev/null +++ b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +wolf_riot_setup () { + #copy the test sources here + cp ../../wolfcrypt/test/*.c ./ + + cp ../../wolfcrypt/src/*.c ./ + + cp ../../src/*.c ./ +} + +wolf_riot_cleanup () { + rm ./*.c + #leave this line in for testing. Comment it out when you want to build + # a .elf for flashing to a device + make clean &> /dev/null +} + +BACKUPCFLAGS=${CFLAGS} +export CFLAGS="${CFLAGS} -DWOLFSSL_RIOT_OS" + + +# copy the necessary files to this directory +wolf_riot_setup + +# build the test +# change next line to just "make" to see verbose output +# NOTE: will throw a warning on every file that is empty if that feature +# is not enabled in wolfssl. +make &> /dev/null +RESULT=$? + [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && + make + +if [ $RESULT != 0 ]; +then + wolf_riot_cleanup && echo "cleanup done" && exit 2 +fi + +# run the test +./bin/native/testwolfcrypt.elf + +# confirm success or failure +RESULT=$? + [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && exit 5 + +echo "ALL TEST PASSED!" + +# cleanup. All changes made should be to the files in: +# /src +# /wolfcrypt/src +# or other. Never make changes to the files copied here as they are only +# temporary. Once changes are made, to test them just run this script again. +wolf_riot_cleanup + +exit 0 + + diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 0fdc951c8..220ada67e 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -210,7 +210,11 @@ int testsuite_test(int argc, char** argv) #endif /* HAVE_WNR */ printf("\nAll tests passed!\n"); +#ifdef WOLFSSL_RIOT_OS + exit(0); +#else return EXIT_SUCCESS; +#endif } void simple_test(func_args* args) @@ -411,7 +415,11 @@ int main(int argc, char** argv) if (server_args.return_code != 0) return server_args.return_code; printf("\nAll tests passed!\n"); +#ifdef WOLFSSL_RIOT_OS + exit(0); +#else return EXIT_SUCCESS; +#endif } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 9a00a8539..bfd9c84ae 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -729,7 +729,11 @@ int wolfcrypt_test(void* args) err_sys("Failed to free netRandom context", -1238); #endif /* HAVE_WNR */ +#ifdef WOLFSSL_RIOT_OS + exit(0); +#else return args.return_code; +#endif } #endif /* NO_MAIN_DRIVER */ diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 839200393..dcd747929 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -1065,6 +1065,8 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL*, void* key, unsigned int len, #ifdef __PPU #include #include + #elif defined(WOLFSSL_RIOT_OS) + #include #elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \ !defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) && \ !defined(WOLFSSL_EMBOS) && !defined(WOLFSSL_FROSTED) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index cc5283fac..6550ca80d 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -147,6 +147,9 @@ /* Uncomment next line if building for embOS */ /* #define WOLFSSL_EMBOS */ +/* Uncomment next line if building for RIOT-OS */ +/* #define WOLFSSL_RIOT_OS */ + #include #ifdef WOLFSSL_USER_SETTINGS @@ -404,6 +407,12 @@ #define SINGLE_THREADED /* Not ported at this time */ #endif +#ifdef WOLFSSL_RIOT_OS + #define USE_CERT_BUFFERS_2048 + #define HAVE_ECC + #define NO_INLINE +#endif + #ifdef WOLFSSL_NRF5x #define SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 From 162294e3e5cf46e0262875767117ed295cb80199 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 2 Dec 2016 14:39:37 -0700 Subject: [PATCH 02/11] added benchmark app for RIOT and updated test error handling --- RIOT_Make/README | 12 ++++ RIOT_Make/benchmark/README | 49 +++++++++++++++++ .../benchmark/wolf-build-and-run-test.sh | 55 +++++++++++++++++++ RIOT_Make/test-all.sh | 29 ++++++---- RIOT_Make/testsuite/README | 2 +- .../testsuite/wolf-build-and-run-test.sh | 15 +++-- .../wolfcrypt-test/wolf-build-and-run-test.sh | 14 ++++- wolfcrypt/benchmark/benchmark.c | 4 ++ wolfcrypt/test/test.c | 4 ++ 9 files changed, 164 insertions(+), 20 deletions(-) create mode 100644 RIOT_Make/README create mode 100644 RIOT_Make/benchmark/README create mode 100755 RIOT_Make/benchmark/wolf-build-and-run-test.sh diff --git a/RIOT_Make/README b/RIOT_Make/README new file mode 100644 index 000000000..e177b2ba0 --- /dev/null +++ b/RIOT_Make/README @@ -0,0 +1,12 @@ +To test all three applications: + +wolfbenchmark +testsuite +wolfcrypt-test + +run the script in this directory: ./test-all.sh + +See the README in each respecive directory for more information on wolfSSL and +RIOT_OS! + + diff --git a/RIOT_Make/benchmark/README b/RIOT_Make/benchmark/README new file mode 100644 index 000000000..1aa54afa0 --- /dev/null +++ b/RIOT_Make/benchmark/README @@ -0,0 +1,49 @@ +These are the steps to properly setup a test of wolfssl in RIOT OS: + +To test wolfSSL in RIOT build system get the RIOT source code from here: +git clone https://github.com/RIOT-OS/RIOT + +Then cd RIOT/examples + +clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl + +git clone https://github.com/wolfssl/wolfssl + +cd /RIOT/examples/wolfssl/RIOT_Make/benchmark + +run the script ./wolf-build-and-run-test.sh + +That script will perform the following steps: +1. copy the source files from: + /src + /wolfcrypt/src + /wolfcrypt/benchmark + +2. Use the provided Makefile to build the example application: + "wolfbenchmark.elf" + This application will be located here: + /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/wolfbenchmark.elf + +3. Execute that application. You should see a pass or fail. + +4. Lastly that script will cleanup the source files it copied in for building. + NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary + files. All development changes should be made to the actual source + files located in their respective directories: + /src + /wolfcrypt/src + /wolfcrypt/benchmark + Then the script "wolf-build-and-run-test.sh" should be run again to + test those changes + If you do make changes to the temporary files those changes will be + ignored by /.gitignore + + +NOTE: This test is only for the "native" test. To build for a specific platform + cd to RIOT directory and run "make doc" to generate doxygen docs. + (You will need to install doxygen if you don't have it already) + Then open the file: RIOT/doc/doxygen/html/index.html + + This will provide you with the necessary help to setup and build for a + specific platform + diff --git a/RIOT_Make/benchmark/wolf-build-and-run-test.sh b/RIOT_Make/benchmark/wolf-build-and-run-test.sh new file mode 100755 index 000000000..ffc316d0a --- /dev/null +++ b/RIOT_Make/benchmark/wolf-build-and-run-test.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +wolf_riot_setup () { +#copy the test sources here +cp ../../wolfcrypt/benchmark/benchmark.c ./ + +cp ../../wolfcrypt/src/*.c ./ + +cp ../../src/*.c ./ + +} + +wolf_riot_cleanup () { + rm ./*.c + #leave this line in for testing. Comment it out when you want to build + # a .elf for flashing to a device + make clean &> /dev/null +} +trap wolf_riot_cleanup INT TERM + +BACKUPCFLAGS=${CFLAGS} +export CFLAGS="${CFLAGS} -DWOLFSSL_RIOT_OS" + +# copy the necessary files to this directory +wolf_riot_setup + +# build the test +make &> /dev/null +RESULT=$? + [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && + make +if [ $RESULT != 0 ]; +then + wolf_riot_cleanup && echo "cleanup done" && exit 2 +fi + +# run the test +./bin/native/wolfbenchmark.elf + +# confirm success or failure +export CFLAGS="${BACKUPCFLAGS}" +RESULT=$? + [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && + echo "cleanup done" && exit 2 + +echo "TEST PASSED!" + +# cleanup. All changes made should be to the files in: +# /src +# /wolfcrypt/src +# or other. Never make changes to the files copied here as they are only +# temporary. Once changes are made, to test them just run this script again. +wolf_riot_cleanup 0 + + diff --git a/RIOT_Make/test-all.sh b/RIOT_Make/test-all.sh index c8a0edae1..20d908386 100755 --- a/RIOT_Make/test-all.sh +++ b/RIOT_Make/test-all.sh @@ -1,27 +1,34 @@ #!/bin/sh +check_status () { +if [ $1 != 0 ] +then + echo "$2 failed" + echo "" +fi +} + echo "Running wolfssl testsuite with RIOT" cd testsuite/ ./wolf-build-and-run-test.sh RESULT=$? -if [ $RESULT != 0 ] -then - echo "testsuite failed" - echo "" -fi - +check_status $RESULT "testsuite" cd .. +echo "" echo "Running wolfcrypt tests with RIOT" cd wolfcrypt-test ./wolf-build-and-run-test.sh RESULT=$? -if [ $RESULT != 0 ] -then - echo "wolfcrypt test failed" - echo "" -fi +check_status $RESULT "wolfcrypt test" +cd .. +echo "" +echo "Running wolfcrypt benchmark with RIOT" +cd benchmark +./wolf-build-and-run-test.sh +RESULT=$? +check_status $RESULT "wolfcrypt benchmark" cd .. exit 0 diff --git a/RIOT_Make/testsuite/README b/RIOT_Make/testsuite/README index 08db1ac67..d5e486733 100644 --- a/RIOT_Make/testsuite/README +++ b/RIOT_Make/testsuite/README @@ -24,7 +24,7 @@ That script will perform the following steps: 2. Use the provided Makefile to build the example application: "testwolfcrypt.elf" This application will be located here: - /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testwolfcrypt.elf + /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testsuite.elf 3. Execute that application. You should see a pass or fail. diff --git a/RIOT_Make/testsuite/wolf-build-and-run-test.sh b/RIOT_Make/testsuite/wolf-build-and-run-test.sh index 2434f4c69..f64d3953e 100755 --- a/RIOT_Make/testsuite/wolf-build-and-run-test.sh +++ b/RIOT_Make/testsuite/wolf-build-and-run-test.sh @@ -41,13 +41,18 @@ then fi # run the test -./bin/native/wolftestsuite.elf - +RESULT=`./bin/native/wolftestsuite.elf` # confirm success or failure export CFLAGS="${BACKUPCFLAGS}" -RESULT=$? - [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && - echo "cleanup done" && exit 2 +errstring="error" +if test "${RESULT#*$errstring}" != "$RESULT" + then + echo "$RESULT" + echo "TEST FAILED" && wolf_riot_cleanup && echo "cleanup done" && + exit 2 + else + echo "$RESULT" + fi echo "TEST PASSED!" diff --git a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh index eaa5a115c..1f8100635 100755 --- a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh +++ b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh @@ -38,11 +38,19 @@ then fi # run the test -./bin/native/testwolfcrypt.elf +RESULT=`./bin/native/testwolfcrypt.elf` # confirm success or failure -RESULT=$? - [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && exit 5 +export CFLAGS="${BACKUPCFLAGS}" +errstring="error" +if test "${RESULT#*$errstring}" != "$RESULT" + then + echo "$RESULT" + echo "TEST FAILED" && wolf_riot_cleanup && echo "cleanup done" && + exit 2 + else + echo "$RESULT" + fi echo "ALL TEST PASSED!" diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 87f92c720..89e861e44 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -483,7 +483,11 @@ int benchmark_test(void *args) ShowMemoryTracker(); #endif +#ifdef WOLFSSL_RIOT_OS + exit (0); +#else return 0; +#endif } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index bfd9c84ae..5ae622d02 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -262,7 +262,11 @@ static int err_sys(const char* msg, int es) { printf("%s error = %d\n", msg, es); +#ifdef WOLFSSL_RIOT_OS + exit(-1); +#else return -1; /* error state */ +#endif } /* func_args from test.h, so don't have to pull in other junk */ From 43525343fc67bc16682fb5870b40235b598eea6e Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 2 Dec 2016 17:30:57 -0700 Subject: [PATCH 03/11] add RIOT tests to dist and make sure Makefiles are not excluded by .gitignore --- .gitignore | 2 +- Makefile.am | 1 + RIOT_Make/benchmark/Makefile.benchmark | 29 +++++++++++++++++++ RIOT_Make/benchmark/include.am | 7 +++++ .../benchmark/wolf-build-and-run-test.sh | 2 ++ RIOT_Make/include.am | 10 +++++++ RIOT_Make/testsuite/Makefile.testsuite | 29 +++++++++++++++++++ RIOT_Make/testsuite/include.am | 7 +++++ .../testsuite/wolf-build-and-run-test.sh | 2 ++ .../wolfcrypt-test/Makefile.wolfcrypttest | 29 +++++++++++++++++++ RIOT_Make/wolfcrypt-test/include.am | 7 +++++ .../wolfcrypt-test/wolf-build-and-run-test.sh | 2 ++ 12 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 RIOT_Make/benchmark/Makefile.benchmark create mode 100644 RIOT_Make/benchmark/include.am create mode 100644 RIOT_Make/include.am create mode 100644 RIOT_Make/testsuite/Makefile.testsuite create mode 100644 RIOT_Make/testsuite/include.am create mode 100644 RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest create mode 100644 RIOT_Make/wolfcrypt-test/include.am diff --git a/.gitignore b/.gitignore index a421b91ec..cb2b9f28e 100644 --- a/.gitignore +++ b/.gitignore @@ -191,5 +191,5 @@ wrapper/CSharp/x64/ *.vscode # RIOT_OS workspace directories: -RIOT_Make/*/bin/* +RIOT_Make/*/bin/ RIOT_Make/*/*.c diff --git a/Makefile.am b/Makefile.am index 09e1e7219..220813a13 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,6 +105,7 @@ include mcapi/zlib.X/nbproject/include.am include tirtos/include.am include scripts/include.am include IDE/include.am +include RIOT_Make/include.am if USE_VALGRIND TESTS_ENVIRONMENT=./valgrind-error.sh diff --git a/RIOT_Make/benchmark/Makefile.benchmark b/RIOT_Make/benchmark/Makefile.benchmark new file mode 100644 index 000000000..cf36a1375 --- /dev/null +++ b/RIOT_Make/benchmark/Makefile.benchmark @@ -0,0 +1,29 @@ +# name of your application +APPLICATION = wolfbenchmark + +# If no BOARD is found in the environment, use this default: +BOARD ?= native + +# This has to be the absolute path to the RIOT base directory: +RIOTBASE ?= $(CURDIR)/../../../../ + +# Comment this out to disable code in RIOT that does safety checking +# which is not needed in a production environment but helps in the +# development process: +CFLAGS += -DDEVELHELP + +# Change this to 0 show compiler invocation lines by default: +QUIET ?= 1 + +# bindist specific stuff: +# +# build and use module "abc". +# use BINARY_DIRS instead of DIRS +#BINARY_DIRS += wolfssl/src +INCLUDES += -I$(RIOTBASE)/examples/wolfssl + +# list of files to include in binary distribution +# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added +DIST_FILES += Makefile + +include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/benchmark/include.am b/RIOT_Make/benchmark/include.am new file mode 100644 index 000000000..d1cef6b88 --- /dev/null +++ b/RIOT_Make/benchmark/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= RIOT_Make/benchmark/README +EXTRA_DIST+= RIOT_Make/benchmark/Makefile.benchmark +EXTRA_DIST+= RIOT_Make/benchmark/wolf-build-and-run-test.sh diff --git a/RIOT_Make/benchmark/wolf-build-and-run-test.sh b/RIOT_Make/benchmark/wolf-build-and-run-test.sh index ffc316d0a..214af842b 100755 --- a/RIOT_Make/benchmark/wolf-build-and-run-test.sh +++ b/RIOT_Make/benchmark/wolf-build-and-run-test.sh @@ -2,6 +2,7 @@ wolf_riot_setup () { #copy the test sources here +cp Makefile.benchmark Makefile cp ../../wolfcrypt/benchmark/benchmark.c ./ cp ../../wolfcrypt/src/*.c ./ @@ -15,6 +16,7 @@ wolf_riot_cleanup () { #leave this line in for testing. Comment it out when you want to build # a .elf for flashing to a device make clean &> /dev/null + rm Makefile } trap wolf_riot_cleanup INT TERM diff --git a/RIOT_Make/include.am b/RIOT_Make/include.am new file mode 100644 index 000000000..25eaac402 --- /dev/null +++ b/RIOT_Make/include.am @@ -0,0 +1,10 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +include RIOT_Make/benchmark/include.am +include RIOT_Make/testsuite/include.am +include RIOT_Make/wolfcrypt-test/include.am + +EXTRA_DIST+= RIOT_Make/benchmark RIOT_Make/testsuite RIOT_Make/wolfcrypt-test \ + RIOT_Make/test-all.sh RIOT_Make/README diff --git a/RIOT_Make/testsuite/Makefile.testsuite b/RIOT_Make/testsuite/Makefile.testsuite new file mode 100644 index 000000000..c4927bd91 --- /dev/null +++ b/RIOT_Make/testsuite/Makefile.testsuite @@ -0,0 +1,29 @@ +# name of your application +APPLICATION = wolftestsuite + +# If no BOARD is found in the environment, use this default: +BOARD ?= native + +# This has to be the absolute path to the RIOT base directory: +RIOTBASE ?= $(CURDIR)/../../../../ + +# Comment this out to disable code in RIOT that does safety checking +# which is not needed in a production environment but helps in the +# development process: +CFLAGS += -DDEVELHELP + +# Change this to 0 show compiler invocation lines by default: +QUIET ?= 1 + +# bindist specific stuff: +# +# build and use module "abc". +# use BINARY_DIRS instead of DIRS +#BINARY_DIRS += wolfssl/src +INCLUDES += -I$(RIOTBASE)/examples/wolfssl + +# list of files to include in binary distribution +# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added +DIST_FILES += Makefile + +include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/testsuite/include.am b/RIOT_Make/testsuite/include.am new file mode 100644 index 000000000..cb8be4110 --- /dev/null +++ b/RIOT_Make/testsuite/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= RIOT_Make/testsuite/README +EXTRA_DIST+= RIOT_Make/testsuite/Makefile.testsuite +EXTRA_DIST+= RIOT_Make/testsuite/wolf-build-and-run-test.sh diff --git a/RIOT_Make/testsuite/wolf-build-and-run-test.sh b/RIOT_Make/testsuite/wolf-build-and-run-test.sh index f64d3953e..523481059 100755 --- a/RIOT_Make/testsuite/wolf-build-and-run-test.sh +++ b/RIOT_Make/testsuite/wolf-build-and-run-test.sh @@ -2,6 +2,7 @@ wolf_riot_setup () { #copy the test sources here +cp Makefile.testsuite Makefile cp ../../wolfcrypt/test/test.c ./ cp ../../examples/server/server.c ./ cp ../../examples/client/client.c ./ @@ -21,6 +22,7 @@ wolf_riot_cleanup () { #leave this line in for testing. Comment it out when you want to build # a .elf for flashing to a device make clean &> /dev/null + rm Makefile } trap wolf_riot_cleanup INT TERM diff --git a/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest b/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest new file mode 100644 index 000000000..b42a17b81 --- /dev/null +++ b/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest @@ -0,0 +1,29 @@ +# name of your application +APPLICATION = testwolfcrypt + +# If no BOARD is found in the environment, use this default: +BOARD ?= native + +# This has to be the absolute path to the RIOT base directory: +RIOTBASE ?= $(CURDIR)/../../../../ + +# Comment this out to disable code in RIOT that does safety checking +# which is not needed in a production environment but helps in the +# development process: +CFLAGS += -DDEVELHELP + +# Change this to 0 show compiler invocation lines by default: +QUIET ?= 1 + +# bindist specific stuff: +# +# build and use module "abc". +# use BINARY_DIRS instead of DIRS +#BINARY_DIRS += wolfssl/src +INCLUDES += -I$(RIOTBASE)/examples/wolfssl + +# list of files to include in binary distribution +# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added +DIST_FILES += Makefile + +include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/wolfcrypt-test/include.am b/RIOT_Make/wolfcrypt-test/include.am new file mode 100644 index 000000000..aeee2ad17 --- /dev/null +++ b/RIOT_Make/wolfcrypt-test/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= RIOT_Make/wolfcrypt-test/README +EXTRA_DIST+= RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest +EXTRA_DIST+= RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh diff --git a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh index 1f8100635..5188724e2 100755 --- a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh +++ b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh @@ -1,6 +1,7 @@ #!/bin/sh wolf_riot_setup () { + cp Makefile.wolfcrypttest Makefile #copy the test sources here cp ../../wolfcrypt/test/*.c ./ @@ -14,6 +15,7 @@ wolf_riot_cleanup () { #leave this line in for testing. Comment it out when you want to build # a .elf for flashing to a device make clean &> /dev/null + rm Makefile } BACKUPCFLAGS=${CFLAGS} From d2aef9a82aaa94c7902b7f4deda398aca59af820 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Sat, 3 Dec 2016 11:03:17 -0700 Subject: [PATCH 04/11] README update --- RIOT_Make/README | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RIOT_Make/README b/RIOT_Make/README index e177b2ba0..901b45cc8 100644 --- a/RIOT_Make/README +++ b/RIOT_Make/README @@ -1,3 +1,14 @@ +To test wolfSSL in RIOT build system get the RIOT source code from here: +git clone https://github.com/RIOT-OS/RIOT + +Then cd RIOT/examples + +clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl + +git clone https://github.com/wolfssl/wolfssl + +cd /RIOT/examples/wolfssl/RIOT_Make + To test all three applications: wolfbenchmark From ddeb9da50258244f8e303af529b583ad179bae3f Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Sat, 3 Dec 2016 11:55:24 -0700 Subject: [PATCH 05/11] warning on empty translation units ignored, move cflags to Makefile --- RIOT_Make/benchmark/Makefile.benchmark | 4 +++- RIOT_Make/benchmark/wolf-build-and-run-test.sh | 4 ---- RIOT_Make/testsuite/Makefile.testsuite | 4 +++- RIOT_Make/testsuite/wolf-build-and-run-test.sh | 4 ---- RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest | 4 +++- RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh | 5 ----- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/RIOT_Make/benchmark/Makefile.benchmark b/RIOT_Make/benchmark/Makefile.benchmark index cf36a1375..ede8a7a03 100644 --- a/RIOT_Make/benchmark/Makefile.benchmark +++ b/RIOT_Make/benchmark/Makefile.benchmark @@ -10,7 +10,9 @@ RIOTBASE ?= $(CURDIR)/../../../../ # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +CFLAGS += -DDEVELHELP -DWOLFSSL_RIOT_OS + +WERROR=0 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/RIOT_Make/benchmark/wolf-build-and-run-test.sh b/RIOT_Make/benchmark/wolf-build-and-run-test.sh index 214af842b..06f9c6947 100755 --- a/RIOT_Make/benchmark/wolf-build-and-run-test.sh +++ b/RIOT_Make/benchmark/wolf-build-and-run-test.sh @@ -20,9 +20,6 @@ wolf_riot_cleanup () { } trap wolf_riot_cleanup INT TERM -BACKUPCFLAGS=${CFLAGS} -export CFLAGS="${CFLAGS} -DWOLFSSL_RIOT_OS" - # copy the necessary files to this directory wolf_riot_setup @@ -40,7 +37,6 @@ fi ./bin/native/wolfbenchmark.elf # confirm success or failure -export CFLAGS="${BACKUPCFLAGS}" RESULT=$? [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && echo "cleanup done" && exit 2 diff --git a/RIOT_Make/testsuite/Makefile.testsuite b/RIOT_Make/testsuite/Makefile.testsuite index c4927bd91..0cd46c9f0 100644 --- a/RIOT_Make/testsuite/Makefile.testsuite +++ b/RIOT_Make/testsuite/Makefile.testsuite @@ -10,7 +10,9 @@ RIOTBASE ?= $(CURDIR)/../../../../ # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +CFLAGS += -DDEVELHELP -DNO_MAIN_DRIVER -DWOLFSSL_RIOT_OS + +WERROR=0 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/RIOT_Make/testsuite/wolf-build-and-run-test.sh b/RIOT_Make/testsuite/wolf-build-and-run-test.sh index 523481059..2a416d292 100755 --- a/RIOT_Make/testsuite/wolf-build-and-run-test.sh +++ b/RIOT_Make/testsuite/wolf-build-and-run-test.sh @@ -26,9 +26,6 @@ wolf_riot_cleanup () { } trap wolf_riot_cleanup INT TERM -BACKUPCFLAGS=${CFLAGS} -export CFLAGS="${CFLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_RIOT_OS" - # copy the necessary files to this directory wolf_riot_setup @@ -45,7 +42,6 @@ fi # run the test RESULT=`./bin/native/wolftestsuite.elf` # confirm success or failure -export CFLAGS="${BACKUPCFLAGS}" errstring="error" if test "${RESULT#*$errstring}" != "$RESULT" then diff --git a/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest b/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest index b42a17b81..4222bb6b0 100644 --- a/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest +++ b/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest @@ -10,7 +10,9 @@ RIOTBASE ?= $(CURDIR)/../../../../ # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +CFLAGS += -DDEVELHELP -DWOLFSSL_RIOT_OS + +WERROR=0 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh index 5188724e2..6d7670d08 100755 --- a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh +++ b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh @@ -18,10 +18,6 @@ wolf_riot_cleanup () { rm Makefile } -BACKUPCFLAGS=${CFLAGS} -export CFLAGS="${CFLAGS} -DWOLFSSL_RIOT_OS" - - # copy the necessary files to this directory wolf_riot_setup @@ -43,7 +39,6 @@ fi RESULT=`./bin/native/testwolfcrypt.elf` # confirm success or failure -export CFLAGS="${BACKUPCFLAGS}" errstring="error" if test "${RESULT#*$errstring}" != "$RESULT" then From c957107d7664cc086bee7497c2f3be24015fc417 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 13:11:45 -0700 Subject: [PATCH 06/11] merge with master and remove RIOT_Make directory, keep changes for working on Mac OS X --- RIOT_Make/README | 23 ------- RIOT_Make/benchmark/Makefile.benchmark | 31 --------- RIOT_Make/benchmark/README | 49 -------------- RIOT_Make/benchmark/include.am | 7 -- .../benchmark/wolf-build-and-run-test.sh | 53 --------------- RIOT_Make/include.am | 10 --- RIOT_Make/test-all.sh | 34 ---------- RIOT_Make/testsuite/Makefile.testsuite | 31 --------- RIOT_Make/testsuite/README | 53 --------------- RIOT_Make/testsuite/include.am | 7 -- .../testsuite/wolf-build-and-run-test.sh | 64 ------------------- .../wolfcrypt-test/Makefile.wolfcrypttest | 31 --------- RIOT_Make/wolfcrypt-test/README | 49 -------------- RIOT_Make/wolfcrypt-test/include.am | 7 -- .../wolfcrypt-test/wolf-build-and-run-test.sh | 63 ------------------ 15 files changed, 512 deletions(-) delete mode 100644 RIOT_Make/README delete mode 100644 RIOT_Make/benchmark/Makefile.benchmark delete mode 100644 RIOT_Make/benchmark/README delete mode 100644 RIOT_Make/benchmark/include.am delete mode 100755 RIOT_Make/benchmark/wolf-build-and-run-test.sh delete mode 100644 RIOT_Make/include.am delete mode 100755 RIOT_Make/test-all.sh delete mode 100644 RIOT_Make/testsuite/Makefile.testsuite delete mode 100644 RIOT_Make/testsuite/README delete mode 100644 RIOT_Make/testsuite/include.am delete mode 100755 RIOT_Make/testsuite/wolf-build-and-run-test.sh delete mode 100644 RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest delete mode 100644 RIOT_Make/wolfcrypt-test/README delete mode 100644 RIOT_Make/wolfcrypt-test/include.am delete mode 100755 RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh diff --git a/RIOT_Make/README b/RIOT_Make/README deleted file mode 100644 index 901b45cc8..000000000 --- a/RIOT_Make/README +++ /dev/null @@ -1,23 +0,0 @@ -To test wolfSSL in RIOT build system get the RIOT source code from here: -git clone https://github.com/RIOT-OS/RIOT - -Then cd RIOT/examples - -clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl - -git clone https://github.com/wolfssl/wolfssl - -cd /RIOT/examples/wolfssl/RIOT_Make - -To test all three applications: - -wolfbenchmark -testsuite -wolfcrypt-test - -run the script in this directory: ./test-all.sh - -See the README in each respecive directory for more information on wolfSSL and -RIOT_OS! - - diff --git a/RIOT_Make/benchmark/Makefile.benchmark b/RIOT_Make/benchmark/Makefile.benchmark deleted file mode 100644 index ede8a7a03..000000000 --- a/RIOT_Make/benchmark/Makefile.benchmark +++ /dev/null @@ -1,31 +0,0 @@ -# name of your application -APPLICATION = wolfbenchmark - -# If no BOARD is found in the environment, use this default: -BOARD ?= native - -# This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../../../../ - -# Comment this out to disable code in RIOT that does safety checking -# which is not needed in a production environment but helps in the -# development process: -CFLAGS += -DDEVELHELP -DWOLFSSL_RIOT_OS - -WERROR=0 - -# Change this to 0 show compiler invocation lines by default: -QUIET ?= 1 - -# bindist specific stuff: -# -# build and use module "abc". -# use BINARY_DIRS instead of DIRS -#BINARY_DIRS += wolfssl/src -INCLUDES += -I$(RIOTBASE)/examples/wolfssl - -# list of files to include in binary distribution -# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added -DIST_FILES += Makefile - -include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/benchmark/README b/RIOT_Make/benchmark/README deleted file mode 100644 index 1aa54afa0..000000000 --- a/RIOT_Make/benchmark/README +++ /dev/null @@ -1,49 +0,0 @@ -These are the steps to properly setup a test of wolfssl in RIOT OS: - -To test wolfSSL in RIOT build system get the RIOT source code from here: -git clone https://github.com/RIOT-OS/RIOT - -Then cd RIOT/examples - -clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl - -git clone https://github.com/wolfssl/wolfssl - -cd /RIOT/examples/wolfssl/RIOT_Make/benchmark - -run the script ./wolf-build-and-run-test.sh - -That script will perform the following steps: -1. copy the source files from: - /src - /wolfcrypt/src - /wolfcrypt/benchmark - -2. Use the provided Makefile to build the example application: - "wolfbenchmark.elf" - This application will be located here: - /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/wolfbenchmark.elf - -3. Execute that application. You should see a pass or fail. - -4. Lastly that script will cleanup the source files it copied in for building. - NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary - files. All development changes should be made to the actual source - files located in their respective directories: - /src - /wolfcrypt/src - /wolfcrypt/benchmark - Then the script "wolf-build-and-run-test.sh" should be run again to - test those changes - If you do make changes to the temporary files those changes will be - ignored by /.gitignore - - -NOTE: This test is only for the "native" test. To build for a specific platform - cd to RIOT directory and run "make doc" to generate doxygen docs. - (You will need to install doxygen if you don't have it already) - Then open the file: RIOT/doc/doxygen/html/index.html - - This will provide you with the necessary help to setup and build for a - specific platform - diff --git a/RIOT_Make/benchmark/include.am b/RIOT_Make/benchmark/include.am deleted file mode 100644 index d1cef6b88..000000000 --- a/RIOT_Make/benchmark/include.am +++ /dev/null @@ -1,7 +0,0 @@ -# vim:ft=automake -# included from Top Level Makefile.am -# All paths should be given relative to the root - -EXTRA_DIST+= RIOT_Make/benchmark/README -EXTRA_DIST+= RIOT_Make/benchmark/Makefile.benchmark -EXTRA_DIST+= RIOT_Make/benchmark/wolf-build-and-run-test.sh diff --git a/RIOT_Make/benchmark/wolf-build-and-run-test.sh b/RIOT_Make/benchmark/wolf-build-and-run-test.sh deleted file mode 100755 index 06f9c6947..000000000 --- a/RIOT_Make/benchmark/wolf-build-and-run-test.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -wolf_riot_setup () { -#copy the test sources here -cp Makefile.benchmark Makefile -cp ../../wolfcrypt/benchmark/benchmark.c ./ - -cp ../../wolfcrypt/src/*.c ./ - -cp ../../src/*.c ./ - -} - -wolf_riot_cleanup () { - rm ./*.c - #leave this line in for testing. Comment it out when you want to build - # a .elf for flashing to a device - make clean &> /dev/null - rm Makefile -} -trap wolf_riot_cleanup INT TERM - -# copy the necessary files to this directory -wolf_riot_setup - -# build the test -make &> /dev/null -RESULT=$? - [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && - make -if [ $RESULT != 0 ]; -then - wolf_riot_cleanup && echo "cleanup done" && exit 2 -fi - -# run the test -./bin/native/wolfbenchmark.elf - -# confirm success or failure -RESULT=$? - [ $RESULT != 0 ] && echo "TEST FAILED" && wolf_riot_cleanup && - echo "cleanup done" && exit 2 - -echo "TEST PASSED!" - -# cleanup. All changes made should be to the files in: -# /src -# /wolfcrypt/src -# or other. Never make changes to the files copied here as they are only -# temporary. Once changes are made, to test them just run this script again. -wolf_riot_cleanup 0 - - diff --git a/RIOT_Make/include.am b/RIOT_Make/include.am deleted file mode 100644 index 25eaac402..000000000 --- a/RIOT_Make/include.am +++ /dev/null @@ -1,10 +0,0 @@ -# vim:ft=automake -# included from Top Level Makefile.am -# All paths should be given relative to the root - -include RIOT_Make/benchmark/include.am -include RIOT_Make/testsuite/include.am -include RIOT_Make/wolfcrypt-test/include.am - -EXTRA_DIST+= RIOT_Make/benchmark RIOT_Make/testsuite RIOT_Make/wolfcrypt-test \ - RIOT_Make/test-all.sh RIOT_Make/README diff --git a/RIOT_Make/test-all.sh b/RIOT_Make/test-all.sh deleted file mode 100755 index 20d908386..000000000 --- a/RIOT_Make/test-all.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -check_status () { -if [ $1 != 0 ] -then - echo "$2 failed" - echo "" -fi -} - -echo "Running wolfssl testsuite with RIOT" -cd testsuite/ -./wolf-build-and-run-test.sh -RESULT=$? -check_status $RESULT "testsuite" -cd .. - -echo "" -echo "Running wolfcrypt tests with RIOT" -cd wolfcrypt-test -./wolf-build-and-run-test.sh -RESULT=$? -check_status $RESULT "wolfcrypt test" -cd .. - -echo "" -echo "Running wolfcrypt benchmark with RIOT" -cd benchmark -./wolf-build-and-run-test.sh -RESULT=$? -check_status $RESULT "wolfcrypt benchmark" -cd .. - -exit 0 diff --git a/RIOT_Make/testsuite/Makefile.testsuite b/RIOT_Make/testsuite/Makefile.testsuite deleted file mode 100644 index 0cd46c9f0..000000000 --- a/RIOT_Make/testsuite/Makefile.testsuite +++ /dev/null @@ -1,31 +0,0 @@ -# name of your application -APPLICATION = wolftestsuite - -# If no BOARD is found in the environment, use this default: -BOARD ?= native - -# This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../../../../ - -# Comment this out to disable code in RIOT that does safety checking -# which is not needed in a production environment but helps in the -# development process: -CFLAGS += -DDEVELHELP -DNO_MAIN_DRIVER -DWOLFSSL_RIOT_OS - -WERROR=0 - -# Change this to 0 show compiler invocation lines by default: -QUIET ?= 1 - -# bindist specific stuff: -# -# build and use module "abc". -# use BINARY_DIRS instead of DIRS -#BINARY_DIRS += wolfssl/src -INCLUDES += -I$(RIOTBASE)/examples/wolfssl - -# list of files to include in binary distribution -# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added -DIST_FILES += Makefile - -include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/testsuite/README b/RIOT_Make/testsuite/README deleted file mode 100644 index d5e486733..000000000 --- a/RIOT_Make/testsuite/README +++ /dev/null @@ -1,53 +0,0 @@ -These are the steps to properly setup a test of wolfssl in RIOT OS: - -To test wolfSSL in RIOT build system get the RIOT source code from here: -git clone https://github.com/RIOT-OS/RIOT - -Then cd RIOT/examples - -clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl - -git clone https://github.com/wolfssl/wolfssl - -cd /RIOT/examples/wolfssl/RIOT_Make/testsuite - -run the script ./wolf-build-and-run-test.sh - -That script will perform the following steps: -1. copy the source files from: - /src - /wolfcrypt/src - /wolfcrypt/test - /testsuite - /examples/[ echoserver/echoclient/client/server ] - -2. Use the provided Makefile to build the example application: - "testwolfcrypt.elf" - This application will be located here: - /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testsuite.elf - -3. Execute that application. You should see a pass or fail. - -4. Lastly that script will cleanup the source files it copied in for building. - NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary - files. All development changes should be made to the actual source - files located in their respective directories: - /src - /wolfcrypt/src - /wolfcrypt/test - /testsuite - /examples/[ echoserver/echoclient/client/server ] - Then the script "wolf-build-and-run-test.sh" should be run again to - test those changes - If you do make changes to the temporary files those changes will be - ignored by /.gitignore - - -NOTE: This test is only for the "native" test. To build for a specific platform - cd to RIOT directory and run "make doc" to generate doxygen docs. - (You will need to install doxygen if you don't have it already) - Then open the file: RIOT/doc/doxygen/html/index.html - - This will provide you with the necessary help to setup and build for a - specific platform - diff --git a/RIOT_Make/testsuite/include.am b/RIOT_Make/testsuite/include.am deleted file mode 100644 index cb8be4110..000000000 --- a/RIOT_Make/testsuite/include.am +++ /dev/null @@ -1,7 +0,0 @@ -# vim:ft=automake -# included from Top Level Makefile.am -# All paths should be given relative to the root - -EXTRA_DIST+= RIOT_Make/testsuite/README -EXTRA_DIST+= RIOT_Make/testsuite/Makefile.testsuite -EXTRA_DIST+= RIOT_Make/testsuite/wolf-build-and-run-test.sh diff --git a/RIOT_Make/testsuite/wolf-build-and-run-test.sh b/RIOT_Make/testsuite/wolf-build-and-run-test.sh deleted file mode 100755 index 2a416d292..000000000 --- a/RIOT_Make/testsuite/wolf-build-and-run-test.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -wolf_riot_setup () { -#copy the test sources here -cp Makefile.testsuite Makefile -cp ../../wolfcrypt/test/test.c ./ -cp ../../examples/server/server.c ./ -cp ../../examples/client/client.c ./ -cp ../../examples/echoserver/echoserver.c ./ -cp ../../examples/echoclient/echoclient.c ./ - -cp ../../testsuite/testsuite.c ./ - -cp ../../wolfcrypt/src/*.c ./ - -cp ../../src/*.c ./ - -} - -wolf_riot_cleanup () { - rm ./*.c - #leave this line in for testing. Comment it out when you want to build - # a .elf for flashing to a device - make clean &> /dev/null - rm Makefile -} -trap wolf_riot_cleanup INT TERM - -# copy the necessary files to this directory -wolf_riot_setup - -# build the test -make &> /dev/null -RESULT=$? - [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && - make -if [ $RESULT != 0 ]; -then - wolf_riot_cleanup && echo "cleanup done" && exit 2 -fi - -# run the test -RESULT=`./bin/native/wolftestsuite.elf` -# confirm success or failure -errstring="error" -if test "${RESULT#*$errstring}" != "$RESULT" - then - echo "$RESULT" - echo "TEST FAILED" && wolf_riot_cleanup && echo "cleanup done" && - exit 2 - else - echo "$RESULT" - fi - -echo "TEST PASSED!" - -# cleanup. All changes made should be to the files in: -# /src -# /wolfcrypt/src -# or other. Never make changes to the files copied here as they are only -# temporary. Once changes are made, to test them just run this script again. -wolf_riot_cleanup 0 - - diff --git a/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest b/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest deleted file mode 100644 index 4222bb6b0..000000000 --- a/RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest +++ /dev/null @@ -1,31 +0,0 @@ -# name of your application -APPLICATION = testwolfcrypt - -# If no BOARD is found in the environment, use this default: -BOARD ?= native - -# This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../../../../ - -# Comment this out to disable code in RIOT that does safety checking -# which is not needed in a production environment but helps in the -# development process: -CFLAGS += -DDEVELHELP -DWOLFSSL_RIOT_OS - -WERROR=0 - -# Change this to 0 show compiler invocation lines by default: -QUIET ?= 1 - -# bindist specific stuff: -# -# build and use module "abc". -# use BINARY_DIRS instead of DIRS -#BINARY_DIRS += wolfssl/src -INCLUDES += -I$(RIOTBASE)/examples/wolfssl - -# list of files to include in binary distribution -# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added -DIST_FILES += Makefile - -include $(RIOTBASE)/Makefile.include diff --git a/RIOT_Make/wolfcrypt-test/README b/RIOT_Make/wolfcrypt-test/README deleted file mode 100644 index 2c4dcd31a..000000000 --- a/RIOT_Make/wolfcrypt-test/README +++ /dev/null @@ -1,49 +0,0 @@ -These are the steps to properly setup a test of wolfssl in RIOT OS: - -To test wolfSSL in RIOT build system get the RIOT source code from here: -git clone https://github.com/RIOT-OS/RIOT - -Then cd RIOT/examples - -clone wolfssl in that directory. You should end up with RIOT/examples/wolfssl - -git clone https://github.com/wolfssl/wolfssl - -cd /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test - -run the script ./wolf-build-and-run-test.sh - -That script will perform the following steps: -1. copy the source files from: - /src - /wolfcrypt/src - /wolfcrypt/test - -2. Use the provided Makefile to build the example application: - "testwolfcrypt.elf" - This application will be located here: - /RIOT/examples/wolfssl/RIOT_Make/wolfcrypt-test/bin/native/testwolfcrypt.elf - -3. Execute that application. You should see a pass or fail. - -4. Lastly that script will cleanup the source files it copied in for building. - NOTE: this is HIGHLY RECOMMENDED to prevent making changes on temporary - files. All development changes should be made to the actual source - files located in their respective directories: - /src - /wolfcrypt/src - /wolfcrypt/test - Then the script "build-and-run-test.sh" should be run again to test - those changes - If you do make changes to the temporary files those changes will be - ignored by /.gitignore - -. -NOTE: This test is only for the "native" test. To build for a specific platform - cd to RIOT directory and run "make doc" to generate doxygen docs. - (You will need to install doxygen if you don't have it already) - Then open the file: RIOT/doc/doxygen/html/index.html - - This will provide you with the necessary help to setup and build for a - specific platform - diff --git a/RIOT_Make/wolfcrypt-test/include.am b/RIOT_Make/wolfcrypt-test/include.am deleted file mode 100644 index aeee2ad17..000000000 --- a/RIOT_Make/wolfcrypt-test/include.am +++ /dev/null @@ -1,7 +0,0 @@ -# vim:ft=automake -# included from Top Level Makefile.am -# All paths should be given relative to the root - -EXTRA_DIST+= RIOT_Make/wolfcrypt-test/README -EXTRA_DIST+= RIOT_Make/wolfcrypt-test/Makefile.wolfcrypttest -EXTRA_DIST+= RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh diff --git a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh b/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh deleted file mode 100755 index 6d7670d08..000000000 --- a/RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -wolf_riot_setup () { - cp Makefile.wolfcrypttest Makefile - #copy the test sources here - cp ../../wolfcrypt/test/*.c ./ - - cp ../../wolfcrypt/src/*.c ./ - - cp ../../src/*.c ./ -} - -wolf_riot_cleanup () { - rm ./*.c - #leave this line in for testing. Comment it out when you want to build - # a .elf for flashing to a device - make clean &> /dev/null - rm Makefile -} - -# copy the necessary files to this directory -wolf_riot_setup - -# build the test -# change next line to just "make" to see verbose output -# NOTE: will throw a warning on every file that is empty if that feature -# is not enabled in wolfssl. -make &> /dev/null -RESULT=$? - [ $RESULT != 0 ] && echo "Make FAILED: running verbose make" && - make - -if [ $RESULT != 0 ]; -then - wolf_riot_cleanup && echo "cleanup done" && exit 2 -fi - -# run the test -RESULT=`./bin/native/testwolfcrypt.elf` - -# confirm success or failure -errstring="error" -if test "${RESULT#*$errstring}" != "$RESULT" - then - echo "$RESULT" - echo "TEST FAILED" && wolf_riot_cleanup && echo "cleanup done" && - exit 2 - else - echo "$RESULT" - fi - -echo "ALL TEST PASSED!" - -# cleanup. All changes made should be to the files in: -# /src -# /wolfcrypt/src -# or other. Never make changes to the files copied here as they are only -# temporary. Once changes are made, to test them just run this script again. -wolf_riot_cleanup - -exit 0 - - From 7a76baa83e6246260d86e7b61ccfc8473b0f7ff0 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 13:13:43 -0700 Subject: [PATCH 07/11] restore .am and gitignore --- .gitignore | 4 ---- Makefile.am | 1 - 2 files changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore index cb2b9f28e..f14682518 100644 --- a/.gitignore +++ b/.gitignore @@ -189,7 +189,3 @@ wrapper/CSharp/x64/ # Visual Studio Code Workspace Files *.vscode - -# RIOT_OS workspace directories: -RIOT_Make/*/bin/ -RIOT_Make/*/*.c diff --git a/Makefile.am b/Makefile.am index 220813a13..09e1e7219 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,7 +105,6 @@ include mcapi/zlib.X/nbproject/include.am include tirtos/include.am include scripts/include.am include IDE/include.am -include RIOT_Make/include.am if USE_VALGRIND TESTS_ENVIRONMENT=./valgrind-error.sh From fc9d689bc6a0fe1be0dd62b2859d6a1dd60875dc Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 14:34:14 -0700 Subject: [PATCH 08/11] fastmath works with RIOT_OS if defined TFM_NO_ASM --- wolfssl/wolfcrypt/settings.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index abef54b6b..d602df9b1 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -412,9 +412,11 @@ #endif #ifdef WOLFSSL_RIOT_OS + #define TFM_NO_ASM + #define USE_FAST_MATH + #define NO_FILE_SYSTEM #define USE_CERT_BUFFERS_2048 #define HAVE_ECC - #define NO_INLINE #endif #ifdef WOLFSSL_NRF5x From e3b57211d54393f1963d716b05baebccfddc58c0 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 14:36:06 -0700 Subject: [PATCH 09/11] undo whitespace modification --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f14682518..b22328702 100644 --- a/.gitignore +++ b/.gitignore @@ -188,4 +188,4 @@ wolfcrypt/user-crypto/lib/libusercrypto.* wrapper/CSharp/x64/ # Visual Studio Code Workspace Files -*.vscode +*.vscode \ No newline at end of file From 1748045d52a901934580e2547cce31c392fbc409 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 19:12:25 -0700 Subject: [PATCH 10/11] use NO_WRITEV for portability --- wolfssl/ssl.h | 2 -- wolfssl/wolfcrypt/settings.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 99d3c3c20..64cfcbb3e 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -1065,8 +1065,6 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL*, void* key, unsigned int len, #ifdef __PPU #include #include - #elif defined(WOLFSSL_RIOT_OS) - #include #elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \ !defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) && \ !defined(WOLFSSL_EMBOS) && !defined(WOLFSSL_FROSTED) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index d602df9b1..eea36f4f5 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -412,6 +412,7 @@ #endif #ifdef WOLFSSL_RIOT_OS + #define NO_WRITEV #define TFM_NO_ASM #define USE_FAST_MATH #define NO_FILE_SYSTEM From 6c7e1785aac41a15ec1dee1acd551cfc9d4c2b09 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 9 Dec 2016 19:39:36 -0700 Subject: [PATCH 11/11] EXIT_TEST macro added for cleaner implementation and maintenance --- testsuite/testsuite.c | 13 +++---------- wolfcrypt/benchmark/benchmark.c | 6 +----- wolfcrypt/test/test.c | 13 +++---------- wolfssl/wolfcrypt/types.h | 5 +++++ 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 220ada67e..3a2bc64ec 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -210,11 +210,7 @@ int testsuite_test(int argc, char** argv) #endif /* HAVE_WNR */ printf("\nAll tests passed!\n"); -#ifdef WOLFSSL_RIOT_OS - exit(0); -#else - return EXIT_SUCCESS; -#endif + EXIT_TEST(EXIT_SUCCESS); } void simple_test(func_args* args) @@ -415,11 +411,8 @@ int main(int argc, char** argv) if (server_args.return_code != 0) return server_args.return_code; printf("\nAll tests passed!\n"); -#ifdef WOLFSSL_RIOT_OS - exit(0); -#else - return EXIT_SUCCESS; -#endif + + EXIT_TEST(EXIT_SUCCESS); } diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index dcbfc8cf8..ee186aa27 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -483,11 +483,7 @@ int benchmark_test(void *args) ShowMemoryTracker(); #endif -#ifdef WOLFSSL_RIOT_OS - exit (0); -#else - return 0; -#endif + EXIT_TEST(0); } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 5ae622d02..b2656c1fb 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -262,11 +262,8 @@ static int err_sys(const char* msg, int es) { printf("%s error = %d\n", msg, es); -#ifdef WOLFSSL_RIOT_OS - exit(-1); -#else - return -1; /* error state */ -#endif + + EXIT_TEST(-1); } /* func_args from test.h, so don't have to pull in other junk */ @@ -733,11 +730,7 @@ int wolfcrypt_test(void* args) err_sys("Failed to free netRandom context", -1238); #endif /* HAVE_WNR */ -#ifdef WOLFSSL_RIOT_OS - exit(0); -#else - return args.return_code; -#endif + EXIT_TEST(args.return_code); } #endif /* NO_MAIN_DRIVER */ diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 8a2022808..5d04be8f6 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -407,6 +407,11 @@ #endif #endif /* WOLFSSL_AESNI or WOLFSSL_ARMASM */ + #ifdef WOLFSSL_RIOT_OS + #define EXIT_TEST(ret) exit(ret) + #else + #define EXIT_TEST(ret) return ret + #endif #ifdef __cplusplus } /* extern "C" */