1- ### wolfSSL with Arduino
1+ # wolfSSL with Arduino
22
3- ##### Reformatting wolfSSL as a compatible Arduino Library
4- This is a shell script that will re-organize the wolfSSL library to be
5- compatible with Arduino projects that use Arduino IDE 1.5.0 or newer.
6- The Arduino IDE requires a library's source files to be in the library's root
7- directory with a header file in the name of the library. This script moves all
8- src/ files to the ` IDE/ARDUINO/wolfSSL/src ` directory and creates a stub header
9- file called ` wolfssl.h ` inside that directory.
3+ Many of the supported boards are natively built-in to the [ Arduino IDE Board Manager] ( https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-board-manager/ )
4+ and by adding [ additional cores] ( https://docs.arduino.cc/learn/starting-guide/cores/ ) as needed.
105
11- Step 1: To configure wolfSSL with Arduino, enter the following from within the
12- wolfssl/IDE/ARDUINO directory:
6+ STM32 Support can be added by including this link in the "Additional Boards Managers URLs" field
7+ from [ stm32duino/Arduino_Core_STM32 ] ( https://github.com/stm32duino/Arduino_Core_STM32?tab=readme-ov-file#getting-started ) .
138
14- `./wolfssl-arduino.sh`
9+ ```
10+ https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
11+ ```
1512
16- Step 2: Copy the directory wolfSSL that was just created to:
17- ` ~/Documents/Arduino/libraries/ ` directory so the Arduino IDE can find it.
13+ ## Using wolfSSL from the Arduino IDE
1814
19- Step 3: Edit ` <arduino-libraries>/wolfSSL/src/user_settings.h `
15+ Coming soon! https://github.com/wolfSSL/arduino-wolfSSL See [ PR #1 ] ( https://github.com/wolfSSL/Arduino-wolfSSL/pull/1 ) .
16+
17+ This option will allow wolfSSL to be installed directly using the native Arduino tools.
18+
19+ ## Manually Reformatting wolfSSL as a Compatible Arduino Library
20+
21+ Use [ this] ( ./wolfssl-arduino.sh ) shell script that will re-organize the wolfSSL library to be
22+ compatible with [ Arduino Library Specification] ( https://arduino.github.io/arduino-cli/0.35/library-specification/ )
23+ for projects that use Arduino IDE 1.5.0 or newer.
24+
25+ The Arduino IDE requires a library's source files to be in the library's root directory with a
26+ header file in the name of the library. This script moves all ` src/ ` files to the ` IDE/ARDUINO/wolfSSL/src `
27+ directory and creates a stub header file called ` wolfssl.h ` inside that directory.
28+
29+ ### Step 1:
30+
31+ To configure wolfSSL with Arduino, enter one of the following commands
32+ from within the ` wolfssl/IDE/ARDUINO ` directory:
33+
34+ 1 . ` ./wolfssl-arduino.sh `
35+ - Creates an Arduino Library directory structure in the local ` wolfSSL ` directory of ` IDE/ARDUINO ` .
36+ - You can add your own ` user_settings.h ` , or copy/rename the [ default] ( ../../examples/configs/user_settings_arduino.h ) .
37+
38+ 2 . ` ./wolfssl-arduino.sh INSTALL ` (The most common option)
39+ - Creates an Arduino Library in the local ` wolfSSL ` directory
40+ - Moves that directory to the Arduino library directory:
41+ - ` $HOME/Arduino/libraries ` for most bash environments
42+ - ` /mnt/c/Users/$USER/Documents/Arduino/libraries ` (for WSL)
43+ - Adds the [ default] ( ../../examples/configs/user_settings_arduino.h ) as ` user_settings.h ` .
44+ - The wolfSSL library is now available from the Arduino IDE.
45+
46+ 3 . ` ./wolfssl-arduino.sh INSTALL /path/to/repository ` (Used to update [ arduino-wolfSSL] ( https://github.com/wolfSSL/arduino-wolfSSL ) )
47+ - Creates an Arduino Library in ` wolfSSL ` directory
48+ - Copies that directory contents to the specified ` /path/to/repository `
49+ - Adds the [ default] ( ../../examples/configs/user_settings_arduino.h ) as ` user_settings.h ` .
50+
51+ 4 . ` ./wolfssl-arduino.sh INSTALL /path/to/any/other/directory `
52+ - Creates an Arduino Library in ` wolfSSL ` directory
53+ - Copies that directory contents to the specified ` /path/to/any/other/directory `
54+
55+ ### Step 2:
56+
57+ Edit ` <arduino-libraries>/wolfSSL/src/user_settings.h `
2058If building for Intel Galileo platform add: ` #define INTEL_GALILEO ` .
21- Add any other custom settings, for a good start see the examples in wolfssl root
22- "/examples/configs/user_settings_ * .h"
59+ Add any other custom settings. For a good start see the examples in wolfssl root
60+ "[ /examples/configs/user_settings_ * .h] ( https://github.com/wolfssl/wolfssl/tree/master/examples/configs ) "
61+
62+ ### Step 3:
2363
24- Step 4: If you experience any issues with custom user_settings.h see the wolfssl
64+ If you experience any issues with custom ` user_settings.h ` see the wolfssl
2565porting guide here for more assistance: https://www.wolfssl.com/docs/porting-guide/
2666
27- Step 5: If you still have any issues contact support@wolfssl.com for more help.
67+ If you have any issues contact support@wolfssl.com for help.
68+
69+ # Including wolfSSL in Arduino Libraries (for Arduino version 2.0 or greater)
70+
71+ 1 . In the Arduino IDE:
72+
73+ The wolfSSL library should automatically be detected when found in the ` libraries `
74+ directory.
75+
76+ - In ` Sketch -> Include Library ` choose wolfSSL for new sketches.
77+
2878
2979##### Including wolfSSL in Arduino Libraries (for Arduino version 1.6.6)
3080
@@ -33,6 +83,73 @@ Step 5: If you still have any issues contact support@wolfssl.com for more help.
3383 ` IDE/ARDUNIO/wolfSSL ` folder.
3484 - In ` Sketch -> Include Library ` choose wolfSSL.
3585
36- 2 . Open an example Arduino sketch for wolfSSL:
37- - wolfSSL Client INO sketch: `sketches/wolfssl_client/wolfssl_client.ino`
38- - wolfSSL Server INO sketch: `sketches/wolfssl_server/wolfssl_server.ino`
86+ ##### wolfSSL Examples
87+
88+ Open an example Arduino sketch for wolfSSL:
89+
90+ - wolfSSL [ Client INO sketch] ( ./sketches/wolfssl_client/README.md ) : ` sketches/wolfssl_client/wolfssl_client.ino `
91+
92+ - wolfSSL [ Server INO sketch] ( ./sketches/wolfssl_server/README.md ) : ` sketches/wolfssl_server/wolfssl_server.ino `
93+
94+ #### Script Examples
95+
96+ Publish wolfSSL from WSL to a repository.
97+
98+ ``` bash
99+ rm -rf /mnt/c/Users/$USER /Documents/Arduino/libraries/wolfSSL
100+ rm -rf /mnt/c/workspace/wolfssl-$USER /IDE/ARDUINO/wolfSSL
101+ ./wolfssl-arduino.sh INSTALL /mnt/c/workspace/Arduino-wolfSSL-$USER /
102+ ```
103+
104+ Publish wolfSSL from WSL to default Windows local library.
105+
106+ ``` bash
107+ rm -rf /mnt/c/Users/$USER /Documents/Arduino/libraries/wolfSSL
108+ rm -rf /mnt/c/workspace/wolfssl-arduino/IDE/ARDUINO/wolfSSL
109+ ./wolfssl-arduino.sh INSTALL
110+ ```
111+
112+ Test the TLS server by running a local command-line client.
113+
114+ ``` bash
115+ cd /mnt/c/workspace/wolfssl-$USER
116+ ./examples/client/client -h 192.168.1.43 -p 11111 -v 3
117+ ```
118+
119+ Build wolfSSL to include wolfSSH support to an alternate development directory.
120+
121+ ``` bash
122+ cd /mnt/c/workspace/wolfssl-$USER
123+ ./configure --prefix=/mnt/c/workspace/wolfssh-$USER /wolfssl_install --enable-ssh
124+ make
125+ make install
126+
127+ ```
128+
129+ Build wolfSSH with wolfSSL not installed to default directory.
130+
131+ ``` bash
132+ cd /mnt/c/workspace/wolfssh-$USER
133+ ./configure --with-wolfssl=/mnt/c/workspace/wolfssh-$USER /wolfssl_install
134+ make
135+ ./examples/client/client -u jill -h 192.168.1.34 -p 22222 -P upthehill
136+ ```
137+
138+ Test the current wolfSSL.
139+
140+ ``` bash
141+ cd /mnt/c/workspace/wolfssl-arduino
142+ git status
143+ ./autogen.sh
144+ ./configure --enable-all
145+ make clean
146+ make && make test
147+ ```
148+
149+ Build and run ` testwolfcrypt ` .
150+
151+ ``` bash
152+ ./autogen.sh
153+ ./configure --enable-all
154+ make clean && make && ./wolfcrypt/test/testwolfcrypt
155+ ```
0 commit comments