wolfSSL / Arduino-wolfSSL

This repository is a restructured copy of https://github.com/wolfSSL/wolfssl/ for the Arduino environment. Any Pull Requests for code changes should be opened there.
https://www.wolfssl.com
GNU General Public License v2.0
11 stars 7 forks source link

wolfSSL v5.7.0 for Arduino #6

Closed gojimmypi closed 7 months ago

gojimmypi commented 7 months ago

This is the restructured wolfSSL v5.7.0 Release for the Arduino format libraries.

The TL;DR for updating this repository from wolfSSL is to run wolfssl-arduino.sh found in IDE/ARDUINO:

./wolfssl-arduino.sh INSTALL /mnt/c/workspace/Arduino-wolfSSL-$USER

Before proceeding, ensure that the downloaded wolfSSL from the Arduino IDE is not already installed.

Prepare Arduino-wolfSSL

Ensure there's an upstream remote, local master is updated, and create a branch.

# Change to the local Arduino-wolfSSL fork of Arduino-wolfSSL
cd /mnt/c/workspace/Arduino-wolfSSL-$USER

git remote add upstream https://github.com/wolfSSL/Arduino-wolfSSL.git
git checkout main
git fetch upstream main
git pull upstream main

git checkout -b Arduino-5.7.0

At this point, consider manually deleting everything but the .git directory as well as .gitignore and .editorconfig files in the /mnt/c/workspace/Arduino-wolfSSL-$USER directory.

Update Arduino-wolfSSL from wolfSSL

cd /mnt/c/workspace

# Fetch a new wolfSSL repository if needed
git clone https://github.com/wolfSSL/wolfssl.git wolfssl-master

cd wolfssl-master

# If there's already a local clone:
git fetch
git pull

cd ./IDE/ARDUINO

# Consider testing locally:
# Remove any wolfssl temp directory in ./IDE/ARDUINO
rm -rf ./wolfssl

# Delete the existing Arduino library, in this case from Windows / WSL:
rm -rf /mnt/c/Users/$USER/Documents/Arduino/libraries/wolfssl

# Switch to release branch
git checkout v5.7.0-stable

# Edit  ../../examples/configs/user_settings_arduino.h
# Ensure there's an accurate string for WOLFSSL_USER_SETTINGS_ID
# #define WOLFSSL_USER_SETTINGS_ID "Arduino user_settings.h v5.7.0"

# Check for clean library. The only change might be the user_ettings string:_
git diff

# Edit the install script and make any adjustments needed to the
# WOLFSSL_VERSION_ARUINO_SUFFIX option. For blank strings, use ""
# WOLFSSL_VERSION_ARUINO_SUFFIX=""

# Install local library
./wolfssl-arduino.sh INSTALL

Confirm output looks like this:

gojimmypi:/mnt/c/workspace/wolfssl-master/IDE/ARDUINO
$ ./wolfssl-arduino.sh INSTALL
The Arduino library root is: /mnt/c/Users/gojimmypi/Documents/Arduino/libraries
Install is active.
Found wolfSSL version 5.7.0
# WOLFSSL_VERSION_ARUINO_SUFFIX

Step 01: mkdir ./wolfssl
Step 02: mkdir ./wolfssl/src
Step 03: mkdir ./wolfssl/src/wolfssl
Step 04: cp    ../../wolfssl/*.h              ./wolfssl/src/wolfssl
Step 05: mkdir ./wolfssl/src/wolfssl/wolfcrypt
Step 06: cp    ../../wolfssl/wolfcrypt/*.h    ./wolfssl/src/wolfssl/wolfcrypt
Step 07: mkdir ./wolfssl/src/wolfcrypt
Step 08: mkdir ./wolfssl/src/wolfcrypt/src
Step 09: cp    ../../wolfcrypt/src/*.c        ./wolfssl/src/wolfcrypt/src
Step 10: mkdir ./wolfssl/src/src
Copy examples....
Copy wolfssl_client example....
Copy wolfssl_server example....
Copy wolfssl_server example....
Step 11: Final root file copy
Step 12: Workspace to publish:

# Arduino wolfSSL Library

This library is restructured from [wolfSSL](https://github.com/wolfSSL/wolfssl/) Release 5.7.0 for the Arduino platform.

total 320
drwxr-xr-x 1 gojimmypi gojimmypi    512 Mar 21 09:04 .
drwxrwxrwx 1 gojimmypi gojimmypi    512 Mar 21 09:04 ..
-rwxr-xr-x 1 gojimmypi gojimmypi    173 Mar 21 09:04 .editorconfig
-rwxr-xr-x 1 gojimmypi gojimmypi  10442 Mar 21 09:04 .gitignore
-rwxr-xr-x 1 gojimmypi gojimmypi  18092 Mar 21 09:04 COPYING
-rwxr-xr-x 1 gojimmypi gojimmypi 261674 Mar 21 09:04 ChangeLog.md
-rwxr-xr-x 1 gojimmypi gojimmypi    469 Mar 21 09:04 LICENSING
-rwxr-xr-x 1 gojimmypi gojimmypi  11375 Mar 21 09:04 README
-rw-r--r-- 1 gojimmypi gojimmypi  14731 Mar 21 09:04 README.md
drwxr-xr-x 1 gojimmypi gojimmypi    512 Mar 21 09:04 examples
-rwxr-xr-x 1 gojimmypi gojimmypi    623 Mar 21 09:04 keywords.txt
-rw-r--r-- 1 gojimmypi gojimmypi    373 Mar 21 09:04 library.properties
drwxr-xr-x 1 gojimmypi gojimmypi    512 Mar 21 09:04 src

Config:
cp ../../examples/configs/user_settings_arduino.h  ./wolfssl/src/user_settings.h
#define WOLFSSL_USER_SETTINGS_ID "Arduino user_settings.h v5.7.0"

Install:
mv ./wolfssl /mnt/c/Users/gojimmypi/Documents/Arduino/libraries
Arduino wolfSSL Version: 5.7.0
Done!
gojimmypi:/mnt/c/workspace/wolfssl-master/IDE/ARDUINO
$

There are several examples including the wolfssl_client, wolfssl_server and a bare-bones wolfssl_version that checks the library and prints wolfSSL version.

If all is working, proceed to update:

Publish Update

cd /mnt/c/workspace/wolfssl-master/IDE/ARDUINO

# Remove any wolfssl temp directory in ./IDE/ARDUINO
rm -rf ./wolfssl

# Do this to then test the download from Arduino IDE:
# Delete the existing Arduino library, in this case from Windows / WSL:
rm -rf /mnt/c/Users/$USER/Documents/Arduino/libraries/wolfssl

# Publish wolfSSL
./wolfssl-arduino.sh INSTALL /mnt/c/workspace/Arduino-wolfSSL-$USER

Confirm the version=5.7.0 value in the library.properties has been set. This should have been done automatically.