Skip to content

Commit e201f61

Browse files
dok-netearlephilhower
authored andcommitted
Fix reverse dependency core Updater -> library ESP8266WiFi (#6398)
* Per @earlephilhower suggestion * Hints from @earlephilhower * Namespace BearSSL in core "feels" wrong - using catch-all esp8266 instead. * After review remarks by @earlephilhower
1 parent 05969c6 commit e201f61

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

cores/esp8266/Updater.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "Updater.h"
2-
#include "Arduino.h"
32
#include "eboot_command.h"
43
#include <esp8266_peri.h>
54

@@ -11,10 +10,10 @@
1110
#endif
1211

1312
#if ARDUINO_SIGNING
14-
#include "../../libraries/ESP8266WiFi/src/BearSSLHelpers.h"
15-
static BearSSL::PublicKey signPubKey(signing_pubkey);
16-
static BearSSL::HashSHA256 hash;
17-
static BearSSL::SigningVerifier sign(&signPubKey);
13+
namespace esp8266 {
14+
extern UpdaterHashClass& updaterSigningHash;
15+
extern UpdaterVerifyClass& updaterSigningVerifier;
16+
}
1817
#endif
1918

2019
extern "C" {
@@ -39,7 +38,7 @@ UpdaterClass::UpdaterClass()
3938
, _progress_callback(nullptr)
4039
{
4140
#if ARDUINO_SIGNING
42-
installSignature(&hash, &sign);
41+
installSignature(&esp8266::updaterSigningHash, &esp8266::updaterSigningVerifier);
4342
#endif
4443
}
4544

libraries/ESP8266WiFi/src/BearSSLHelpers.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2121
*/
2222

23+
#include "BearSSLHelpers.h"
2324
#include <memory>
2425
#include <vector>
2526
#include <bearssl/bearssl.h>
@@ -28,7 +29,10 @@
2829
#include <string.h>
2930
#include <Arduino.h>
3031
#include <StackThunk.h>
31-
#include "BearSSLHelpers.h"
32+
#include <Updater_Signing.h>
33+
#ifndef ARDUINO_SIGNING
34+
#define ARDUINO_SIGNING 0
35+
#endif
3236

3337
namespace brssl {
3438
// Code here is pulled from brssl sources, with the copyright and license
@@ -901,3 +905,17 @@ make_stack_thunk(br_ssl_engine_sendrec_buf);
901905
#endif
902906

903907
};
908+
909+
#if ARDUINO_SIGNING
910+
namespace {
911+
static BearSSL::PublicKey signingPubKey(signing_pubkey);
912+
static BearSSL::HashSHA256 __signingHash;
913+
static BearSSL::SigningVerifier __signingVerifier(&signingPubKey);
914+
};
915+
916+
namespace esp8266 {
917+
UpdaterHashClass& updaterSigningHash = __signingHash;
918+
UpdaterVerifyClass& updaterSigningVerifier = __signingVerifier;
919+
};
920+
#endif
921+

libraries/ESP8266WiFi/src/BearSSLHelpers.h

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <bearssl/bearssl.h>
2727
#include <Updater.h>
2828

29-
3029
// Internal opaque structures, not needed by user applications
3130
namespace brssl {
3231
class public_key;

0 commit comments

Comments
 (0)