1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

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
This commit is contained in:
Dirk O. Kaar 2019-08-28 20:07:04 +02:00 committed by Earle F. Philhower, III
parent 05969c6bf2
commit e201f614e8
3 changed files with 24 additions and 8 deletions

View File

@ -1,5 +1,4 @@
#include "Updater.h" #include "Updater.h"
#include "Arduino.h"
#include "eboot_command.h" #include "eboot_command.h"
#include <esp8266_peri.h> #include <esp8266_peri.h>
@ -11,10 +10,10 @@
#endif #endif
#if ARDUINO_SIGNING #if ARDUINO_SIGNING
#include "../../libraries/ESP8266WiFi/src/BearSSLHelpers.h" namespace esp8266 {
static BearSSL::PublicKey signPubKey(signing_pubkey); extern UpdaterHashClass& updaterSigningHash;
static BearSSL::HashSHA256 hash; extern UpdaterVerifyClass& updaterSigningVerifier;
static BearSSL::SigningVerifier sign(&signPubKey); }
#endif #endif
extern "C" { extern "C" {
@ -39,7 +38,7 @@ UpdaterClass::UpdaterClass()
, _progress_callback(nullptr) , _progress_callback(nullptr)
{ {
#if ARDUINO_SIGNING #if ARDUINO_SIGNING
installSignature(&hash, &sign); installSignature(&esp8266::updaterSigningHash, &esp8266::updaterSigningVerifier);
#endif #endif
} }

View File

@ -20,6 +20,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "BearSSLHelpers.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <bearssl/bearssl.h> #include <bearssl/bearssl.h>
@ -28,7 +29,10 @@
#include <string.h> #include <string.h>
#include <Arduino.h> #include <Arduino.h>
#include <StackThunk.h> #include <StackThunk.h>
#include "BearSSLHelpers.h" #include <Updater_Signing.h>
#ifndef ARDUINO_SIGNING
#define ARDUINO_SIGNING 0
#endif
namespace brssl { namespace brssl {
// Code here is pulled from brssl sources, with the copyright and license // Code here is pulled from brssl sources, with the copyright and license
@ -901,3 +905,17 @@ make_stack_thunk(br_ssl_engine_sendrec_buf);
#endif #endif
}; };
#if ARDUINO_SIGNING
namespace {
static BearSSL::PublicKey signingPubKey(signing_pubkey);
static BearSSL::HashSHA256 __signingHash;
static BearSSL::SigningVerifier __signingVerifier(&signingPubKey);
};
namespace esp8266 {
UpdaterHashClass& updaterSigningHash = __signingHash;
UpdaterVerifyClass& updaterSigningVerifier = __signingVerifier;
};
#endif

View File

@ -26,7 +26,6 @@
#include <bearssl/bearssl.h> #include <bearssl/bearssl.h>
#include <Updater.h> #include <Updater.h>
// Internal opaque structures, not needed by user applications // Internal opaque structures, not needed by user applications
namespace brssl { namespace brssl {
class public_key; class public_key;