mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Example client/server compatible with VxWorks
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## Wind River Workbench using VxWorks with wolfSSL
|
## Wind River Workbench using VxWorks with wolfSSL
|
||||||
###SETUP:
|
###1 SETUP:
|
||||||
####Steps
|
####1.1 Steps
|
||||||
1. Start by creating a new VxWorks image in Workbench by going to File > New >
|
1. Start by creating a new VxWorks image in Workbench by going to File > New >
|
||||||
Project and then select VxWorks Image Project.
|
Project and then select VxWorks Image Project.
|
||||||
2. Include the path to the wolfSSL header files(wolfssl/wolfssl):
|
2. Include the path to the wolfSSL header files(wolfssl/wolfssl):
|
||||||
@@ -13,10 +13,11 @@ Highlight EXTRA\_DEFINE. Click Edit and add the following to this line:
|
|||||||
This can also be done in wolfssl/wolfcrypt/settings.h by uncommenting the
|
This can also be done in wolfssl/wolfcrypt/settings.h by uncommenting the
|
||||||
#define WOLFSSL_VXWORKS
|
#define WOLFSSL_VXWORKS
|
||||||
line.
|
line.
|
||||||
If there is not a filesystem set up, add -DUSE\_CERT\_BUFFERS\_2048 to the
|
If there is not a filesystem set up, add -DUSE\_CERT\_BUFFERS\_2048 and
|
||||||
variables or #define USE\_CERT\_BUFFERS\_2048 at the top of settings.h.
|
-DNO\_FILESYSTEM to the variables or #define USE\_CERT\_BUFFERS\_2048 and
|
||||||
|
\#define NO\_FILESYSTEM at the top of settings.h.
|
||||||
If there is a filesystem, paths may need to be changed to the path of
|
If there is a filesystem, paths may need to be changed to the path of
|
||||||
filesystem for certificate files.
|
filesystem for certificate files in wolfssl/test.h.
|
||||||
4. Right click on the project and go to Import > Filesystem. Choose the path
|
4. Right click on the project and go to Import > Filesystem. Choose the path
|
||||||
to the wolfSSL library here. Uncheck everything except the src and wolfcrypt
|
to the wolfSSL library here. Uncheck everything except the src and wolfcrypt
|
||||||
directories.
|
directories.
|
||||||
@@ -25,7 +26,11 @@ In the wolfcrypt/src folder, uncheck aes\_asm.asm and aes\_asm.s.
|
|||||||
\#ifdef WOLFSSL\_VXWORKS, a new GenerateSeed() function will need to be defined
|
\#ifdef WOLFSSL\_VXWORKS, a new GenerateSeed() function will need to be defined
|
||||||
in wolfcrypt/src/random.c.
|
in wolfcrypt/src/random.c.
|
||||||
|
|
||||||
####Testing wolfSSL with VxWorks:
|
####1.2 Testing wolfSSL with VxWorks:
|
||||||
|
#####1.2.1 wolfCrypt Test Application
|
||||||
|
The wolfCrypt test application will test each of the cryptographic algorithms
|
||||||
|
and output the status for each. This should return success for each algorithm
|
||||||
|
if everything is working.
|
||||||
1. In usrAppInit.c, make a call to the wolfCrypt test application by adding
|
1. In usrAppInit.c, make a call to the wolfCrypt test application by adding
|
||||||
the following to the usrAppInit() function:
|
the following to the usrAppInit() function:
|
||||||
|
|
||||||
@@ -47,7 +52,41 @@ the following to the usrAppInit() function:
|
|||||||
certificate file error, adjust the caCert file locations in
|
certificate file error, adjust the caCert file locations in
|
||||||
wolfcrypt/test/test.c or wolfssl/test.h to those of the filesystem in use.
|
wolfcrypt/test/test.c or wolfssl/test.h to those of the filesystem in use.
|
||||||
|
|
||||||
####Necessary Files
|
#####1.2.2 Example Client
|
||||||
|
The wolfSSL example client can be found in wolfssl/examples/client.
|
||||||
|
1. Add client.c and client.h from the examples/client folder to the Workbench
|
||||||
|
project.
|
||||||
|
2. In usrAppInit.c, inlucde the func\_args as described in the Test Application
|
||||||
|
section, and add a call to the client function:
|
||||||
|
client_test(&args);
|
||||||
|
3. Add the client.h header file to the includes at the top of usrAppInit.c.
|
||||||
|
4. The wolfSSLIP will need to be changed to the IP address the server is
|
||||||
|
running on. If using the VxWorks Simulator, localhost will not work. NAT should
|
||||||
|
be selected in the Simulator Connection Advanced setup.
|
||||||
|
5. Start the example server from within the wolfSSL directory on the host
|
||||||
|
machine:
|
||||||
|
./examples/server/server -d -b
|
||||||
|
The -d option disables peer checks, -b allows for binding to any interface.
|
||||||
|
6. Start the example client in Workbench.
|
||||||
|
|
||||||
|
#####1.2.3 Example Server
|
||||||
|
The example server requires more configuration than the client if using the
|
||||||
|
VxWorks simulator.
|
||||||
|
1. Add server.c and server.h from the wolfssl/examples/server folder to the
|
||||||
|
Workbench project.
|
||||||
|
2. In usrAppInit.c, inlcude the func\args as described in the Test and Client
|
||||||
|
applications and add a call to the server function:
|
||||||
|
server_test(&args);
|
||||||
|
3. Add the server.h header file to the includes at the top of usrAppInit.c.
|
||||||
|
4. Start the server by following the directions in Section 2 for setting up
|
||||||
|
the VxWorks Simulator.
|
||||||
|
5. Start the client on the host machine:
|
||||||
|
./examples/client/client -d
|
||||||
|
The -d option disables peer checks.
|
||||||
|
Note: If there are certificate file errors, the file paths in wolfssl/test.h
|
||||||
|
will need to be adjusted to follow the paths located on the filesystem used
|
||||||
|
by the VxWorks project.
|
||||||
|
####1.3 Necessary Files
|
||||||
The following files are required to replicate this build:
|
The following files are required to replicate this build:
|
||||||
* vxsim\_linux\_1\_0\_2\_2 (directory)
|
* vxsim\_linux\_1\_0\_2\_2 (directory)
|
||||||
* Includes
|
* Includes
|
||||||
@@ -83,20 +122,20 @@ The following files are required to replicate this build:
|
|||||||
* This project was tested with a pre-built image in the VxWorks distribution
|
* This project was tested with a pre-built image in the VxWorks distribution
|
||||||
called vsb\_vxsim\_linux.
|
called vsb\_vxsim\_linux.
|
||||||
|
|
||||||
###VXWORKS SIMULATOR:
|
###2 VXWORKS SIMULATOR:
|
||||||
######The VxWorks simulator was used for testing the wolfSSL example
|
######The VxWorks simulator was used for testing the wolfSSL example
|
||||||
######applications (server, client, benchmark, and test).
|
######applications (server, client, benchmark, and test).
|
||||||
######These are the steps to reproduce this testing method.
|
######These are the steps to reproduce this testing method.
|
||||||
|
|
||||||
In "Open Connection Details" under VxWorks Simulator which is in the connections
|
Go to "Open Connection Details" under VxWorks Simulator which is in the connections
|
||||||
dropdown. After the project has been build, choose the corresponding kernel
|
dropdown. Choose the corresponding kernel image, typically called
|
||||||
image, typically called project/default/VxWorks. Select simnetd from the
|
project/default/VxWorks. Select simnetd from the dropdown and enter
|
||||||
dropdown and enter 192.168.200.1 as the IP address.
|
192.168.200.1 as the IP address.
|
||||||
|
|
||||||
To connect to a server running on the VxWorks Simulator, enter these commands
|
To connect to a server running on the VxWorks Simulator, enter these commands
|
||||||
into the host terminal (for Ubuntu 14.04):
|
into the host terminal (for Ubuntu 14.04):
|
||||||
sudo openvpn --mktun --dev tap0
|
sudo openvpn --mktun --dev tap0
|
||||||
In Wind River directory:
|
In Wind River directory:
|
||||||
vxworks-7/host/x86-linux2/bin/vxsimnetd
|
sudo vxworks-7/host/x86-linux2/bin/vxsimnetd
|
||||||
This will start the vxsimnetd application. Leave it open. The IP address to
|
This will start the vxsimnetd application. Leave it open. The IP address to
|
||||||
connect to the server is the same as above.
|
connect to the server is the same as above.
|
||||||
|
@@ -464,6 +464,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
|||||||
|
|
||||||
StackTrap();
|
StackTrap();
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_VXWORKS
|
||||||
while ((ch = mygetopt(argc, argv,
|
while ((ch = mygetopt(argc, argv,
|
||||||
"?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:aB:"))
|
"?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:aB:"))
|
||||||
!= -1) {
|
!= -1) {
|
||||||
@@ -697,6 +698,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myoptind = 0; /* reset for test cases */
|
myoptind = 0; /* reset for test cases */
|
||||||
|
#endif /* !WOLFSSL_VXWORKS */
|
||||||
|
|
||||||
if (externalTest) {
|
if (externalTest) {
|
||||||
/* detect build cases that wouldn't allow test against wolfssl.com */
|
/* detect build cases that wouldn't allow test against wolfssl.com */
|
||||||
|
@@ -314,6 +314,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
fdOpenSession(Task_self());
|
fdOpenSession(Task_self());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_VXWORKS
|
||||||
while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:ieB:"))
|
while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:ieB:"))
|
||||||
!= -1) {
|
!= -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@@ -494,6 +495,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
myoptind = 0; /* reset for test cases */
|
myoptind = 0; /* reset for test cases */
|
||||||
|
#endif /* !WOLFSSL_VXWORKS */
|
||||||
|
|
||||||
/* sort out DTLS versus TLS versions */
|
/* sort out DTLS versus TLS versions */
|
||||||
if (version == CLIENT_INVALID_VERSION) {
|
if (version == CLIENT_INVALID_VERSION) {
|
||||||
|
Reference in New Issue
Block a user