forked from wolfSSL/wolfssl
RIOT OS build and test scripts, build instructions
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -188,4 +188,8 @@ wolfcrypt/user-crypto/lib/libusercrypto.*
|
|||||||
wrapper/CSharp/x64/
|
wrapper/CSharp/x64/
|
||||||
|
|
||||||
# Visual Studio Code Workspace Files
|
# Visual Studio Code Workspace Files
|
||||||
*.vscode
|
*.vscode
|
||||||
|
|
||||||
|
# RIOT_OS workspace directories:
|
||||||
|
RIOT_Make/*/bin/*
|
||||||
|
RIOT_Make/*/*.c
|
||||||
|
27
RIOT_Make/test-all.sh
Executable file
27
RIOT_Make/test-all.sh
Executable file
@@ -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
|
53
RIOT_Make/testsuite/README
Normal file
53
RIOT_Make/testsuite/README
Normal file
@@ -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 <path-to>/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:
|
||||||
|
<wolfssl-root>/src
|
||||||
|
<wolfssl-root>/wolfcrypt/src
|
||||||
|
<wolfssl-root>/wolfcrypt/test
|
||||||
|
<wolfssl-root>/testsuite
|
||||||
|
<wolfssl-root>/examples/[ echoserver/echoclient/client/server ]
|
||||||
|
|
||||||
|
2. Use the provided Makefile to build the example application:
|
||||||
|
"testwolfcrypt.elf"
|
||||||
|
This application will be located here:
|
||||||
|
<path-to>/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:
|
||||||
|
<wolfssl-root>/src
|
||||||
|
<wolfssl-root>/wolfcrypt/src
|
||||||
|
<wolfssl-root>/wolfcrypt/test
|
||||||
|
<wolfssl-root>/testsuite
|
||||||
|
<wolfssl-root>/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 <wolfssl-root>/.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
|
||||||
|
|
61
RIOT_Make/testsuite/wolf-build-and-run-test.sh
Executable file
61
RIOT_Make/testsuite/wolf-build-and-run-test.sh
Executable file
@@ -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:
|
||||||
|
# <wolfssl-root>/src
|
||||||
|
# <wolfssl-root>/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
|
||||||
|
|
||||||
|
|
49
RIOT_Make/wolfcrypt-test/README
Normal file
49
RIOT_Make/wolfcrypt-test/README
Normal file
@@ -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 <path-to>/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:
|
||||||
|
<wolfssl-root>/src
|
||||||
|
<wolfssl-root>/wolfcrypt/src
|
||||||
|
<wolfssl-root>/wolfcrypt/test
|
||||||
|
|
||||||
|
2. Use the provided Makefile to build the example application:
|
||||||
|
"testwolfcrypt.elf"
|
||||||
|
This application will be located here:
|
||||||
|
<path-to>/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:
|
||||||
|
<wolfssl-root>/src
|
||||||
|
<wolfssl-root>/wolfcrypt/src
|
||||||
|
<wolfssl-root>/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 <wolfssl-root>/.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
|
||||||
|
|
58
RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh
Executable file
58
RIOT_Make/wolfcrypt-test/wolf-build-and-run-test.sh
Executable file
@@ -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:
|
||||||
|
# <wolfssl-root>/src
|
||||||
|
# <wolfssl-root>/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
|
||||||
|
|
||||||
|
|
@@ -210,7 +210,11 @@ int testsuite_test(int argc, char** argv)
|
|||||||
#endif /* HAVE_WNR */
|
#endif /* HAVE_WNR */
|
||||||
|
|
||||||
printf("\nAll tests passed!\n");
|
printf("\nAll tests passed!\n");
|
||||||
|
#ifdef WOLFSSL_RIOT_OS
|
||||||
|
exit(0);
|
||||||
|
#else
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void simple_test(func_args* args)
|
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;
|
if (server_args.return_code != 0) return server_args.return_code;
|
||||||
|
|
||||||
printf("\nAll tests passed!\n");
|
printf("\nAll tests passed!\n");
|
||||||
|
#ifdef WOLFSSL_RIOT_OS
|
||||||
|
exit(0);
|
||||||
|
#else
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -729,7 +729,11 @@ int wolfcrypt_test(void* args)
|
|||||||
err_sys("Failed to free netRandom context", -1238);
|
err_sys("Failed to free netRandom context", -1238);
|
||||||
#endif /* HAVE_WNR */
|
#endif /* HAVE_WNR */
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_RIOT_OS
|
||||||
|
exit(0);
|
||||||
|
#else
|
||||||
return args.return_code;
|
return args.return_code;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NO_MAIN_DRIVER */
|
#endif /* NO_MAIN_DRIVER */
|
||||||
|
@@ -1065,6 +1065,8 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL*, void* key, unsigned int len,
|
|||||||
#ifdef __PPU
|
#ifdef __PPU
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#elif defined(WOLFSSL_RIOT_OS)
|
||||||
|
#include <sys/_types/_iovec_t.h>
|
||||||
#elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \
|
#elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \
|
||||||
!defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) && \
|
!defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) && \
|
||||||
!defined(WOLFSSL_EMBOS) && !defined(WOLFSSL_FROSTED)
|
!defined(WOLFSSL_EMBOS) && !defined(WOLFSSL_FROSTED)
|
||||||
|
@@ -147,6 +147,9 @@
|
|||||||
/* Uncomment next line if building for embOS */
|
/* Uncomment next line if building for embOS */
|
||||||
/* #define WOLFSSL_EMBOS */
|
/* #define WOLFSSL_EMBOS */
|
||||||
|
|
||||||
|
/* Uncomment next line if building for RIOT-OS */
|
||||||
|
/* #define WOLFSSL_RIOT_OS */
|
||||||
|
|
||||||
#include <wolfssl/wolfcrypt/visibility.h>
|
#include <wolfssl/wolfcrypt/visibility.h>
|
||||||
|
|
||||||
#ifdef WOLFSSL_USER_SETTINGS
|
#ifdef WOLFSSL_USER_SETTINGS
|
||||||
@@ -404,6 +407,12 @@
|
|||||||
#define SINGLE_THREADED /* Not ported at this time */
|
#define SINGLE_THREADED /* Not ported at this time */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_RIOT_OS
|
||||||
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
#define HAVE_ECC
|
||||||
|
#define NO_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_NRF5x
|
#ifdef WOLFSSL_NRF5x
|
||||||
#define SIZEOF_LONG 4
|
#define SIZEOF_LONG 4
|
||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
Reference in New Issue
Block a user