From e3c7c0b482cb31e4bfa741a4446a1dcb64bdf717 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" <earlephilhower@yahoo.com> Date: Sun, 10 May 2020 15:09:15 -0700 Subject: [PATCH] Allocate BSSL stack for SigningVerifier 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 282bab9cfb..5c1b67546c 100644 --- a/libraries/ESP8266WiFi/src/BearSSLHelpers.h +++ b/libraries/ESP8266WiFi/src/BearSSLHelpers.h @@ -24,6 +24,7 @@ #define _BEARSSLHELPERS_H #include <bearssl/bearssl.h> +#include <StackThunk.h> #include <Updater.h> // 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;