add TLS support for all boards

This commit is contained in:
proddy
2026-05-25 12:32:53 +02:00
parent cef5e69aa1
commit 46c5560222
20 changed files with 485 additions and 207 deletions

View File

@@ -0,0 +1,72 @@
// standalone stub for ESP_SSLClient (BearSSL) - no-op TLS on host build
// Inherits from Stream so it gets print/println via Print, matching the real API.
#ifndef ESP_SSLClient_h
#define ESP_SSLClient_h
#include <stddef.h>
#include <stdint.h>
#include "Arduino.h"
#include "Stream.h"
#include "WiFiClient.h"
#include <ClientPosixIPAddress.h>
class ESP_SSLClient : public Stream {
public:
ESP_SSLClient() = default;
void setInsecure() {
}
void setCACert(const char *) {
}
void setCertificate(const char *) {
}
void setPrivateKey(const char *) {
}
void setBufferSizes(int, int) {
}
void setSessionTimeout(int) {
}
void setClient(WiFiClient *) {
}
void setClient(WiFiClient *, bool) {
}
int connect(IPAddress, uint16_t) {
return 0;
}
int connect(const char *, uint16_t) {
return 0;
}
bool connected() {
return false;
}
// Stream / Print overrides
int available() override {
return 0;
}
int read() override {
return -1;
}
int read(uint8_t *, size_t) {
return 0;
}
int peek() override {
return -1;
}
size_t write(uint8_t) override {
return 0;
}
size_t write(const uint8_t *, size_t) override {
return 0;
}
void flush() override {
}
void stop() {
}
};
#endif // ESP_SSLClient_h

View File

@@ -0,0 +1,49 @@
// standalone stub for WiFiClient (no-op networking on host build)
#ifndef WiFiClient_h
#define WiFiClient_h
#include <stddef.h>
#include <stdint.h>
#include "Arduino.h"
#include <ClientPosixIPAddress.h>
class WiFiClient {
public:
WiFiClient() = default;
int connect(IPAddress, uint16_t) {
return 0;
}
int connect(const char *, uint16_t) {
return 0;
}
bool connected() {
return false;
}
int available() {
return 0;
}
int read() {
return -1;
}
int read(uint8_t *, size_t) {
return 0;
}
size_t write(uint8_t) {
return 0;
}
size_t write(const uint8_t *, size_t) {
return 0;
}
void stop() {
}
// ESP32 socket option passthrough (e.g. TCP_NODELAY)
int setSocketOption(int, int, const void *, size_t) {
return 0;
}
};
#endif // WiFiClient_h

View File

@@ -0,0 +1,10 @@
// standalone stub for <lwip/sockets.h>
// pulls in POSIX equivalents on the host build for things like IPPROTO_TCP / TCP_NODELAY.
#ifndef LWIP_SOCKETS_STUB_H_
#define LWIP_SOCKETS_STUB_H_
#include <netinet/in.h>
#include <netinet/tcp.h>
#endif // LWIP_SOCKETS_STUB_H_