From c5f60e31cd1afa839a823c9f376ce3a0fdc2144c Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 15 May 2020 20:21:50 -0700 Subject: [PATCH] Allocate BSSL stack for SigningVerifier (#7291) The BearSSL SigningVerifier was moved to the 2nd stack because some uses required much more stack than available on the normal stack. Add a reference to the second stack on object creation (which will allocate it, if there is no BSSL stack already allocated), and delete that reference on exit. Fixes #7288 --- libraries/ESP8266WiFi/src/BearSSLHelpers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/ESP8266WiFi/src/BearSSLHelpers.h b/libraries/ESP8266WiFi/src/BearSSLHelpers.h index 282bab9cf..5c1b67546 100644 --- a/libraries/ESP8266WiFi/src/BearSSLHelpers.h +++ b/libraries/ESP8266WiFi/src/BearSSLHelpers.h @@ -24,6 +24,7 @@ #define _BEARSSLHELPERS_H #include +#include #include // Internal opaque structures, not needed by user applications @@ -157,7 +158,8 @@ class SigningVerifier : public UpdaterVerifyClass { virtual bool verify(UpdaterHashClass *hash, const void *signature, uint32_t signatureLen) override; public: - SigningVerifier(PublicKey *pubKey) { _pubKey = pubKey; } + SigningVerifier(PublicKey *pubKey) { _pubKey = pubKey; stack_thunk_add_ref(); } + ~SigningVerifier() { stack_thunk_del_ref(); } private: PublicKey *_pubKey;