Skip to main content
deleted 92 characters in body; edited title
Source Link
ocrdu
  • 1.8k
  • 3
  • 12
  • 24

Weird Behaviourbehaviour with BearSSL on GPIO ESP8266

I use GPIO 5 to trigger a relay, my. My code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without

Without the BearSSL certificates, when the espESP restarts it does not re-trigger the relay, and the GPIO maintains its state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, causebecause I removed components offrom my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
     
static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
     
void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines the LED on GPIO 5 does not flicker on restarts, but adding these lines makes them flicker:

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

Weird Behaviour with BearSSL on GPIO ESP8266

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

Weird behaviour with BearSSL on GPIO ESP8266

I use GPIO 5 to trigger a relay. My code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions.

Without the BearSSL certificates, when the ESP restarts it does not re-trigger the relay, and the GPIO maintains its state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, because I removed components from my code until I could find the piece of code that caused this, and it was because of the declarations.

#include <WiFiClientSecure.h> 
 
static const char AWS_CERT_CA[] PROGMEM = R"EOF(aws root)EOF"; 
static const char AWS_CERT_CRT[] PROGMEM = R"KEY(device cert)KEY";
static const char AWS_CERT_KEY[] PROGMEM = R"KEY(device key)KEY";
     
BearSSL::X509List cert(AWS_CERT_CA);
BearSSL::X509List client_crt(AWS_CERT_CRT);
BearSSL::PrivateKey key(AWS_CERT_KEY);
     
WiFiClientSecure espClient;
 
void setup() {
  pinMode(5, OUTPUT);
  delay(2000);
  digitalWrite(5, HIGH);
  delay(2000);
  ESP.restart();
}
    
void loop() {}

Without the following three lines the LED on GPIO 5 does not flicker on restarts, but adding these lines makes them flicker:

BearSSL::X509List cert(AWS_CERT_CA); 
BearSSL::X509List client_crt(AWS_CERT_CRT); 
BearSSL::PrivateKey key(AWS_CERT_KEY); 

Any solution or suggestion towards a solution for this problem will be really helpful.

Bumped by Community user
Bumped by Community user
Corrected typo and added language to codefence for syntax highlighting
Source Link
Greenonline
  • 3.2k
  • 7
  • 37
  • 49

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its'its state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its' state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

Corrected typo and added language to codefence for syntax highlighting
Source Link

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its' state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it? I

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that causescaused this, and it was because of the declarations.

#include <WiFiClientSecure.h> 
static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
aws root)EOF"; 
 
static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
device cert)KEY";
 
static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
device key )KEY";
 
BearSSL::X509List cert(AWS_CERT_CA);
BearSSL::X509List client_crt(AWS_CERT_CRT);
BearSSL::PrivateKey key(AWS_CERT_KEY);
 
WiFiClientSecure espClient;
void setup() {
  pinMode(5, OUTPUT);
  delay(2000);
  digitalWrite(5, HIGH);
  delay(2000);
  ESP.restart();
 }

void loop() {}
    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

BearSSL::X509List cert(AWS_CERT_CA); 
BearSSL::X509List client_crt(AWS_CERT_CRT); 
BearSSL::PrivateKey key(AWS_CERT_KEY); 
    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its' state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it? I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that causes this, and it was because of the declarations.

#include <WiFiClientSecure.h> 
static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
aws root)EOF"; 
 
static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
device cert)KEY";
 
static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
device key )KEY";
 
BearSSL::X509List cert(AWS_CERT_CA);
BearSSL::X509List client_crt(AWS_CERT_CRT);
BearSSL::PrivateKey key(AWS_CERT_KEY);
 
WiFiClientSecure espClient;
void setup() {
  pinMode(5, OUTPUT);
  delay(2000);
  digitalWrite(5, HIGH);
  delay(2000);
  ESP.restart();
 }

void loop() {}

Without the following three lines

BearSSL::X509List cert(AWS_CERT_CA); 
BearSSL::X509List client_crt(AWS_CERT_CRT); 
BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp restarts it does not re-trigger the relay, and the GPIO maintains its' state between reboots, but when I use the bearSSL certificates the behavior changes, and GPIO 5 goes low on restart. Any explanation why and how to mitigate it?

I am 100% sure it is because of the import, cause I removed components of my code until I could find the piece of code that caused this, and it was because of the declarations.

    #include <WiFiClientSecure.h> 
    static const char AWS_CERT_CA[] PROGMEM = R"EOF( 
    aws root)EOF"; 
     
    static const char AWS_CERT_CRT[] PROGMEM = R"KEY(
    device cert)KEY";
     
    static const char AWS_CERT_KEY[] PROGMEM = R"KEY(
    device key )KEY";
     
    BearSSL::X509List cert(AWS_CERT_CA);
    BearSSL::X509List client_crt(AWS_CERT_CRT);
    BearSSL::PrivateKey key(AWS_CERT_KEY);
     
    WiFiClientSecure espClient;
    void setup() {
      pinMode(5, OUTPUT);
      delay(2000);
      digitalWrite(5, HIGH);
      delay(2000);
      ESP.restart();
     }
    
    void loop() {}

Without the following three lines

    BearSSL::X509List cert(AWS_CERT_CA); 
    BearSSL::X509List client_crt(AWS_CERT_CRT); 
    BearSSL::PrivateKey key(AWS_CERT_KEY); 

The LED on GPIO 5 does not flicker on restarts but adding these lines makes them flicker. Any solution or suggestion towards a solution for this problem will be really helpful.

Source Link
Loading