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

View File

@ -20,6 +20,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "BearSSLHelpers.h"
#include <memory>
#include <vector>
#include <bearssl/bearssl.h>
@ -28,7 +29,10 @@
#include <string.h>
#include <Arduino.h>
#include <StackThunk.h>
#include "BearSSLHelpers.h"
#include <Updater_Signing.h>
#ifndef ARDUINO_SIGNING
#define ARDUINO_SIGNING 0
#endif
namespace brssl {
// 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
};
#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 <Updater.h>
// Internal opaque structures, not needed by user applications
namespace brssl {
class public_key;