8000 Fix reverse dependency core Updater -> library ESP8266WiFi by dok-net · Pull Request #6398 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Fix reverse dependency core Updater -> library ESP8266WiFi #6398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hints from @earlephilhower
  • Loading branch information
dok-net committed Aug 18, 2019
commit a1843c89be3fedf3a48cedc577398574717f1ef8
4 changes: 3 additions & 1 deletion cores/esp8266/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#endif

#if ARDUINO_SIGNING
namespace BearSSL {
extern UpdaterHashClass& hash;
extern UpdaterVerifyClass& sign;
}
#endif

extern "C" {
Expand All @@ -36,7 +38,7 @@ UpdaterClass::UpdaterClass()
, _progress_callback(nullptr)
{
#if ARDUINO_SIGNING
installSignature(&hash, &sign);
installSignature(&BearSSL::hash, &BearSSL::sign);
#endif
}

Expand Down
19 changes: 11 additions & 8 deletions libraries/ESP8266WiFi/src/BearSSLHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "BearSSLHelpers.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the move of this include before the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this idiom as good practice to ensure that headers are self contained - I don't want other people having to find out the hard way that some header dependencies must be manually resolved each time.

#include <memory>
#include <vector>
#include <bearssl/bearssl.h>
Expand All @@ -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
Expand Down Expand Up @@ -901,13 +905,12 @@ make_stack_thunk(br_ssl_engine_sendrec_buf);
#endif

#if ARDUINO_SIGNING
namespace {
static PublicKey signPubKey(signing_pubkey);
static HashSHA256 __hash;
static SigningVerifier __sign(&signPubKey);
}
extern UpdaterHashClass& hash = __hash;
extern UpdaterVerifyClass& sign = __sign;
static PublicKey signPubKey(signing_pubkey);
static HashSHA256 __hash;
static SigningVerifier __sign(&signPubKey);

UpdaterHashClass& hash = __hash;
UpdaterVerifyClass& sign = __sign;
#endif

};
1 change: 0 additions & 1 deletion libraries/ESP8266WiFi/src/BearSSLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <bearssl/bearssl.h>
#include <Updater.h>


// Internal opaque structures, not needed by user applications
namespace brssl {
class public_key;
Expand Down
0