From 6f614c07f43711459c145e0149737597012aa87e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Aug 2023 12:05:23 +0700 Subject: [PATCH] Add support Arduino UNO R4 WiFi. --- .github/workflows/compile_library.yml | 1 + library.json | 4 ++-- library.properties | 4 ++-- src/ESP_SSLClient.h | 4 ++-- src/client/BSSL_Helper.cpp | 15 +++++++++++++-- src/client/BSSL_TCP_Client.cpp | 6 ++++-- src/client/BSSL_TCP_Client.h | 10 ++++++++-- 7 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/compile_library.yml b/.github/workflows/compile_library.yml index 665b263..985d505 100644 --- a/.github/workflows/compile_library.yml +++ b/.github/workflows/compile_library.yml @@ -28,6 +28,7 @@ jobs: - "bluepill_f103c8_128k" - "mkr1000USB" - "teensy41" + - "renesas-ra" steps: - uses: actions/checkout@v2 - name: Cache pip diff --git a/library.json b/library.json index f6e7e9e..fb290b2 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESP_SSLClient", - "version": "2.0.7", + "version": "2.0.8", "keywords": "communication, REST, esp32, esp8266, arduino", "description": "This library provided the Secure Layer Networking (SSL/TLS) TCP Client for ESP8266, ESP32 and Raspberry Pi RP2040, Teensy, SAMD, AVR and other Arduino devices that support external networking interfaces e.g., WiFiClient, EthernetClient and GSMClient.", "repository": { @@ -12,5 +12,5 @@ "email": "k_suwatchai@hotmail.com" }], "frameworks": "arduino", - "platforms": "espressif32, espressif8266, atmelsam, rp2040, atmelavr, atmelmegaavr, ststm32, teensy" + "platforms": "espressif32, espressif8266, atmelsam, atmelavr, atmelmegaavr, ststm32, teensy, rp2040, renesas-ra" } \ No newline at end of file diff --git a/library.properties b/library.properties index 05f1a9c..4828ae1 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=ESP_SSLClient -version=2.0.7 +version=2.0.8 author=Mobizt @@ -14,4 +14,4 @@ category=Communication url=https://github.com/mobizt/ESP_SSLClient.git -architectures=esp8266,esp32,sam,samd,stm32,STM32F1,STM32F4,teensy,avr,megaavr,mbed_nano,mbed_rp2040,rp2040 +architectures=esp8266, esp32, sam,samd, stm32, STM32F1, STM32F4, teensy, avr, megaavr, mbed_nano, mbed_rp2040, rp2040, mbed_nano, mbed_portenta, mbed_nicla, mbed_opta, mbed_giga, renesas_portenta, renesas_uno diff --git a/src/ESP_SSLClient.h b/src/ESP_SSLClient.h index 40449d6..0ececdc 100644 --- a/src/ESP_SSLClient.h +++ b/src/ESP_SSLClient.h @@ -1,8 +1,8 @@ /** * - * The ESP SSL Client Class, ESP_SSLClient.h v2.0.7 + * The ESP SSL Client Class, ESP_SSLClient.h v2.0.8 * - * Created August 6, 2023 + * Created August 8, 2023 * * The MIT License (MIT) * Copyright (c) 2023 K. Suwatchai (Mobizt) diff --git a/src/client/BSSL_Helper.cpp b/src/client/BSSL_Helper.cpp index 218e1bb..588a58a 100644 --- a/src/client/BSSL_Helper.cpp +++ b/src/client/BSSL_Helper.cpp @@ -37,7 +37,7 @@ #include #include #if defined __has_include -#if __has_include() +#if __has_include() #include #endif #endif @@ -112,6 +112,7 @@ namespace key_bssl bool looks_like_DER(const unsigned char *buf, size_t len); pem_object *decode_pem(const void *src, size_t len, size_t *num); void free_pem_object_contents(pem_object *po); + char *strdupImpl(const char *s); // Used as callback multiple places to append a string to a vector static void byte_vector_append(void *ctx, const void *buff, size_t len) @@ -283,6 +284,16 @@ namespace key_bssl } } + char *strdupImpl(const char *s) + { + size_t slen = strlen(s); + char *result = (char *)malloc(slen + 1); + if (!result) + return NULL; + memcpy(result, s, slen + 1); + return result; + } + // Converts a PEM (~=base64) source into a set of DER-encoded binary blobs. // Each blob is named by the ---- BEGIN xxx ---- field, and multiple // blobs may be returned. @@ -317,7 +328,7 @@ namespace key_bssl switch (br_pem_decoder_event(pc.get())) { case BR_PEM_BEGIN_OBJ: - po.name = strdup(br_pem_decoder_name(pc.get())); + po.name = strdupImpl(br_pem_decoder_name(pc.get())); br_pem_decoder_setdest(pc.get(), byte_vector_append, &bv); inobj = true; break; diff --git a/src/client/BSSL_TCP_Client.cpp b/src/client/BSSL_TCP_Client.cpp index 3e5a5f9..8c87046 100644 --- a/src/client/BSSL_TCP_Client.cpp +++ b/src/client/BSSL_TCP_Client.cpp @@ -1,7 +1,7 @@ /** - * BSSL_TCP_Client v2.0.5 for Arduino devices. + * BSSL_TCP_Client v2.0.6 for Arduino devices. * - * Created August 6, 2023 + * Created August 8, 2023 * * The MIT License (MIT) * Copyright (c) 2023 K. Suwatchai (Mobizt) @@ -277,6 +277,8 @@ int BSSL_TCP_Client::setTimeout(uint32_t seconds) return 1; } +int BSSL_TCP_Client::getTimeout() { return _ssl_client.getTimeout() / 1000; } + void BSSL_TCP_Client::setHandshakeTimeout(unsigned long handshake_timeout) { _handshake_timeout = handshake_timeout * 1000; diff --git a/src/client/BSSL_TCP_Client.h b/src/client/BSSL_TCP_Client.h index f67255f..d70d2bb 100644 --- a/src/client/BSSL_TCP_Client.h +++ b/src/client/BSSL_TCP_Client.h @@ -1,7 +1,7 @@ /** - * BSSL_TCP_Client v2.0.5 for Arduino devices. + * BSSL_TCP_Client v2.0.6 for Arduino devices. * - * Created August 6, 2023 + * Created August 8, 2023 * * The MIT License (MIT) * Copyright (c) 2023 K. Suwatchai (Mobizt) @@ -285,6 +285,12 @@ class BSSL_TCP_Client : public Client */ int setTimeout(uint32_t seconds); + /** + * Get the TCP timeout in seconds. + * @return The TCP timeout in seconds. + */ + int getTimeout(); + /** * Set the SSL handshake timeout in seconds. * @param handshake_timeout The SSL handshake timeout in seconds.