Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix - 95 release 130 fails to compile on arduino esp32 v3 #100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/arduino_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install specific branch of GovoroxSSLClient
run: |
mkdir -p ~/Arduino/libraries
git clone --branch v1.3.0 https://github.com/govorox/SSLClient.git ~/Arduino/libraries/GovoroxSSLClient
git clone --branch 95-release-130-fails-to-compile-on-arduino-esp32-v3 https://github.com/govorox/SSLClient.git ~/Arduino/libraries/GovoroxSSLClient

- name: Install other libs
run: |
Expand All @@ -46,9 +46,9 @@ jobs:
- name: Compile Examples for Arduino-ESP32@2.0.17
run: |
arduino-cli core install esp32:esp32@2.0.17
./.github/workflows/scripts/compile_arduino_examples.sh --clean
./scripts/compile_arduino_examples.sh --clean

# - name: Compile Examples for Arduino-ESP32@3.0.2
# run: |
# arduino-cli core install esp32:esp32@3.0.2
# ./.github/workflows/scripts/compile_arduino_examples.sh --clean
- name: Compile Examples for Arduino-ESP32@3.0.2
run: |
arduino-cli core install esp32:esp32@3.0.2
./scripts/compile_arduino_examples.sh --clean
2 changes: 1 addition & 1 deletion .github/workflows/pio_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:

- name: Compile Examples
run: |
./.github/workflows/scripts/compile_pio_examples.sh --clean
./scripts/compile_pio_examples.sh --clean
12 changes: 0 additions & 12 deletions .github/workflows/scripts/install_sslclient_for_testing.sh

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
lib/*
test.log
emulation.log
compile_errors.log
compile_errors.log
compile_output.txt
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@

*Install via the Arduino IDE or PlatformIO:*

**Arduino IDE** - search for `GovoroxSSLClient` inthe library manager (for now, ensure esp32 boards are installed to version `2.0.17` and no higher)
**Arduino IDE** - search for `GovoroxSSLClient` in the library manager.

**PlatformIO** - add `digitaldragon/SSLClient@^1.3.0` to `platformio.ini`
**PlatformIO** - add `digitaldragon/SSLClient@^1.3.1` to `platformio.ini`.

## 🚀 Overview

Originally based on the `WiFiClientSecure` for Arduino-ESP32 the SSLClient extends the ESP32/Arduino ecosystem to secure communication via TLS, providing a transparent SSL/TLS layer over any `Client` class instance. Leverages *mbedtls* for robust, efficient cryptographic operations, initially tailored for ESP32 but adaptable across platforms.

## 🌟 What's New in the Latest Release

- **Examples for PlatformIO and Arduino IDE**: Updated examples to work with both PlatformIO and Arduino IDE for both Arduino-ESP32@2.0.17 and Arduino-ESP32@>3.0.0.

- **Major Versions 2 and 3 of MBedTLS**: Updated to support the latest version of the MBedTLS library.

- **Feature flag for compatibility with MbedTLS v3.x.x** - Automated by `MBEDTLS_VERSION_MAJOR`.
Expand All @@ -63,8 +65,6 @@ Originally based on the `WiFiClientSecure` for Arduino-ESP32 the SSLClient exten

- **Add GitHub Actions workflow** to ensure Arduino IDE compile.

- **Fix Arduino IDE examples to compile** when using `arduino-esp32@2.0.17` - This is still broken for `@3.0.2`. There is a breaking change in `arduino-esp32` from `v3.0.0` which is causing ambiguous reference errors to byte.

## ✨ Features

- Secure TLS communication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,70 @@
* ESP32 LilyGo-T-ETH-POE Example
*
* HTTPS (TLS/SLL) with CA Certificate via "ETH.h"
* This example use the WiFiClient class to integrate ETH functionality
* This example uses the WiFiClient class to integrate ETH functionality
*
* About board: https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-POE
* Base example: https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-POE/blob/master/example/eth/eth.ino
*
**************************************************************/
// To make HTTP request easy: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include <ETH.h>
#include "WiFi.h"
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>

