diff --git a/.github/workflows/arduino_examples.yml b/.github/workflows/arduino_examples.yml
new file mode 100644
index 0000000..75ca1cf
--- /dev/null
+++ b/.github/workflows/arduino_examples.yml
@@ -0,0 +1,50 @@
+name: Build Arduino Examples
+
+on: [pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.8'
+
+ - name: Install pyserial
+ run: python3 -m pip install pyserial
+
+ - name: Install Arduino CLI
+ uses: arduino/setup-arduino-cli@v2
+
+ - name: Install Arduino Cores
+ run: |
+ arduino-cli config init
+ arduino-cli core update-index
+ arduino-cli core install arduino:avr
+
+ - 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
+
+ - name: Install other libs
+ run: |
+ arduino-cli lib install "WiFi"
+ arduino-cli lib install "ArduinoHttpClient"
+ arduino-cli lib install "PubSubClient"
+ arduino-cli lib install "TinyGSM"
+
+ - 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
+
+ # - 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
diff --git a/.github/workflows/ci_master.yml b/.github/workflows/ci_master.yml
index e377f84..ff4fff3 100644
--- a/.github/workflows/ci_master.yml
+++ b/.github/workflows/ci_master.yml
@@ -1,10 +1,14 @@
-name: Run PlatformIO Tests
+name: Run Unit Tests
on:
- pull_request:
+ push:
branches:
- master
- 'v[0-9]+.[0-9]+.[0-9]+'
+ pull_request:
+ branches:
+ - master
+ workflow_dispatch:
jobs:
test:
@@ -23,5 +27,26 @@ jobs:
run: |
pip install platformio
- - name: Run tests
+ - name: Set Environment MBEDTLS_VERSION_MAJOR Variable
+ run: echo "MBEDTLS_VERSION_MAJOR=3" >> $GITHUB_ENV
+
+ - name: Run tests - First Batch
+ run: pio test -e native -vvv
+
+ - name: Clean up - First Batch
+ run: pio run -t clean
+
+ - name: Set Environment MBEDTLS_BACKPORT Variable
+ run: echo "MBEDTLS_BACKPORT=true" >> $GITHUB_ENV
+
+ - name: Run tests - Second Batch
+ run: pio test -e native -vvv
+
+ - name: Clean up - Second Batch
+ run: pio run -t clean
+
+ - name: Set Environment W5500_WORKAROUND Variable
+ run: echo "W5500_WORKAROUND=true" >> $GITHUB_ENV
+
+ - name: Run tests - Third Batch
run: pio test -e native -vvv
diff --git a/.github/workflows/pio_examples.yml b/.github/workflows/pio_examples.yml
new file mode 100644
index 0000000..e8495cc
--- /dev/null
+++ b/.github/workflows/pio_examples.yml
@@ -0,0 +1,25 @@
+name: Build PlatformIO Examples
+
+on: [pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.8'
+
+ - name: Install PlatformIO
+ run: |
+ python -m pip install --upgrade pip
+ pip install platformio
+
+ - name: Compile Examples
+ run: |
+ ./.github/workflows/scripts/compile_pio_examples.sh --clean
diff --git a/.github/workflows/scripts/compile_arduino_examples.sh b/.github/workflows/scripts/compile_arduino_examples.sh
new file mode 100755
index 0000000..17909e7
--- /dev/null
+++ b/.github/workflows/scripts/compile_arduino_examples.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/bash
+
+ROOT_DIR=$(pwd)
+CLEAN=false
+BOARDS=("esp32:esp32:esp32doit-devkit-v1" "esp32:esp32:esp32wroverkit")
+
+# Parse command line options
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ --clean) CLEAN=true ;;
+ *) echo "Unknown parameter passed: $1"; exit 1 ;;
+ esac
+ shift
+done
+
+# Initialize results array
+declare -A RESULTS
+EXIT_STATUS=0
+
+# Function to compile the example for a specific board
+compile_example() {
+ local example_dir=$1
+ local board=$2
+ local example_name
+ example_name=$(basename "$example_dir")
+ echo "Compiling example in directory: $example_dir for board: $board"
+
+ cd "$example_dir" || exit 1
+
+ arduino-cli compile --clean --fqbn "$board" . || {
+ echo "Compilation failed for $example_dir for board: $board" >> "$ROOT_DIR/compile_errors.log"
+ RESULTS["$example_name,$board"]="Failed"
+ EXIT_STATUS=1
+ return 1
+ }
+
+ echo "Compilation successful for $example_dir for board: $board"
+ RESULTS["$example_name,$board"]="Passed"
+}
+
+# Function to clean the example
+clean_example() {
+ local example_dir=$1
+ echo "Cleaning example in directory: $example_dir"
+
+ cd "$example_dir" || exit 1
+
+ arduino-cli cache clean || {
+ echo "Cleaning failed for $example_dir"
+ return 1
+ }
+
+ echo "Cleaning successful for $example_dir"
+
+ # Remove build directory if --clean option is passed
+ if [ "$CLEAN" = true ]; then
+ echo "Removing build directory in $example_dir"
+ rm -rf build
+ fi
+
+ cd "$ROOT_DIR" || exit 1
+}
+
+rm -f "$ROOT_DIR/compile_errors.log"
+
+# compile_example "$ROOT_DIR"/examples/Esp32-Arduino-IDE/https_post_sim7600/ "esp32:esp32:esp32wroverkit"
+
+# Iterate over each example directory
+for example_dir in "$ROOT_DIR"/examples/Esp32-Arduino-IDE/*/; do
+ echo "$example_dir"
+ # Check if the directory contains a .ino file
+ if [ -f "$example_dir"/*.ino ]; then
+ for board in "${BOARDS[@]}"; do
+ compile_example "$example_dir" "$board"
+ done
+
+ clean_example "$example_dir"
+ else
+ echo "Skipping directory $example_dir (no .ino file found)"
+ fi
+done
+
+# Generate summary
+echo "Compilation Summary:"
+echo "===================="
+for key in "${!RESULTS[@]}"; do
+ IFS=',' read -r example_name board <<< "$key"
+ echo "Example: $example_name, Board: $board, Result: ${RESULTS[$key]}"
+done
+
+echo "All examples processed. Check compile_errors.log for any compilation errors."
+
+exit $EXIT_STATUS
diff --git a/.github/workflows/scripts/compile_pio_examples.sh b/.github/workflows/scripts/compile_pio_examples.sh
new file mode 100755
index 0000000..8b15cb8
--- /dev/null
+++ b/.github/workflows/scripts/compile_pio_examples.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/bash
+
+# Set the root directory containing the example directories
+ROOT_DIR=$(pwd)
+CLEAN=false
+
+# Boards to test
+BOARDS=("esp32dev" "esp32doit-devkit-v1" "esp-wrover-kit")
+
+# Parse command line options
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ --clean) CLEAN=true ;;
+ *) echo "Unknown parameter passed: $1"; exit 1 ;;
+ esac
+ shift
+done
+
+# Initialize results array
+declare -A RESULTS
+
+# Function to compile the example for a specific board
+compile_example() {
+ local example_dir=$1
+ local board=$2
+ local example_name
+ example_name=$(basename "$example_dir")
+ echo "Compiling example in directory: $example_dir for board: $board"
+
+ # Change to the example directory
+ cd "$example_dir" || exit 1
+
+ # Check if the board environment is defined in platformio.ini
+ if ! grep -q "\[env:$board\]" platformio.ini; then
+ echo "Environment for board $board not defined in $example_dir/platformio.ini"
+ RESULTS["$example_name,$board"]="Failed (environment not defined)"
+ return 1
+ fi
+
+ # Compile the example using platformio
+ pio run -e "$board"
+
+ # Check if compilation was successful
+ if [ $? -ne 0 ]; then
+ echo "Compilation failed for $example_dir for board: $board" >> "$ROOT_DIR/compile_errors.log"
+ RESULTS["$example_name,$board"]="Failed"
+ return 1
+ fi
+
+ echo "Compilation successful for $example_dir for board: $board"
+ RESULTS["$example_name,$board"]="Passed"
+}
+
+# Function to clean the example
+clean_example() {
+ local example_dir=$1
+ echo "Cleaning example in directory: $example_dir"
+
+ # Change to the example directory
+ cd "$example_dir" || exit 1
+
+ # Clean the example using platformio
+ if [ -f "platformio.ini" ]; then
+ pio run --target clean
+ else
+ echo "No recognized build system (platformio.ini) found in $example_dir"
+ return 1
+ fi
+
+ echo "Cleaning successful for $example_dir"
+
+ # Remove .pio directory if --clean option is passed
+ if [ "$CLEAN" = true ]; then
+ echo "Removing .pio directory in $example_dir"
+ rm -rf .pio
+ fi
+
+ # Return to the root directory
+ cd "$ROOT_DIR" || exit 1
+}
+
+# Remove previous log file
+rm -f "$ROOT_DIR/compile_errors.log"
+
+# Iterate over each example directory
+for example_dir in "$ROOT_DIR"/examples/Esp32-platformIO/*/; do
+ echo "$example_dir"
+ # Check if the directory contains platformio.ini
+ if [ -f "$example_dir/platformio.ini" ]; then
+ for board in "${BOARDS[@]}"; do
+ compile_example "$example_dir" "$board"
+ done
+
+ # Clean the example after all board-specific compilations are complete
+ clean_example "$example_dir"
+ else
+ echo "Skipping directory $example_dir (no recognized build files)"
+ fi
+done
+
+# Generate summary
+echo "Compilation Summary:"
+echo "===================="
+for key in "${!RESULTS[@]}"; do
+ IFS=',' read -r example_name board <<< "$key"
+ echo "Example: $example_name, Board: $board, Result: ${RESULTS[$key]}"
+done
+
+echo "All examples processed. Check compile_errors.log for any compilation errors."
diff --git a/.github/workflows/scripts/install_sslclient_for_testing.sh b/.github/workflows/scripts/install_sslclient_for_testing.sh
new file mode 100755
index 0000000..ee7443f
--- /dev/null
+++ b/.github/workflows/scripts/install_sslclient_for_testing.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/bash
+
+rm -rf ~/SSLClient
+git clone https://github.com/govorox/SSLClient.git ~/SSLClient
+cd ~/SSLClient
+git checkout v1.3.0
+mkdir -p SSLClient
+mv LICENSE library.properties src SSLClient/
+zip -r SSLClient.zip SSLClient
+mkdir -p ~/.arduino15
+echo -e "library:\n enable_unsafe_install: true" > ~/.arduino15/arduino-cli.yaml
+arduino-cli lib install --config-file ~/.arduino15/arduino-cli.yaml --zip-path SSLClient.zip
diff --git a/.github/workflows/scripts/test_arduino_platform.sh b/.github/workflows/scripts/test_arduino_platform.sh
new file mode 100755
index 0000000..0d1b816
--- /dev/null
+++ b/.github/workflows/scripts/test_arduino_platform.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+# Function to list installed libraries
+list_installed_libs() {
+ echo "Listing installed libraries..."
+ arduino-cli lib list
+}
+
+# Function to list installed platforms
+list_installed_platforms() {
+ echo "Listing installed platforms..."
+ arduino-cli core list
+}
+
+# Function to list installed frameworks for boards
+list_installed_frameworks() {
+ echo "Listing installed frameworks for boards..."
+ arduino-cli board listall
+}
+
+# Function to switch to a specific ESP32-Arduino version
+switch_esp32_version() {
+ local version=$1
+ echo "Switching to ESP32-Arduino version $version..."
+ arduino-cli core install esp32:esp32@$version
+}
+
+# Check if arduino-cli is installed
+if ! command -v arduino-cli &> /dev/null; then
+ echo "arduino-cli could not be found, please install it first."
+ exit 1
+fi
+
+# Main script
+echo "Arduino CLI Utility Script"
+echo "1. List installed libraries"
+echo "2. List installed platforms"
+echo "3. List installed frameworks for boards"
+echo "4. Switch ESP32-Arduino version"
+echo "5. Exit"
+
+while true; do
+ read -p "Please select an option (1-5): " option
+ case $option in
+ 1)
+ list_installed_libs
+ ;;
+ 2)
+ list_installed_platforms
+ ;;
+ 3)
+ list_installed_frameworks
+ ;;
+ 4)
+ read -p "Enter the ESP32-Arduino version to switch to (e.g., 2.0.17 or 3.0.0): " version
+ switch_esp32_version $version
+ ;;
+ 5)
+ echo "Exiting..."
+ exit 0
+ ;;
+ *)
+ echo "Invalid option, please try again."
+ ;;
+ esac
+done
diff --git a/.gitignore b/.gitignore
index ef916ab..737c6d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
.vscode/
lib/*
test.log
-emulation.log
\ No newline at end of file
+emulation.log
+compile_errors.log
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 4a35b28..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,12 +0,0 @@
-SSL Client Updates:
-
-1. Added some commits of WifiSecureClient to fix some bugs.
-2. Change send_ssl_data to use size_t instead of uint16_t, commit a299ddc
-3. ssl_client.cpp: Fix parameter name in _handle_error, commit : 39155e7
-4. Fix memory leaks when SSL/TLS connection fails, commit : f29f448
-5. Fix buffer issue when writing data larger than receiving buffer, commit: 4ce6c5f
-6. Fix issue where client read timeout value not being set, commit: 59ae9f0
-7. Add clarity to return values for start_ssl_client and fix early termination of ssl client, commit: cc40266
-8. Close issue [#30](https://github.com/govorox/SSLClient/issues/30), commit: e426936
-9. Separate concerns from start_ssl_client into singly responsible functions and unit test private API, commit: 0f1fa36
-10. Close issue [#60](https://github.com/govorox/SSLClient/issues/60), Naming collision changes to make compatibile compilation with WiFiClientSecure, commit: b8a9e7e
\ No newline at end of file
diff --git a/README.md b/README.md
index 698bb71..7b67f70 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# SSLClient Library for Arduino and ESP
+
[](https://github.com/govorox/SSLClient "Go to GitHub repo")
[](https://github.com/govorox/SSLClient)
[](https://github.com/govorox/SSLClient)
@@ -7,43 +8,89 @@
[](#license)
[](https://github.com/govorox/SSLClient/issues)
-#### Available on PlatformIO registry as digitaldragon/SSLClient
-[](https://registry.platformio.org/libraries/digitaldragon/SSLClient "Go to PlatformIO Registry")
+## Table of Contents
+
+1. [Installation](#-installation) - How to install the library using Arduino or PlatformIO.
+2. [Overview of this Library](#-overview) - An overview of the SSLClient library.
+3. [What's New](#-whats-new-in-the-latest-release) - The latest features and updates.
+4. [Features](#-features) - Key features of the SSLClient library.
+5. [Usage](#-usage) - Basic usage examples for the SSLClient library.
+6. [Overview of Functions](docs/FUNCTIONS.md) - An overview of the API for leveraging MbedTLS.
+7. [Contribute](docs/CONTRIBUTING.md) - Contributions are welcome!
+8. [Change Log](docs/CHANGELOG.md) - See what's new in each release.
+9. [Code Guide](docs/CODEGUIDE.md) - Guidelines for contributing to the project.
+10. [Signal Strength Map](docs/RSSI.md) - Useful for debugging GSM connectivity.
+11. [License](#-license) - The license for the SSLClient library (open-source).
+
+## 🔧 Installation
+
+
-#### Available on Arduino Libraries registry to digitaldragon/GovoroxSSLClient
-[](https://www.arduinolibraries.info/libraries/govorox-ssl-client "Go to Arduino Libraries")
+*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)
+
+**PlatformIO** - add `digitaldragon/SSLClient@^1.3.0` to `platformio.ini`
## 🚀 Overview
-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.
-Based on the [WiFiClientSecure](https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFiClientSecure) for Arduino/ESP32.
+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
+
+- **Major Versions 2 and 3 of MBedTLS**: Updated to support the latest version of the MBedTLS library.
-## 🌟 What's New
-**ALPN Support**: Application Layer Protocol Negotiation for efficient server communication.
-**Cert Bundles**: Simplifies management and use of multiple CA certificates.
-**Bug Fix**: Corrects byte calculation for record expansion post-handshake.
-**More Examples**: Examples for the ESP32 PlatformIO for ALPN protocols, AWS, and using certificate bundles.
+- **Feature flag for compatibility with MbedTLS v3.x.x** - Automated by `MBEDTLS_VERSION_MAJOR`.
-### For more details, see the [CHANGELOG](CHANGELOG.md).
+- **Add Flag `MBEDTLS_BACKPORT`** to allow override `MBEDTLS_VERSION_MAJOR >= 3`.
+
+- **Add workaround for W5500 Ethernet failing** due to client returning -1 when no error - switch on flag `W5500_WORKAROUND`.
+
+- **Close the following issues:** Support for ESP32 and W5500 based Secure Ethernet for HTTPS or MQTTS? [#44](https://github.com/govorox/SSLClient/issues/85) and issue SSLClient with W5500 not working (works well with WiFi and TinyGSM) [#85](https://github.com/govorox/SSLClient/issues/85).
+
+- **Improve documentation**
+
+- **Add GitHub Actions workflow** to ensure PlatformIO examples compile.
+
+- **Update GitHub Actions workflow** to run tests multiple times with feature flags set.
+
+- **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.
-- Based on mbedtls.
-- Compatible with Arduino/ESP32 and potentially other platforms.
+- Based on **Mbed-TLS/mbedtls**.
+ - **Mbed TLS 2.x**
+ TLS Versions Supported: **Mbed TLS 2.x** supports `TLS 1.0`, `TLS 1.1`, and `TLS 1.2`.
+ **Specifics:**
+ `TLS 1.2`: Full support with a wide range of cipher suites and features.
+ `TLS 1.1` and `1.0`: These versions are supported, but their use is discouraged due to security vulnerabilities and weaknesses compared to `TLS 1.2`.
+ - **Mbed TLS 3.x**
+ TLS Versions Supported: **Mbed TLS 3.x** supports `TLS 1.2` and `TLS 1.3`.
+ **Specifics:**
+ `TLS 1.2`: Continues full support with extensive cipher suites and features.
+ `TLS 1.3`: Introduced in Mbed `TLS 3.x`, providing enhanced security features, improved performance, and simplified handshake process.
+- Compatible with Arduino-ESP32 and potentially other platforms.
- Suitable for IoT applications, including AWS IoT.
-## 🔧 Installation
-Install via the Arduino Library Manager or PlatformIO:
-
-Arduino IDE: Search for "SSLClient".
-PlatformIO: Add `digitaldragon/SSLClient@^1.2.0` to platformio.ini.
-
## 🛠Usage
+
### Basic Connection
+
```cpp
#include
// Initialize your transport layer (e.g., WiFi, GSM)
+// A Client is anything which inherits from the Arduino Client class.
Client transport = /* Your transport layer */;
// Create SSLClient instance
@@ -53,6 +100,7 @@ SSLClient sslClient(&transport);
```
### AWS IoT Connectivity
+
```cpp
TinyGsmClient transport(modem);
SSLClient secure(&transport);
@@ -66,67 +114,7 @@ secure.setPrivateKey(AWS_CERT_PRIVATE);
MQTTClient mqtt = MQTTClient(256);
mqtt.begin(AWS_IOT_ENDPOINT, 8883, secure);
```
-### 📚 Application Notes
-The `SSLClient.cpp` file provides a comprehensive suite of functions for handling SSL/TLS connections in an Arduino environment, particularly for the ESP32. These functions can be categorized into several key areas of functionality, which are essential for understanding the library's capabilities. Here's a user guide to the functionality based on the documentation blocks of these functions:
-
-### Error Handling
-- **`_handle_error(int err, const char* function, int line)`**: This function is used internally to handle errors. It interprets the error code returned by various SSL operations and logs it for debugging purposes.
-
-### Network Communication
-- **`client_net_recv(void *ctx, unsigned char *buf, size_t len)`**: Receives data over an established SSL connection. It checks for a valid client context and returns the number of bytes received or an error code.
-- **`client_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout)`**: Similar to `client_net_recv`, but with an additional timeout parameter. It's useful for non-blocking operations.
-- **`client_net_send(void *ctx, const unsigned char *buf, size_t len)`**: Sends data over an SSL connection. It ensures that the client is properly initialized and connected before sending data.
-
-### Initialization and Cleanup
-- **`ssl_init(sslclient_context *ssl_client, Client *client)`**: Initializes the SSL context with default values and sets up necessary SSL configurations.
-- **`cleanup(sslclient_context *ssl_client, bool ca_cert_initialized, bool client_cert_initialized, bool client_key_initialized, int ret, const char *rootCABuff, const char *cli_cert, const char *cli_key)`**: Frees allocated resources and stops the SSL socket if an error occurred during SSL operations.
-
-### SSL Client Start and Configuration
-- **`start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey)`**: Handles the entire process of starting an SSL client, including TCP connection initiation, random number generation seeding, SSL/TLS defaults setup, authentication, and SSL handshake.
-- **`init_tcp_connection(sslclient_context *ssl_client, const char *host, uint32_t port)`**: Initializes a TCP connection to a remote host.
-- **`seed_random_number_generator(sslclient_context *ssl_client)`**: Seeds the random number generator critical for SSL/TLS operations.
-- **`set_up_tls_defaults(sslclient_context *ssl_client)`**: Sets up SSL/TLS configuration with default settings.
-- **`auth_root_ca_buff(sslclient_context *ssl_client, const char *rootCABuff, bool *ca_cert_initialized, const char *pskIdent, const char *psKey)`**: Configures SSL/TLS authentication options based on provided CA certificates or pre-shared keys.
-- **`auth_client_cert_key(sslclient_context *ssl_client, const char *cli_cert, const char *cli_key, bool *client_cert_initialized, bool *client_key_initialized)`**: Loads and initializes the client's certificate and private key for SSL/TLS authentication.
-- **`set_hostname_for_tls(sslclient_context *ssl_client, const char *host)`**: Sets the hostname for the TLS session, which should match the Common Name (CN) in the server's certificate.
-
-### SSL Handshake and Verification
-- **`perform_ssl_handshake(sslclient_context *ssl_client, const char *cli_cert, const char *cli_key)`**: Manages the SSL/TLS handshake process.
-- **`verify_server_cert(sslclient_context *ssl_client)`**: Verifies the server's certificate against the provided root CA.
-
-### Data Transmission and Reception
-- **`data_to_read(sslclient_context *ssl_client)`**: Checks if there is data available to read from the SSL connection.
-- **`send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len)`**: Sends data over an established SSL connection.
-- **`get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, size_t length)`**: Receives data from the SSL connection.
-
-### Certificate Validation
-- **`verify_ssl_fingerprint(sslclient_context *ssl_client, const char* fp, const char* domain_name)`**: Verifies the certificate provided by the peer against a specified SHA256 fingerprint.
-- **`verify_ssl_dn(sslclient_context *ssl_client, const char* domain_name)`**: Checks if the peer certificate contains the specified domain name in its Common Name (CN) or Subject Alternative Names (SANs).
-
-### Utility Functions
-- **`parse_hex_nibble(char pb, uint8_t* res)`**: Parses a hexadecimal nibble into its binary representation.
-- **`match_name(const string& name, const string& domainName
-
-)`**: Compares a name from a certificate to a domain name to check if they match.
-
-### Cleanup and Socket Management
-- **`stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key)`**: Stops the SSL socket and frees associated resources.
-
-This user guide provides a comprehensive overview of each function, offering insights into how to use the SSLClient library effectively for secure communication in Arduino-based projects. Each function is designed to handle specific aspects of SSL/TLS communication, from establishing connections and handling data transmission to managing certificates and ensuring security.
## 📄 License
-The library is released under GNU General Public Licence. See the LICENSE file for more details.
-
-## 📶 Handy CSQ / RSSI / Signal Strength Mapping
-| CSQ Value | RSSI (dBm) | Description |
-|-----------|---------------------|------------------|
-| 0 | -113 dBm or less | No signal |
-| 1-2 | -111 dBm to -109 dBm| Very poor signal |
-| 3-9 | -107 dBm to -93 dBm | Poor signal |
-| 10-14 | -91 dBm to -83 dBm | Fair signal |
-| 15-19 | -81 dBm to -73 dBm | Good signal |
-| 20-30 | -71 dBm to -53 dBm | Very good signal |
-| 31 | -51 dBm or more | Excellent signal |
-
-## 🖥 Contributing
-Contributions are welcome! Please fork the repository and submit pull requests with your enhancements. For more information on contributing, please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file.
\ No newline at end of file
+
+The library is released under GNU General Public Licence. See the `LICENSE` file for more details.
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
new file mode 100644
index 0000000..6225c02
--- /dev/null
+++ b/docs/CHANGELOG.md
@@ -0,0 +1,45 @@
+[](../README.md)
+
+# SSL Client Updates:
+
+1. Added some commits of WifiSecureClient to fix some bugs.
+
+2. Change send_ssl_data to use size_t instead of uint16_t, commit a299ddc
+
+3. ssl_client.cpp: Fix parameter name in _handle_error, commit : 39155e7
+
+4. Fix memory leaks when SSL/TLS connection fails, commit : f29f448
+
+5. Fix buffer issue when writing data larger than receiving buffer, commit: 4ce6c5f
+
+6. Fix issue where client read timeout value not being set, commit: 59ae9f0
+
+7. Add clarity to return values for start_ssl_client and fix early termination of ssl client, commit: cc40266
+
+8. Close issue [#30](https://github.com/govorox/SSLClient/issues/30), commit: e426936
+
+9. Separate concerns from start_ssl_client into singly responsible functions and unit test private API, commit: 0f1fa36
+
+10. Close issue [#60](https://github.com/govorox/SSLClient/issues/60), Naming collision changes to make compatibile compilation with WiFiClientSecure, commit: b8a9e7e
+
+11. `v1.2.0`
+
+ **ALPN Support**: Application Layer Protocol Negotiation for efficient server communication.
+
+ **Cert Bundles**: Simplifies management and use of multiple CA certificates.
+
+ **Bug Fix**: Corrects byte calculation for record expansion post-handshake.
+
+ **More Examples**: Examples for the ESP32 PlatformIO for ALPN protocols, AWS, and using certificate bundles.
+
+12. `v1.3.0`
+
+ - Feature flag for compatibility with MbedTLS v3.x.x - Automated by MBEDTLS_VERSION_MAJOR.
+ - Add Flag MBEDTLS_BACKPORT to allow override MBEDTLS_VERSION_MAJOR >= 3.
+ - Add workaround for W5500 Ethernet failing due to client returning -1 when no error - switch on flag W5500_WORKAROUND.
+ - closes issue Support for ESP32 and W5500 based Secure Ethernet for HTTPS or MQTTS? [#44](https://github.com/govorox/SSLClient/issues/85) and closes issue SSLClient with W5500 not working (works well with WiFi and TinyGSM) [#85](https://github.com/govorox/SSLClient/issues/85).
+ - Improve documentation.
+ - Add GitHub Actions workflow to ensure PlatformIO examples compile.
+ - Update GitHub Actions workflow to run tests multiple times with feature flags set.
+ - 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.
\ No newline at end of file
diff --git a/CODEGUIDE.md b/docs/CODEGUIDE.md
similarity index 94%
rename from CODEGUIDE.md
rename to docs/CODEGUIDE.md
index 2244468..aa40c54 100644
--- a/CODEGUIDE.md
+++ b/docs/CODEGUIDE.md
@@ -1,3 +1,5 @@
+[](../README.md)
+
# Code Standards
## Tests
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
new file mode 100644
index 0000000..d8a0515
--- /dev/null
+++ b/docs/CONTRIBUTING.md
@@ -0,0 +1,29 @@
+[](../README.md)
+
+# Contributing to SSLClient
+
+Thank you for considering contributing to SSLClient! Please follow these guidelines to help us review your contributions more efficiently.
+
+## How to Report an Issue
+
+1. Search for similar issues in the [issue tracker](https://github.com/govorox/SSLClient/issues) to avoid duplicates.
+2. Use the provided [issue templates](https://github.com/govorox/SSLClient/tree/master/.github/ISSUE_TEMPLATE) to ensure all necessary information is included.
+3. Provide a clear and descriptive title for the issue.
+4. Include steps to reproduce the issue, expected and actual behavior, and details about your environment.
+
+## How to Submit a Pull Request
+
+1. Fork the repository and create your branch from `main`.
+2. Ensure your code follows the project's coding standards.
+3. Update documentation as necessary.
+4. Link to the relevant issue in the pull request description.
+5. Ensure all tests pass before submitting the pull request.
+
+## Coding Standards
+
+- Follow the [existing code style](CODEGUIDE.md).
+- Write clear and concise commit messages.
+- Include comments where necessary for clarity.
+
+## Contact
+If you have any questions, feel free to reach out to us at [robbyrnes@hotmail.co.uk].
diff --git a/docs/FUNCTIONS.md b/docs/FUNCTIONS.md
new file mode 100644
index 0000000..39f19d6
--- /dev/null
+++ b/docs/FUNCTIONS.md
@@ -0,0 +1,48 @@
+[](../README.md)
+
+# 📚 Function Notes
+
+The `SSLClient.cpp` file provides a comprehensive suite of functions for handling SSL/TLS connections in an Arduino environment, particularly for the ESP32. These functions can be categorized into several key areas of functionality, which are essential for understanding the library's capabilities. Here's a user guide to the functionality based on the documentation blocks of these functions:
+
+## Error Handling
+- **`_handle_error(int err, const char* function, int line)`**: This function is used internally to handle errors. It interprets the error code returned by various SSL operations and logs it for debugging purposes.
+
+## Network Communication
+- **`client_net_recv(void *ctx, unsigned char *buf, size_t len)`**: Receives data over an established SSL connection. It checks for a valid client context and returns the number of bytes received or an error code.
+- **`client_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout)`**: Similar to `client_net_recv`, but with an additional timeout parameter. It's useful for non-blocking operations.
+- **`client_net_send(void *ctx, const unsigned char *buf, size_t len)`**: Sends data over an SSL connection. It ensures that the client is properly initialized and connected before sending data.
+
+## Initialization and Cleanup
+- **`ssl_init(sslclient_context *ssl_client, Client *client)`**: Initializes the SSL context with default values and sets up necessary SSL configurations.
+- **`cleanup(sslclient_context *ssl_client, bool ca_cert_initialized, bool client_cert_initialized, bool client_key_initialized, int ret, const char *rootCABuff, const char *cli_cert, const char *cli_key)`**: Frees allocated resources and stops the SSL socket if an error occurred during SSL operations.
+
+## SSL Client Start and Configuration
+- **`start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey)`**: Handles the entire process of starting an SSL client, including TCP connection initiation, random number generation seeding, SSL/TLS defaults setup, authentication, and SSL handshake.
+- **`init_tcp_connection(sslclient_context *ssl_client, const char *host, uint32_t port)`**: Initializes a TCP connection to a remote host.
+- **`seed_random_number_generator(sslclient_context *ssl_client)`**: Seeds the random number generator critical for SSL/TLS operations.
+- **`set_up_tls_defaults(sslclient_context *ssl_client)`**: Sets up SSL/TLS configuration with default settings.
+- **`auth_root_ca_buff(sslclient_context *ssl_client, const char *rootCABuff, bool *ca_cert_initialized, const char *pskIdent, const char *psKey)`**: Configures SSL/TLS authentication options based on provided CA certificates or pre-shared keys.
+- **`auth_client_cert_key(sslclient_context *ssl_client, const char *cli_cert, const char *cli_key, bool *client_cert_initialized, bool *client_key_initialized)`**: Loads and initializes the client's certificate and private key for SSL/TLS authentication.
+- **`set_hostname_for_tls(sslclient_context *ssl_client, const char *host)`**: Sets the hostname for the TLS session, which should match the Common Name (CN) in the server's certificate.
+
+## SSL Handshake and Verification
+- **`perform_ssl_handshake(sslclient_context *ssl_client, const char *cli_cert, const char *cli_key)`**: Manages the SSL/TLS handshake process.
+- **`verify_server_cert(sslclient_context *ssl_client)`**: Verifies the server's certificate against the provided root CA.
+
+## Data Transmission and Reception
+- **`data_to_read(sslclient_context *ssl_client)`**: Checks if there is data available to read from the SSL connection.
+- **`send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len)`**: Sends data over an established SSL connection.
+- **`get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, size_t length)`**: Receives data from the SSL connection.
+
+## Certificate Validation
+- **`verify_ssl_fingerprint(sslclient_context *ssl_client, const char* fp, const char* domain_name)`**: Verifies the certificate provided by the peer against a specified SHA256 fingerprint.
+- **`verify_ssl_dn(sslclient_context *ssl_client, const char* domain_name)`**: Checks if the peer certificate contains the specified domain name in its Common Name (CN) or Subject Alternative Names (SANs).
+
+## Utility Functions
+- **`parse_hex_nibble(char pb, uint8_t* res)`**: Parses a hexadecimal nibble into its binary representation.
+- **`match_name(const string& name, const string& domainName)`**: Compares a name from a certificate to a domain name to check if they match.
+
+## Cleanup and Socket Management
+- **`stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key)`**: Stops the SSL socket and frees associated resources.
+
+This user guide provides a comprehensive overview of each function, offering insights into how to use the SSLClient library effectively for secure communication in Arduino-based projects. Each function is designed to handle specific aspects of SSL/TLS communication, from establishing connections and handling data transmission to managing certificates and ensuring security.
diff --git a/docs/RSSI.md b/docs/RSSI.md
new file mode 100644
index 0000000..a69945b
--- /dev/null
+++ b/docs/RSSI.md
@@ -0,0 +1,17 @@
+[](../README.md)
+
+# Signal Strength Map
+
+This is particularly useful for debugging connectivity issues with GSM and other cellular modems.
+
+## 📶 CSQ / RSSI / Signal Strength Map
+
+| CSQ Value | RSSI (dBm) | Description |
+|-----------|---------------------|------------------|
+| 0 | -113 dBm or less | No signal |
+| 1-2 | -111 dBm to -109 dBm| Very poor signal |
+| 3-9 | -107 dBm to -93 dBm | Poor signal |
+| 10-14 | -91 dBm to -83 dBm | Fair signal |
+| 15-19 | -81 dBm to -73 dBm | Good signal |
+| 20-30 | -71 dBm to -53 dBm | Very good signal |
+| 31 | -51 dBm or more | Excellent signal |
diff --git a/examples/Esp32-Arduino-IDE/https_eth_LilyGo-T-ETH-POE/ca_cert.h b/examples/Esp32-Arduino-IDE/https_eth_LilyGo-T-ETH-POE/ca_cert.h
index 3d79d4a..14395d3 100644
--- a/examples/Esp32-Arduino-IDE/https_eth_LilyGo-T-ETH-POE/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/https_eth_LilyGo-T-ETH-POE/ca_cert.h
@@ -1,22 +1,31 @@
-//CA Certificate for www.howsmyssl.com (valid until 04-07-2021)
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
const char root_ca[] PROGMEM =
"-----BEGIN CERT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Esp32-Arduino-IDE/https_get_sim7600/certs.h
new file mode 100644
index 0000000..14395d3
--- /dev/null
+++ b/examples/Esp32-Arduino-IDE/https_get_sim7600/certs.h
@@ -0,0 +1,31 @@
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
+const char root_ca[] PROGMEM =
+"-----BEGIN CERTIFICATE-----\n"
+"MIIFBTCCAu2gAwIBAgIQS6hSk/eaL6JzBkuoBI110DANBgkqhkiG9w0BAQsFADBP\n"
+"MQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFy\n"
+"Y2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMTAeFw0yNDAzMTMwMDAwMDBa\n"
+"Fw0yNzAzMTIyMzU5NTlaMDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBF\n"
+"bmNyeXB0MQwwCgYDVQQDEwNSMTAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n"
+"AoIBAQDPV+XmxFQS7bRH/sknWHZGUCiMHT6I3wWd1bUYKb3dtVq/+vbOo76vACFL\n"
+"YlpaPAEvxVgD9on/jhFD68G14BQHlo9vH9fnuoE5CXVlt8KvGFs3Jijno/QHK20a\n"
+"/6tYvJWuQP/py1fEtVt/eA0YYbwX51TGu0mRzW4Y0YCF7qZlNrx06rxQTOr8IfM4\n"
+"FpOUurDTazgGzRYSespSdcitdrLCnF2YRVxvYXvGLe48E1KGAdlX5jgc3421H5KR\n"
+"mudKHMxFqHJV8LDmowfs/acbZp4/SItxhHFYyTr6717yW0QrPHTnj7JHwQdqzZq3\n"
+"DZb3EoEmUVQK7GH29/Xi8orIlQ2NAgMBAAGjgfgwgfUwDgYDVR0PAQH/BAQDAgGG\n"
+"MB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATASBgNVHRMBAf8ECDAGAQH/\n"
+"AgEAMB0GA1UdDgQWBBS7vMNHpeS8qcbDpHIMEI2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7600.ino b/examples/Esp32-Arduino-IDE/https_get_sim7600/https_get_sim7600.ino
similarity index 98%
rename from examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/https_get_sim7600.ino
rename to examples/Esp32-Arduino-IDE/https_get_sim7600/https_get_sim7600.ino
index b34bb18..40b7af3 100644
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/https_get_sim7600.ino
+++ b/examples/Esp32-Arduino-IDE/https_get_sim7600/https_get_sim7600.ino
@@ -45,7 +45,7 @@ const char server[] = "vsh.pp.ua";
const char resource[] = "/TinyGSM/logo.txt";
const int port = 443;
-#include
+#include
#include
#include "SSLClient.h"
#include "utilities.h"
@@ -212,7 +212,6 @@ void loop()
24 - HYBRID(CDMA and eHRPD)
*/
modem.sendAT(GF("+CNSMOD?"));
- if (modem.waitResponse(GF(GSM_NL "+CNSMOD:")) != 1) { }
int nmodec = modem.stream.readStringUntil(',').toInt() != 0;
int nmode = modem.stream.readStringUntil('\n').toInt();
modem.waitResponse();
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/utilities.h b/examples/Esp32-Arduino-IDE/https_get_sim7600/utilities.h
similarity index 100%
rename from examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/utilities.h
rename to examples/Esp32-Arduino-IDE/https_get_sim7600/utilities.h
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7000/ca_cert.h b/examples/Esp32-Arduino-IDE/https_gsm_SIM7000/ca_cert.h
index 3d79d4a..14395d3 100644
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM7000/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/https_gsm_SIM7000/ca_cert.h
@@ -1,22 +1,31 @@
-//CA Certificate for www.howsmyssl.com (valid until 04-07-2021)
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
const char root_ca[] PROGMEM =
"-----BEGIN CERTIFICATE-----\n"
-"MIIDSjCCAjKgAwIBAgIQ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5\n"
+"tFnme7bl5AFzgAiIyBpY9umbbjAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAKG\n"
+"Fmh0dHA6Ly94MS5pLmxlbmNyLm9yZy8wEwYDVR0gBAwwCjAIBgZngQwBAgEwJwYD\n"
+"VR0fBCAwHjAcoBqgGIYWaHR0cDovL3gxLmMubGVuY3Iub3JnLzANBgkqhkiG9w0B\n"
+"AQsFAAOCAgEAkrHnQTfreZ2B5s3iJeE6IOmQRJWjgVzPw139vaBw1bGWKCIL0vIo\n"
+"zwzn1OZDjCQiHcFCktEJr59L9MhwTyAWsVrdAfYf+B9haxQnsHKNY67u4s5Lzzfd\n"
+"u6PUzeetUK29v+PsPmI2cJkxp+iN3epi4hKu9ZzUPSwMqtCceb7qPVxEbpYxY1p9\n"
+"1n5PJKBLBX9eb9LU6l8zSxPWV7bK3lG4XaMJgnT9x3ies7msFtpKK5bDtotij/l0\n"
+"GaKeA97pb5uwD9KgWvaFXMIEt8jVTjLEvwRdvCn294GPDF08U8lAkIv7tghluaQh\n"
+"1QnlE4SEN4LOECj8dsIGJXpGUk3aU3KkJz9icKy+aUgA+2cP21uh6NcDIS3XyfaZ\n"
+"QjmDQ993ChII8SXWupQZVBiIpcWO4RqZk3lr7Bz5MUCwzDIA359e57SSq5CCkY0N\n"
+"4B6Vulk7LktfwrdGNVI5BsC9qqxSwSKgRJeZ9wygIaehbHFHFhcBaMDKpiZlBHyz\n"
+"rsnnlFXCb5s8HKn5LsUgGvB24L7sGNZP2CX7dhHov+YhD+jozLW2p9W4959Bz2Ei\n"
+"RmqDtmiXLnzqTpXbI+suyCsohKRg6Un0RC47+cpiVwHiXZAW+cn8eiNIjqbVgXLx\n"
+"KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=\n"
+"-----END CERTIFICATE-----";
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/certs.h b/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/certs.h
deleted file mode 100644
index 72451b2..0000000
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_get_sim7600/certs.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Root CA for vsh.pp.ua
-const char root_ca[] PROGMEM =
-"-----BEGIN CERTIFICATE-----\n"
-"MIIEZTCCA02gAwIBAgIQQAF1BIMUpMghjISpDBbN3zANBgkqhkiG9w0BAQsFADA/\n"
-"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
-"DkRTVCBSb290IENBIFgzMB4XDTIwMTAwNzE5MjE0MFoXDTIxMDkyOTE5MjE0MFow\n"
-"MjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxCzAJBgNVBAMT\n"
-"AlIzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuwIVKMz2oJTTDxLs\n"
-"jVWSw/iC8ZmmekKIp10mqrUrucVMsa+Oa/l1yKPXD0eUFFU1V4yeqKI5GfWCPEKp\n"
-"Tm71O8Mu243AsFzzWTjn7c9p8FoLG77AlCQlh/o3cbMT5xys4Zvv2+Q7RVJFlqnB\n"
-"U840yFLuta7tj95gcOKlVKu2bQ6XpUA0ayvTvGbrZjR8+muLj1cpmfgwF126cm/7\n"
-"gcWt0oZYPRfH5wm78Sv3htzB2nFd1EbjzK0lwYi8YGd1ZrPxGPeiXOZT/zqItkel\n"
-"/xMY6pgJdz+dU/nPAeX1pnAXFK9jpP+Zs5Od3FOnBv5IhR2haa4ldbsTzFID9e1R\n"
-"oYvbFQIDAQABo4IBaDCCAWQwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8E\n"
-"BAMCAYYwSwYIKwYBBQUHAQEEPzA9MDsGCCsGAQUFBzAChi9odHRwOi8vYXBwcy5p\n"
-"ZGVudHJ1c3QuY29tL3Jvb3RzL2RzdHJvb3RjYXgzLnA3YzAfBgNVHSMEGDAWgBTE\n"
-"p7Gkeyxx+tvhS5B1/8QVYIWJEDBUBgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEE\n"
-"AYLfEwEBATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2Vu\n"
-"Y3J5cHQub3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0\n"
-"LmNvbS9EU1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFBQusxe3WFbLrlAJQOYf\n"
-"r52LFMLGMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0B\n"
-"AQsFAAOCAQEA2UzgyfWEiDcx27sT4rP8i2tiEmxYt0l+PAK3qB8oYevO4C5z70kH\n"
-"ejWEHx2taPDY/laBL21/WKZuNTYQHHPD5b1tXgHXbnL7KqC401dk5VvCadTQsvd8\n"
-"S8MXjohyc9z9/G2948kLjmE6Flh9dDYrVYA9x2O+hEPGOaEOa1eePynBgPayvUfL\n"
-"qjBstzLhWVQLGAkXXmNs+5ZnPBxzDJOLxhF2JIbeQAcH5H0tZrUlo5ZYyOqA7s9p\n"
-"O5b85o3AM/OJ+CktFBQtfvBhcJVd9wvlwPsk+uyOy2HI7mNxKKgsBTt375teA2Tw\n"
-"UdHkhVNcsAKX1H7GNNLOEADksd86wuoXvg==\n"
-"-----END CERTIFICATE-----\n";
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/certs.h b/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/certs.h
deleted file mode 100644
index 442c2fd..0000000
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/certs.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Root CA for vsh.pp.ua
-const char root_ca[] PROGMEM =
-"-----BEGIN CERTIFICATE-----\n"
-"MIIDrzCCApegAwIBAgIQ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zUyImZOMkXDiqw8cvpOp/2PV5Adg\n"
-"06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF\n"
-"PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls\n"
-"YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk\n"
-"CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\n"
-"-----END CERTIFICATE-----\n";
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM800/ca_cert.h b/examples/Esp32-Arduino-IDE/https_gsm_SIM800/ca_cert.h
index 3d79d4a..14395d3 100644
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM800/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/https_gsm_SIM800/ca_cert.h
@@ -1,22 +1,31 @@
-//CA Certificate for www.howsmyssl.com (valid until 04-07-2021)
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
const char root_ca[] PROGMEM =
"-----BEGIN CERTIFICATE-----\n"
-"MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/\n"
-"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
-"DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow\n"
-"PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD\n"
-"Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n"
-"AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O\n"
-"rz5Iy2Xu/NMhD2XSKtkyj4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"
+"1n5PJKBLBX9eb9LU6l8zSxPWV7bK3lG4XaMJgnT9x3ies7msFtpKK5bDtotij/l0\n"
+"GaKeA97pb5uwD9KgWvaFXMIEt8jVTjLEvwRdvCn294GPDF08U8lAkIv7tghluaQh\n"
+"1QnlE4SEN4LOECj8dsIGJXpGUk3aU3KkJz9icKy+aUgA+2cP21uh6NcDIS3XyfaZ\n"
+"QjmDQ993ChII8SXWupQZVBiIpcWO4RqZk3lr7Bz5MUCwzDIA359e57SSq5CCkY0N\n"
+"4B6Vulk7LktfwrdGNVI5BsC9qqxSwSKgRJeZ9wygIaehbHFHFhcBaMDKpiZlBHyz\n"
+"rsnnlFXCb5s8HKn5LsUgGvB24L7sGNZP2CX7dhHov+YhD+jozLW2p9W4959Bz2Ei\n"
+"RmqDtmiXLnzqTpXbI+suyCsohKRg6Un0RC47+cpiVwHiXZAW+cn8eiNIjqbVgXLx\n"
+"KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=\n"
+"-----END CERTIFICATE-----";
diff --git a/examples/Esp32-Arduino-IDE/https_post_sim7600/certs.h b/examples/Esp32-Arduino-IDE/https_post_sim7600/certs.h
new file mode 100644
index 0000000..14395d3
--- /dev/null
+++ b/examples/Esp32-Arduino-IDE/https_post_sim7600/certs.h
@@ -0,0 +1,31 @@
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
+const char root_ca[] PROGMEM =
+"-----BEGIN CERTIFICATE-----\n"
+"MIIFBTCCAu2gAwIBAgIQS6hSk/eaL6JzBkuoBI110DANBgkqhkiG9w0BAQsFADBP\n"
+"MQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFy\n"
+"Y2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMTAeFw0yNDAzMTMwMDAwMDBa\n"
+"Fw0yNzAzMTIyMzU5NTlaMDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZ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KBLBX9eb9LU6l8zSxPWV7bK3lG4XaMJgnT9x3ies7msFtpKK5bDtotij/l0\n"
+"GaKeA97pb5uwD9KgWvaFXMIEt8jVTjLEvwRdvCn294GPDF08U8lAkIv7tghluaQh\n"
+"1QnlE4SEN4LOECj8dsIGJXpGUk3aU3KkJz9icKy+aUgA+2cP21uh6NcDIS3XyfaZ\n"
+"QjmDQ993ChII8SXWupQZVBiIpcWO4RqZk3lr7Bz5MUCwzDIA359e57SSq5CCkY0N\n"
+"4B6Vulk7LktfwrdGNVI5BsC9qqxSwSKgRJeZ9wygIaehbHFHFhcBaMDKpiZlBHyz\n"
+"rsnnlFXCb5s8HKn5LsUgGvB24L7sGNZP2CX7dhHov+YhD+jozLW2p9W4959Bz2Ei\n"
+"RmqDtmiXLnzqTpXbI+suyCsohKRg6Un0RC47+cpiVwHiXZAW+cn8eiNIjqbVgXLx\n"
+"KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=\n"
+"-----END CERTIFICATE-----";
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/https_post_sim7600.ino b/examples/Esp32-Arduino-IDE/https_post_sim7600/https_post_sim7600.ino
similarity index 98%
rename from examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/https_post_sim7600.ino
rename to examples/Esp32-Arduino-IDE/https_post_sim7600/https_post_sim7600.ino
index 5811a2f..df40d6d 100644
--- a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/https_post_sim7600.ino
+++ b/examples/Esp32-Arduino-IDE/https_post_sim7600/https_post_sim7600.ino
@@ -8,7 +8,6 @@
* Just comment them out.
* https://simcom.ee/documents/SIM7600C/SIM7500_SIM7600%20Series_AT%20Command%20Manual_V1.01.pdf
**************************************************************/
-
#define TINY_GSM_MODEM_SIM7600
// Set serial for debug console (to the Serial Monitor, default speed 115200)
@@ -45,7 +44,7 @@ const char server[] = "hookb.in";
const char resource[] = "/eKKEKgbNZPCeYYRdZXDo";
const int port = 443;
-#include
+#include
#include
#include "SSLClient.h"
#include "utilities.h"
@@ -212,7 +211,6 @@ void loop()
24 - HYBRID(CDMA and eHRPD)
*/
modem.sendAT(GF("+CNSMOD?"));
- if (modem.waitResponse(GF(GSM_NL "+CNSMOD:")) != 1) { }
int nmodec = modem.stream.readStringUntil(',').toInt() != 0;
int nmode = modem.stream.readStringUntil('\n').toInt();
modem.waitResponse();
diff --git a/examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/utilities.h b/examples/Esp32-Arduino-IDE/https_post_sim7600/utilities.h
similarity index 100%
rename from examples/Esp32-Arduino-IDE/https_gsm_SIM7600/https_post_sim7600/utilities.h
rename to examples/Esp32-Arduino-IDE/https_post_sim7600/utilities.h
diff --git a/examples/Esp32-Arduino-IDE/https_wifi/ca_cert.h b/examples/Esp32-Arduino-IDE/https_wifi/ca_cert.h
index 3d79d4a..14395d3 100644
--- a/examples/Esp32-Arduino-IDE/https_wifi/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/https_wifi/ca_cert.h
@@ -1,22 +1,31 @@
-//CA Certificate for www.howsmyssl.com (valid until 04-07-2021)
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
const char root_ca[] PROGMEM =
"-----BEGIN CERTIFICATE-----\n"
-"MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/\n"
-"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
-"DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow\n"
-"PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD\n"
-"Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n"
-"AN+v6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haxQnsHKNY67u4s5Lzzfd\n"
+"u6PUzeetUK29v+PsPmI2cJkxp+iN3epi4hKu9ZzUPSwMqtCceb7qPVxEbpYxY1p9\n"
+"1n5PJKBLBX9eb9LU6l8zSxPWV7bK3lG4XaMJgnT9x3ies7msFtpKK5bDtotij/l0\n"
+"GaKeA97pb5uwD9KgWvaFXMIEt8jVTjLEvwRdvCn294GPDF08U8lAkIv7tghluaQh\n"
+"1QnlE4SEN4LOECj8dsIGJXpGUk3aU3KkJz9icKy+aUgA+2cP21uh6NcDIS3XyfaZ\n"
+"QjmDQ993ChII8SXWupQZVBiIpcWO4RqZk3lr7Bz5MUCwzDIA359e57SSq5CCkY0N\n"
+"4B6Vulk7LktfwrdGNVI5BsC9qqxSwSKgRJeZ9wygIaehbHFHFhcBaMDKpiZlBHyz\n"
+"rsnnlFXCb5s8HKn5LsUgGvB24L7sGNZP2CX7dhHov+YhD+jozLW2p9W4959Bz2Ei\n"
+"RmqDtmiXLnzqTpXbI+suyCsohKRg6Un0RC47+cpiVwHiXZAW+cn8eiNIjqbVgXLx\n"
+"KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=\n"
+"-----END CERTIFICATE-----";
diff --git a/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/ca_cert.h b/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/ca_cert.h
index cf61a75..93ce2a8 100644
--- a/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/ca_cert.h
@@ -1,41 +1,87 @@
-//Azure Baltimore Certificate
+// This file contains the root CA certificate, client certificate and client private key
const char root_ca[] PROGMEM =
-"-----BEGIN CERTIFICATE-----\r\n"
-"MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQ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QTgoIMA0GCSqGSIb3DQEBCwUA\n"
+"A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\n"
+"U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\n"
+"N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\n"
+"o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n"
+"5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n"
+"rqXRfboQnoZsG4q5WTP468SQvvG5\n"
+"-----END CERTIFICATE-----";
-//Client Certificate (from Azure Iot Hub Device) - Get your own
-const char client_cert_pem_start[] =
-"-----BEGIN CERTIFICATE-----""\n"
-"MIIFfDCCA2SgAwIBAgIBAzANBgkqhkiG9w0BAQsFADAqMSgwJgYDVQQDDB9BenVy""\n"
-...
-"+sDPud5VrLd8jOWCAKcuZA==""\n"
+// certificate
+const char client_cert_pem[] PROGMEM =
+ "-----BEGIN CERTIFICATE-----\n"
+"MIIDWTCCAkGgAwIBAgIUE9evNgJkNMn0MsfViCBjxUNRMZswDQYJKoZIhvcNAQEL\n"
+"BQAwTTFLMEkGA1UECwxCQW1hem9uIFdlYiBTZXJ2aWNlcyBPPUFtYXpvbi5jb20g\n"
+"SW5jLiBMPVNlYXR0bGUgU1Q9V2FzaGluZ3RvbiBDPVVTMB4XDTIzMTAwNDEwNTMw\n"
+"NloXDTQ5MTIzMTIzNTk1OVowHjEcMBoGA1UEAwwTQVdTIElvVCBDZXJ0aWZpY2F0\n"
+"ZTCCASIwDQYJKoZIhvcNAQE23QADggEPADCCAQoCggEBAMJlPMRdKRLO6FxDOQVM\n"
+"FTDRvUel/UZfB5PfcrNmIC8544q6kFlekveJL0DvEaYxkmasJTtMgVTYe8eiEnuP\n"
+"857Eoeu8so1Bqol+bmWtLm29K5zDC68ObETpv1wHX0Xcoh0IxMbtB//SxnRvVdrz\n"
+"neyX1H9paYqOyv+FIdjNL2otW6bEF1uLo+2wpV9q2MxmnajsXQ9GeI0ZrHzPevVg\n"
+"j69k9F8O5TOPyWKi8/PcAe7LVEYcCHp8bznlCslC8zS7wX+69qwI9x6cQksgxTeQ\n"
+"Q0pm7EbweyYicI7YeQs/7sA0iqBXxgFpW8FWgfKyR6MFNy9QKgwyvw/uWBUg65PQ\n"
+"0/cCAwEAAaNgMF4wHwYDVR0jBBgwFoAUPC5Zkf6FZgvddOyhRO+D/AEF4AkwHQYD\n"
+"VR0OBBYEFJRgXFfBW+opnmqhYtDxuID7gMaMMAwGA1UdEwEB/wQCMAAwDgYDVR0P\n"
+"AQH/BAQDAgeAMA0GCSqGSIb3DQEBCwUAA4IBAQBp2hHcgllqjTtD+O0qTXyLjB5L\n"
+"YpbJjIrkhh1obwMJkmCMTwF7W1H79gCDc9xPCsjSTGfD6UlmZgceIxTT389kGfs0\n"
+"TygBn1aDj6+SvDtl0/AnzlyK3Z5cfegIwMwAF4aT+A2L67kW/RvlZaRaw0RXGavj\n"
+"RR56oY16h4ufcNliXDk0didHKrudssT8RmrNnZJ907/wU8z5PzotnnWWp/nqNzcN\n"
+"lhPMS989rQ8hliIY3cQ4p35QbYuXqwXyO9EUgtKnZMHmTEAApTqXKbiqxK69gzag\n"
+"rfmHT4kSSEF8ytVv4+qxGkZjrRzLRi/Oszy+TtQl1uKMp7dtREyhMXXELVc6\n"
"-----END CERTIFICATE-----";
-//Client Key (from Azure Iot Hub Device) - Get your own
-const char client_key_pem_start[] =
-"-----BEGIN RSA PRIVATE KEY-----""\n"
-"MIIJKAIBAAKCAgEAwUG+ZPQp4ZRlvI7xPQYDHkLs5dTX0LTB0tUr3O7LSwc4PPf3""\n"
-...
-"63IPOMRIsakwx3hdRv9gh30bh6LVS6pn9UyHM65pNVsCu4OHB/B4dSiiceM=""\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jRmsfM969WCP\n"
+"r2T0Xw7lM4/JYqLz89wB7stURhwIenxvOeUKyULzNLvBf7r2rAj3HpxCSyDFN5BD\n"
+"SmbsRvB7JiJwjth5Cz/uwDSKoFfGAWlbwVaB8rJHowU3L1AqDDK/D+5YFSDrk9DT\n"
+"9wIDAQAB\n"
+"-----END PUBLIC KEY-----";
\ No newline at end of file
diff --git a/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/mqtt_gsm_SIM800L_Azure_x509_Device_Twin.ino b/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/mqtt_gsm_SIM800L_Azure_x509_Device_Twin.ino
index 8cc5404..da04ef4 100644
--- a/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/mqtt_gsm_SIM800L_Azure_x509_Device_Twin.ino
+++ b/examples/Esp32-Arduino-IDE/mqtt_gsm_SIM800L_Azure_x509_Device_Twin/mqtt_gsm_SIM800L_Azure_x509_Device_Twin.ino
@@ -104,7 +104,7 @@ bool setupPMU()
}
// For read the MQTT events
-void callback(char *topic, byte *payload, unsigned int length)
+void callback(char *topic, uint8_t *payload, unsigned int length)
{
Serial.print("Message arrived [");
Serial.print(topic);
@@ -187,9 +187,10 @@ void setup()
//Add CA Certificate
+ // Update with you own certs! These are for AWS IoT and here for example only.
secure_presentation_layer.setCACert(root_ca);
- secure_presentation_layer.setCertificate(client_cert_pem_start); //x509 client Certificate
- secure_presentation_layer.setPrivateKey(client_key_pem_start); //x509 client key
+ secure_presentation_layer.setCertificate(client_cert_pem); //x509 client Certificate
+ secure_presentation_layer.setPrivateKey(client_public_key_pem); //x509 client key
// Modem initial setup
setupModem();
diff --git a/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/ca_cert.h b/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/ca_cert.h
index ce4c84d..14395d3 100644
--- a/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/ca_cert.h
+++ b/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/ca_cert.h
@@ -1,37 +1,31 @@
-//Crt for EMQX Free Secure Broker
-//https://www.emqx.io/mqtt/public-mqtt5-broker
+//CA Certificate for www.howsmyssl.com (valid until 12-03-2027)
const char root_ca[] PROGMEM =
"-----BEGIN CERTIFICATE-----\n"
-"MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB\n"
-"iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl\n"
-"cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV\n"
-"BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw\n"
-"MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV\n"
-"BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU\n"
-"aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy\n"
-"dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK\n"
-"AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B\n"
-"3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY\n"
-"tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/\n"
-"Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2\n"
-"VN3I5xI6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dzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=\n"
+"-----END CERTIFICATE-----";
diff --git a/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/mqtt_secure_gsm_SIM7000.ino b/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/mqtt_secure_gsm_SIM7000.ino
index 5c82045..b235730 100644
--- a/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/mqtt_secure_gsm_SIM7000.ino
+++ b/examples/Esp32-Arduino-IDE/mqtt_secure_gsm_SIM7000/mqtt_secure_gsm_SIM7000.ino
@@ -61,7 +61,7 @@ SSLClient secure_presentation_layer(&gsm_transpor_layer);
PubSubClient client(secure_presentation_layer);
// For read the MQTT events
-void callback(char *topic, byte *payload, unsigned int length)
+void callback(char *topic, uint8_t *payload, unsigned int length)
{
Serial.print("Message arrived [");
Serial.print(topic);
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/platformio.ini b/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/platformio.ini
index a36d62c..ed68aed 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/platformio.ini
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/platformio.ini
@@ -8,14 +8,17 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
-[env:esp-wrover-kit]
+; Default environment configuration
+[env]
platform = espressif32
-board = esp-wrover-kit
framework = arduino
+
+; Additional libraries and build flags common to all environments
lib_deps =
vshymanskyy/TinyGSM@^0.11.7
vshymanskyy/StreamDebugger@^1.0.1
- digitaldragon/SSLClient@^1.2.0
+ ; digitaldragon/SSLClient@^1.2.0
+ https://github.com/govorox/SSLClient#v1.3.0
arduino-libraries/ArduinoHttpClient@^0.6.0
build_flags =
-I include
@@ -24,3 +27,13 @@ build_flags =
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder, time
+
+; Specific environment configurations
+[env:esp32dev]
+board = esp32dev
+
+[env:esp32doit-devkit-v1]
+board = esp32doit-devkit-v1
+
+[env:esp-wrover-kit]
+board = esp-wrover-kit
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/src/main.cpp b/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/src/main.cpp
index c445405..717a3c7 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/src/main.cpp
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-alpn-protos/src/main.cpp
@@ -1,6 +1,6 @@
#include
-#include "SSLClient.h"
-#include
+#include
+#include
#include "ca_cert.h"
#include
@@ -148,7 +148,7 @@ void loop() {
httpClient.get("/a/check");
int status_code = httpClient.responseStatusCode();
- std::string response = httpClient.responseBody();
+ std::string response = httpClient.responseBody().c_str();
Serial.print("Status code: ");
Serial.println(status_code);
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/platformio.ini b/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/platformio.ini
index 764d5aa..58e4201 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/platformio.ini
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/platformio.ini
@@ -8,15 +8,16 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
-[env:esp-wrover-kit]
+[env]
platform = espressif32
-board = esp-wrover-kit
framework = arduino
lib_deps =
vshymanskyy/TinyGSM@^0.11.7
knolleary/PubSubClient@^2.8
vshymanskyy/StreamDebugger@^1.0.1
- digitaldragon/SSLClient@^1.2.0
+ ; digitaldragon/SSLClient@^1.2.0
+ https://github.com/govorox/SSLClient#v1.3.0
+ arduino-libraries/ArduinoHttpClient@^0.6.0
build_flags =
-I include
-D CORE_DEBUG_LEVEL=3
@@ -24,3 +25,12 @@ build_flags =
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder, time
+
+[env:esp32dev]
+board = esp32dev
+
+[env:esp32doit-devkit-v1]
+board = esp32doit-devkit-v1
+
+[env:esp-wrover-kit]
+board = esp-wrover-kit
\ No newline at end of file
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/src/main.cpp b/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/src/main.cpp
index 821aac3..580b167 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/src/main.cpp
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-aws/src/main.cpp
@@ -1,6 +1,6 @@
#include
-#include "SSLClient.h"
-#include
+#include
+#include
#include
#include
#include
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/platformio.ini b/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/platformio.ini
index f24b4cb..1d75d98 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/platformio.ini
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/platformio.ini
@@ -1,14 +1,8 @@
-[env:esp-wrover-kit]
+[env]
platform = espressif32
board = esp-wrover-kit
framework = arduino
-; Microcontroller config (ESP32-WROVER-E with 4MB Flash)
-board_build.f_flash = 80000000L
-board_upload.flash_size = 4MB
-board_upload.maximum_size = 4194304 ; 4MB in bytes
-board_build.partitions = default.csv ; Adjusted to default for 4MB flash
-
; Serial Monitor
monitor_speed = 115200
upload_speed = 921600
@@ -28,4 +22,20 @@ board_build.embed_files = data/crt/x509_crt_bundle.bin
; External libraries
lib_deps =
vshymanskyy/TinyGSM@^0.11.7
- digitaldragon/SSLClient@^1.2.0
+ ; digitaldragon/SSLClient@^1.2.0
+ https://github.com/govorox/SSLClient#v1.3.0
+
+[env:esp32dev]
+board = esp32dev
+
+[env:esp32doit-devkit-v1]
+board = esp32doit-devkit-v1
+
+[env:esp-wrover-kit]
+board = esp-wrover-kit
+
+; Microcontroller config (ESP32-WROVER-E with 4MB Flash)
+board_build.f_flash = 80000000L
+board_upload.flash_size = 4MB
+board_upload.maximum_size = 4194304 ; 4MB in bytes
+board_build.partitions = default.csv ; Adjusted to default for 4MB flash
\ No newline at end of file
diff --git a/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/src/main.cpp b/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/src/main.cpp
index 4d45e94..91553f6 100644
--- a/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/src/main.cpp
+++ b/examples/Esp32-platformIO/t-call-esp32-sim800l-cert-bundle/src/main.cpp
@@ -1,5 +1,5 @@
#include
-#include "SSLClient.h"
+#include
#include
#define MODEM_UART_BAUD 9600
diff --git a/library.json b/library.json
index 416f122..26d7ca1 100644
--- a/library.json
+++ b/library.json
@@ -1,6 +1,6 @@
{
"name": "SSLClient",
- "version": "1.2.0",
+ "version": "1.3.0",
"repository":
{
"type": "git",
diff --git a/library.properties b/library.properties
index 98104a9..e8690b7 100644
--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
name=GovoroxSSLClient
-version=1.2.0
+version=1.3.0
author=V Govorovski
maintainer=Robert Byrnes
sentence=Provides secure network connection over a generic Client transport object.
diff --git a/platformio.ini b/platformio.ini
index cb5a0c9..46c11c3 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -17,10 +17,13 @@ build_type = test
lib_deps =
digitaldragon/Emulation@0.1.6
throwtheswitch/Unity@^2.5.2
- # mbedtls=https://github.com/ARMmbed/mbedtls.git#mbedtls-2.28.0
lib_ldf_mode = deep+
build_unflags = -std=gnu++11
build_flags =
-std=gnu++17
-I test/mocks
-D SSL_CLIENT_TEST_ENVIRONMENT
+ ; -D MBEDTLS_VERSION_MAJOR=3
+ ; -D MBEDTLS_BACKPORT
+ ; -D _W5500_H_
+ ; -D W5500_WORKAROUND
diff --git a/src/SSLClient.cpp b/src/SSLClient.cpp
index dae9ae8..3a681fa 100644
--- a/src/SSLClient.cpp
+++ b/src/SSLClient.cpp
@@ -18,7 +18,7 @@
#include "SSLClient.h"
#include "certBundle.h"
-#include
+// #include
#undef connect
#undef write
diff --git a/src/SSLClient.h b/src/SSLClient.h
index fc5b711..0a6b5c1 100644
--- a/src/SSLClient.h
+++ b/src/SSLClient.h
@@ -18,7 +18,12 @@
#ifndef SSLCLIENT_H
#define SSLCLIENT_H
-#include "Arduino.h"
+
+#include "log_.h"
+
+#ifdef PLATFORMIO
+#include
+#endif
#include "IPAddress.h"
#include "ssl__client.h"
diff --git a/src/certBundle.c b/src/certBundle.c
index b2d6db6..b205751 100644
--- a/src/certBundle.c
+++ b/src/certBundle.c
@@ -53,7 +53,7 @@ static int esp_crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_k
// Fast check to avoid expensive computations when not necessary
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
if (!mbedtls_pk_can_do(&parent.pk, child->private_sig_pk)) {
#else
if (!mbedtls_pk_can_do(&parent.pk, child->sig_pk)) {
@@ -63,7 +63,7 @@ static int esp_crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_k
goto cleanup;
}
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
md_info = mbedtls_md_info_from_type(child->private_sig_md);
#else
md_info = mbedtls_md_info_from_type(child->sig_md);
@@ -72,7 +72,7 @@ static int esp_crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_k
log_e("Internal mbedTLS error %X", ret);
goto cleanup;
}
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
if ((ret = mbedtls_pk_verify_ext(child->private_sig_pk, child->private_sig_opts, &parent.pk, child->private_sig_md, hash, mbedtls_md_get_size( md_info ),
child->private_sig.p, child->private_sig.len )) != 0 ) {
#else
diff --git a/src/certBundle.h b/src/certBundle.h
index 43ba563..fe9e19b 100644
--- a/src/certBundle.h
+++ b/src/certBundle.h
@@ -16,6 +16,8 @@
#ifndef CERT_BUNDLE_H
#define CERT_BUNDLE_H
+#include "log_.h"
+
#ifndef SSL_CLIENT_TEST_ENVIRONMENT
#include "mbedtls/ssl.h"
#else
diff --git a/src/log_.h b/src/log_.h
new file mode 100644
index 0000000..d6c1abe
--- /dev/null
+++ b/src/log_.h
@@ -0,0 +1,65 @@
+/**
+ * @file log_.h
+ * @brief Log levels and macros
+ * @details This file contains the log levels and macros for logging.
+ * These exist to enable the library to used in different environments,
+ * namely the ESP-IDF and the Arduino framework.
+ */
+#ifndef LOG__H_
+#define LOG__H_
+
+#ifndef SSL_CLIENT_TEST_ENVIRONMENT
+
+#include
+
+#ifndef LOG_LEVEL_NONE
+#define LOG_LEVEL_NONE 0
+#endif
+
+#ifndef LOG_LEVEL_ERROR
+#define LOG_LEVEL_ERROR 1
+#endif
+
+#ifndef LOG_LEVEL_WARN
+#define LOG_LEVEL_WARN 2
+#endif
+
+#ifndef LOG_LEVEL_INFO
+#define LOG_LEVEL_INFO 3
+#endif
+
+#ifndef LOG_LEVEL_DEBUG
+#define LOG_LEVEL_DEBUG 4
+#endif
+
+#ifndef LOG_LEVEL_VERBOSE
+#define LOG_LEVEL_VERBOSE 5
+#endif
+
+#ifndef LOG_LEVEL
+#define LOG_LEVEL LOG_LEVEL_VERBOSE // Change this to set the log level
+#endif
+
+#ifndef log_e
+#define log_e(...) if (LOG_LEVEL >= LOG_LEVEL_ERROR) { Serial.printf("E ("); Serial.printf(__VA_ARGS__); Serial.println(")"); }
+#endif
+
+#ifndef log_w
+#define log_w(...) if (LOG_LEVEL >= LOG_LEVEL_WARN) { Serial.printf("W ("); Serial.printf(__VA_ARGS__); Serial.println(")"); }
+#endif
+
+#ifndef log_i
+#define log_i(...) if (LOG_LEVEL >= LOG_LEVEL_INFO) { Serial.printf("I ("); Serial.printf(__VA_ARGS__); Serial.println(")"); }
+#endif
+
+#ifndef log_d
+#define log_d(...) if (LOG_LEVEL >= LOG_LEVEL_DEBUG) { Serial.printf("D ("); Serial.printf(__VA_ARGS__); Serial.println(")"); }
+#endif
+
+#ifndef log_v
+#define log_v(...) if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) { Serial.printf("V ("); Serial.printf(__VA_ARGS__); Serial.println(")"); }
+#endif
+
+#endif // SSL_CLIENT_TEST_ENVIRONMENT
+
+#endif // LOG__H_
\ No newline at end of file
diff --git a/src/ssl__client.cpp b/src/ssl__client.cpp
index e4ee2bc..bd8a674 100644
--- a/src/ssl__client.cpp
+++ b/src/ssl__client.cpp
@@ -6,16 +6,12 @@
* Additions Copyright (C) 2017 Evandro Luis Copercini, Apache 2.0 License.
* Additions Copyright (C) 2019 Vadim Govorovski.
*/
-
-#include "Arduino.h"
-#include
-#include
+#ifdef PLATFORMIO
+#include
+#endif
#include "ssl__client.h"
#include "certBundle.h"
-//#define ARDUHAL_LOG_LEVEL 5
-//#include
-
#if !defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
# error "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
#endif
@@ -576,7 +572,7 @@ int auth_client_cert_key(sslclient__context *ssl_client, const char *cli_cert, c
}
log_v("Loading private key");
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ctr_drbg_init(&ctr_drbg);
ret = mbedtls_pk_parse_key(&ssl_client->client_key, (const unsigned char *)cli_key, strlen(cli_key) + 1, NULL, 0, mbedtls_ctr_drbg_random, &ctr_drbg);
@@ -730,9 +726,16 @@ int perform_ssl_handshake(sslclient__context *ssl_client, const char *cli_cert,
unsigned long handshake_start_time = millis();
log_d("calling mbedtls_ssl_handshake with ssl_ctx address %p", (void *)&ssl_client->ssl_ctx);
+ int loopCount = 0;
while ((ret = mbedtls_ssl_handshake(&ssl_client->ssl_ctx)) != 0) {
+ loopCount++;
+ #if defined(_W5500_H_) || defined(W5500_WORKAROUND)
+ if (ret == -1 && loopCount < 200) {
+ continue; // Treat -1 as a non-error for up to 200 iterations
+ }
+ #endif
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
- break;
+ break; // Break on any other error
}
if ((millis()-handshake_start_time) > ssl_client->handshake_timeout) {
@@ -821,7 +824,7 @@ void stop_ssl_socket(sslclient__context *ssl_client, const char *rootCABuff, con
log_d("Stopping SSL client. Current client pointer address: %p", (void *)ssl_client->client);
ssl_client->client->stop();
}
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
if (ssl_client->ssl_conf.private_ca_chain != NULL) {
#else
if (ssl_client->ssl_conf.ca_chain != NULL) {
@@ -831,7 +834,7 @@ void stop_ssl_socket(sslclient__context *ssl_client, const char *rootCABuff, con
// Free the memory associated with the CA certificate
mbedtls_x509_crt_free(&ssl_client->ca_cert);
}
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
if (ssl_client->ssl_conf.private_key_cert != NULL) {
#else
if (ssl_client->ssl_conf.key_cert != NULL) {
diff --git a/src/ssl__client.h b/src/ssl__client.h
index bc04112..dc009db 100644
--- a/src/ssl__client.h
+++ b/src/ssl__client.h
@@ -12,7 +12,7 @@
#include
#include
#include
-#if (MBEDTLS_VERSION_MAJOR >= 3)
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
#include
#else
#include
diff --git a/test/mocks/MbedTLS.h b/test/mocks/MbedTLS.h
index 9ac177b..08b624d 100644
--- a/test/mocks/MbedTLS.h
+++ b/test/mocks/MbedTLS.h
@@ -105,8 +105,13 @@ struct mbedtls_x509_crt {
mbedtls_x509_buf tbs;
};
struct mbedtls_ssl_config {
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
+ void* private_ca_chain;
+ void* private_key_cert;
+#else
void* ca_chain;
void* key_cert;
+#endif
mbedtls_x509_crt* actual_ca_chain;
mbedtls_x509_crt* actual_key_cert;
};
@@ -361,11 +366,24 @@ int mbedtls_ssl_conf_psk(mbedtls_ssl_config *conf, const unsigned char *psk, siz
return mbedtls_ssl_conf_psk_stub.mock("mbedtls_ssl_conf_psk");
}
+FunctionEmulator mbedtls_ctr_drbg_random_stub("mbedtls_ctr_drbg_random");
+int mbedtls_ctr_drbg_random(void *p_rng, unsigned char *output, size_t output_len) {
+ mbedtls_ctr_drbg_random_stub.recordFunctionCall();
+ return mbedtls_ctr_drbg_random_stub.mock("mbedtls_ctr_drbg_random");
+}
+
FunctionEmulator mbedtls_pk_parse_key_stub("mbedtls_pk_parse_key");
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
+int mbedtls_pk_parse_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen, const unsigned char *pwd, size_t pwdlen, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng) {
+ mbedtls_pk_parse_key_stub.recordFunctionCall();
+ return mbedtls_pk_parse_key_stub.mock("mbedtls_pk_parse_key");
+}
+#else
int mbedtls_pk_parse_key(mbedtls_pk_context *pk, const unsigned char *key, size_t keylen, const unsigned char *pwd, size_t pwdlen) {
mbedtls_pk_parse_key_stub.recordFunctionCall();
return mbedtls_pk_parse_key_stub.mock("mbedtls_pk_parse_key");
}
+#endif
FunctionEmulator mbedtls_ssl_conf_own_cert_stub("mbedtls_ssl_conf_own_cert");
int mbedtls_ssl_conf_own_cert(mbedtls_ssl_config *conf, mbedtls_x509_crt *own_cert, mbedtls_pk_context *pk_key) {
@@ -379,12 +397,6 @@ int mbedtls_ssl_set_hostname(mbedtls_ssl_context *ssl, const char *hostname) {
return mbedtls_ssl_set_hostname_stub.mock("mbedtls_ssl_set_hostname");
}
-FunctionEmulator mbedtls_ctr_drbg_random_stub("mbedtls_ctr_drbg_random");
-int mbedtls_ctr_drbg_random(void *p_rng, unsigned char *output, size_t output_len) {
- mbedtls_ctr_drbg_random_stub.recordFunctionCall();
- return mbedtls_ctr_drbg_random_stub.mock("mbedtls_ctr_drbg_random");
-}
-
FunctionEmulator mbedtls_ssl_setup_stub("mbedtls_ssl_setup");
int mbedtls_ssl_setup(mbedtls_ssl_context *ssl, const mbedtls_ssl_config *conf) {
mbedtls_ssl_setup_stub.recordFunctionCall();
diff --git a/test/mocks/TestClient.h b/test/mocks/TestClient.h
index eaba844..58e22b3 100644
--- a/test/mocks/TestClient.h
+++ b/test/mocks/TestClient.h
@@ -18,7 +18,7 @@ class TestClient : public Client, public Emulator {
return this->mock("connect");
}
- size_t write(uint8_t byte) override {
+ size_t write(uint8_t a_byte_) override {
return this->mock("write");
}
diff --git a/test/unit_test_private_api.cpp b/test/unit_test_private_api.cpp
index 0085723..529eb5a 100644
--- a/test/unit_test_private_api.cpp
+++ b/test/unit_test_private_api.cpp
@@ -25,8 +25,13 @@ sslclient__context *testContext; // Context for tests
void setup_stop_ssl_socket(sslclient__context* ctx, Client* client) {
ctx->ssl_conf.actual_ca_chain = (mbedtls_x509_crt*) malloc(sizeof(mbedtls_x509_crt));
ctx->ssl_conf.actual_key_cert = &dummy_cert;
+#if (MBEDTLS_VERSION_MAJOR >= 3) && !defined(MBEDTLS_BACKPORT)
+ ctx->ssl_conf.private_ca_chain = ctx->ssl_conf.actual_ca_chain;
+ ctx->ssl_conf.private_key_cert = ctx->ssl_conf.actual_key_cert;
+#else
ctx->ssl_conf.ca_chain = ctx->ssl_conf.actual_ca_chain;
ctx->ssl_conf.key_cert = ctx->ssl_conf.actual_key_cert;
+#endif
}
void setUp(void) {