Files
wolfssl/IDE/ARDUINO

wolfSSL with Arduino

Many of the supported devices are natively built-in to the Arduino IDE Board Manager and by adding additional cores as needed.

STM32 Support can be added by including this link in the "Additional Boards Managers URLs" field:

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

from stm32duino/Arduino_Core_STM32 .

Reformatting wolfSSL as a compatible Arduino Library

This is a shell script that will re-organize the wolfSSL library to be compatible with Arduino projects that use Arduino IDE 1.5.0 or newer. 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 the library. This script moves all src/ files to the IDE/ARDUINO/wolfSSL/src directory and creates a stub header file called wolfssl.h inside that directory.

Step 1: To configure wolfSSL with Arduino, enter one of the following commands from within the wolfssl/IDE/ARDUINO directory:

  1. ./wolfssl-arduino.sh
    • Creates an Arduino Library in wolfSSL directory 2 ./wolfssl-arduino.sh INSTALL
    • Creates an Arduino Library in wolfSSL directory
    • Moves that directory to the Arduino library directory:
      • $HOME/Arduino/libraries for most bash environments
      • /mnt/c/Users/$USER/Documents/Arduino/libraries (for WSL)
  2. ./wolfssl-arduino.sh INSTALL /path/to/repository
    • Creates an Arduino Library in wolfSSL directory
    • Copies that directory contents to the specified /path/to/repository
  3. ./wolfssl-arduino.sh INSTALL /path/to/any/other/directory
    • Creates an Arduino Library in wolfSSL directory
    • Copies that directory contents to the specified /path/to/repository

Step 2: Edit <arduino-libraries>/wolfSSL/src/user_settings.h If building for Intel Galileo platform add: #define INTEL_GALILEO. Add any other custom settings, for a good start see the examples in wolfssl root "/examples/configs/user_settings_*.h"

Step 3: If you experience any issues with custom user_settings.h see the wolfssl porting guide here for more assistance: https://www.wolfssl.com/docs/porting-guide/

If you have any issues contact support@wolfssl.com for help.

Including wolfSSL in Arduino Libraries (for Arduino version 2.0 or greater)
  1. In the Arduino IDE:

The wolfSSL library should automatically be detected when found in the libraries directory.

- In `Sketch -> Include Library` choose wolfSSL for new sketches.
Including wolfSSL in Arduino Libraries (for Arduino version 1.6.6)
  1. In the Arduino IDE:
    • In Sketch -> Include Library -> Add .ZIP Library... and choose the IDE/ARDUNIO/wolfSSL folder.
    • In Sketch -> Include Library choose wolfSSL.
wolfSSL Examples

Open an example Arduino sketch for wolfSSL:

- wolfSSL Client INO sketch: `sketches/wolfssl_client/wolfssl_client.ino`

- wolfSSL Server INO sketch: `sketches/wolfssl_server/wolfssl_server.ino`

Script Examples

Publish wolfSSL from WSL to a repository.

rm -rf /mnt/c/Users/$USER/Documents/Arduino/libraries/wolfSSL
rm -rf /mnt/c/workspace/wolfssl-$USER/IDE/ARDUINO/wolfSSL
./wolfssl-arduino.sh INSTALL /mnt/c/workspace/Arduino-wolfSSL-$USER/

Publish wolfSSL from WSL to default Windows local library.

rm -rf /mnt/c/Users/$USER/Documents/Arduino/libraries/wolfSSL
rm -rf /mnt/c/workspace/wolfssl-arduino/IDE/ARDUINO/wolfSSL
./wolfssl-arduino.sh INSTALL

Test the TLS server by running a local command-line client.

cd /mnt/c/workspace/wolfssl-$USER
./examples/client/client -h 192.168.1.43 -p 11111 -v 3

Build wolfSSL to include wolfSSH support, but to an alternate development directory.

 cd /mnt/c/workspace/wolfssl-$USER
 ./configure --prefix=/mnt/c/workspace/wolfssh-$USER/wolfssl_install --enable-ssh
 make
 make install

Build wolfSSH with wolfSSL not installed to default directory.

cd /mnt/c/workspace/wolfssh-$USER
./configure --with-wolfssl=/mnt/c/workspace/wolfssh-$USER/wolfssl_install
make
./examples/client/client -u jill -h 192.168.1.34 -p 22222 -P upthehill

Test the current wolfSSL.

cd /mnt/c/workspace/wolfssl-arduino
git status
./autogen.sh
./configure --enable-all
make clean
make && make test

Build and run testwolfcrypt

./autogen.sh
./configure --enable-all
make clean && make && ./wolfcrypt/test/testwolfcrypt