//Please enter your CA certificate in ca_cert.h
// Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"

//ESP32 LilyGo-T-ETH-POE Board Ethernet pins definition
// ESP32 LilyGo-T-ETH-POE Board Ethernet pins definition
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_POWER_PIN -1
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_ADDR 0
#define ETH_ADDR 1 // Update this according to the required value for v3.x.x and 0 for v2.x.x
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18

const char hostname[] = "www.howsmyssl.com";
int port = 443;

//Layers stack
WiFiClient eth_transpor_layer;
SSLClient secure_presentation_layer(&eth_transpor_layer);
// Layers stack
WiFiClient eth_transport_layer;
SSLClient secure_presentation_layer(&eth_transport_layer);
HttpClient http_client = HttpClient(secure_presentation_layer, hostname, port);

static bool eth_connected = false;

//Ethernet events
// Ethernet events
#if ESP_ARDUINO_VERSION_MAJOR >= 3
void ETHEvent(WiFiEvent_t event, WiFiEventInfo_t info)
#else
void ETHEvent(WiFiEvent_t event)
#endif
{
switch (event)
{
#if ESP_ARDUINO_VERSION_MAJOR >= 3
case ARDUINO_EVENT_ETH_START:
#else
case SYSTEM_EVENT_ETH_START:
#endif
Serial.println("ETH Started");
ETH.setHostname("esp32-ethernet");
break;

#if ESP_ARDUINO_VERSION_MAJOR >= 3
case ARDUINO_EVENT_ETH_CONNECTED:
#else
case SYSTEM_EVENT_ETH_CONNECTED:
#endif
Serial.println("ETH Connected");
break;

#if ESP_ARDUINO_VERSION_MAJOR >= 3
case ARDUINO_EVENT_ETH_GOT_IP:
#else
case SYSTEM_EVENT_ETH_GOT_IP:
#endif
Serial.print("ETH MAC: ");
Serial.print(ETH.macAddress());
Serial.print(", IPv4: ");
Expand All @@ -62,14 +80,25 @@ void ETHEvent(WiFiEvent_t event)
Serial.println("Mbps");
eth_connected = true;
break;

#if ESP_ARDUINO_VERSION_MAJOR >= 3
case ARDUINO_EVENT_ETH_DISCONNECTED:
#else
case SYSTEM_EVENT_ETH_DISCONNECTED:
#endif
Serial.println("ETH Disconnected");
eth_connected = false;
break;

#if ESP_ARDUINO_VERSION_MAJOR >= 3
case ARDUINO_EVENT_ETH_STOP:
#else
case SYSTEM_EVENT_ETH_STOP:
#endif
Serial.println("ETH Stopped");
eth_connected = false;
break;

default:
break;
}
Expand All @@ -81,15 +110,19 @@ void setup()

Serial.println("Starting ETH");
WiFi.onEvent(ETHEvent);
#if ESP_ARDUINO_VERSION_MAJOR >= 3
ETH.begin(ETH_TYPE, ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_CLK_MODE);
#else
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
#endif
while (!eth_connected)
{
Serial.println("connecting to ETH..");
Serial.println("Connecting to ETH..");
delay(1000);
}
Serial.println("Connected");

//Add CA Certificate
// Add CA Certificate
secure_presentation_layer.setCACert(root_ca);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/blob/master/examples/Arduino_Azure_IoTHub/Arduino_Azure_IoTHub.ino
*
**************************************************************/
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* Base example: https://github.com/Xinyuan-LilyGO/LilyGo-T-Call-SIM800/tree/master/examples/Arduino_TinyGSM
*
**************************************************************/
#include <Wire.h>
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include <Wire.h>
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"
Expand Down
4 changes: 2 additions & 2 deletions examples/Esp32-Arduino-IDE/https_wifi/https_wifi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
**************************************************************/

#include "WiFi.h"
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include "WiFi.h"
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "secrets.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ lib_deps =
vshymanskyy/TinyGSM@^0.11.7
vshymanskyy/StreamDebugger@^1.0.1
; digitaldragon/SSLClient@^1.2.0
https://github.com/govorox/SSLClient#v1.3.0
https://github.com/govorox/SSLClient#95-release-130-fails-to-compile-on-arduino-esp32-v3
arduino-libraries/ArduinoHttpClient@^0.6.0
build_flags =
-I include
Expand All @@ -37,3 +37,21 @@ board = esp32doit-devkit-v1

[env:esp-wrover-kit]
board = esp-wrover-kit

[env:esp32dev-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32dev

[env:esp32doit-devkit-v1-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32doit-devkit-v1

[env:esp-wrover-kit-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp-wrover-kit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <ArduinoHttpClient.h>
#include "ca_cert.h"
#include <Wire.h>
#include <string>

#define MODEM_UART_BAUD 115200
#define MODEM_RST 5
Expand Down Expand Up @@ -165,7 +166,7 @@ void loop() {
serialMonitor.println("GPRS disconnected");
digitalWrite(LED_PIN, LOW);

//Turn off the moden (if use, you need run setupModem() again)
//Turn off the modem (if use, you need run setupModem() again)
//modem.poweroff();
//serialMonitor.println("Modem poweroff");
//delay(1000);
Expand Down
25 changes: 22 additions & 3 deletions examples/Esp32-platformIO/t-call-esp32-sim800l-aws/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
platform = espressif32
framework = arduino
lib_deps =
arduino-libraries/ArduinoHttpClient@^0.6.0
vshymanskyy/TinyGSM@^0.11.7
knolleary/PubSubClient@^2.8
vshymanskyy/StreamDebugger@^1.0.1
; digitaldragon/SSLClient@^1.2.0
https://github.com/govorox/SSLClient#v1.3.0
arduino-libraries/ArduinoHttpClient@^0.6.0
https://github.com/govorox/SSLClient#95-release-130-fails-to-compile-on-arduino-esp32-v3
build_flags =
-I include
-D CORE_DEBUG_LEVEL=3
Expand All @@ -33,4 +33,23 @@ board = esp32dev
board = esp32doit-devkit-v1

[env:esp-wrover-kit]
board = esp-wrover-kit
board = esp-wrover-kit

[env:esp32dev-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32dev

[env:esp32doit-devkit-v1-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32doit-devkit-v1

[env:esp-wrover-kit-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp-wrover-kit

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <Arduino.h>
#include <SSLClient.h>
#include <ArduinoHttpClient.h>
#include <Wire.h>
#include <PubSubClient.h>
#include <SSLClient.h>
#include <Wire.h>
#include <time.h>
#include <sys/time.h>
#include "ca_cert.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ board_build.embed_files = data/crt/x509_crt_bundle.bin
lib_deps =
vshymanskyy/TinyGSM@^0.11.7
; digitaldragon/SSLClient@^1.2.0
https://github.com/govorox/SSLClient#v1.3.0
https://github.com/govorox/SSLClient#95-release-130-fails-to-compile-on-arduino-esp32-v3

[env:esp32dev]
board = esp32dev
Expand All @@ -34,6 +34,24 @@ board = esp32doit-devkit-v1
[env:esp-wrover-kit]
board = esp-wrover-kit

[env:esp32dev-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32dev

[env:esp32doit-devkit-v1-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp32doit-devkit-v1

[env:esp-wrover-kit-framework-v3]
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
board = esp-wrover-kit

; Microcontroller config (ESP32-WROVER-E with 4MB Flash)
board_build.f_flash = 80000000L
board_upload.flash_size = 4MB
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SSLClient",
"version": "1.3.0",
"version": "1.3.1",
"repository":
{
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GovoroxSSLClient
version=1.3.0
version=1.3.1
author=V Govorovski
maintainer=Robert Byrnes <robbyrnes@hotmail.co.uk>
sentence=Provides secure network connection over a generic Client transport object.
Expand Down
Loading
Loading