Skip to content

Commit

Permalink
Allocate BSSL stack for SigningVerifier (#7291)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
earlephilhower authored May 16, 2020
1 parent 157ce57 commit c5f60e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/ESP8266WiFi/src/BearSSLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c5f60e3

Please sign in to comment.