Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP8266EX / NodeMCU 1.0
- Core Version: master @ 56bbb99
- Development Env: Platformio
- Operating System: Arch Linux
Settings in IDE
- Module: Nodemcu
- Flash Mode: ?
- Flash Size: 4MB
- lwip Variant: ?
- Reset Method: nodemcu
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: OTA + SERIAL
- Upload Speed: 115200
Problem Description
OTA Update freezes at signature verification.
It seems to freeze at:
When patching the ifdef
to not use the thunked call, it works for me:
@@ -899,7 +899,7 @@
bool SigningVerifier::verify(UpdaterHashClass *hash, const void *signature, uint32_t signatureLen) {
if (!_pubKey || !hash || !signature || signatureLen != length()) return false;
-#if !CORE_MOCK
+#if CORE_MOCK
return thunk_SigningVerifier_verify(_pubKey, hash, signature, signatureLen);
#else
return SigningVerifier_verify(_pubKey, hash, signature, signatureLen);
Sketch
#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
BearSSL::PublicKey signPubKey{R"(-----BEGIN PUBLIC KEY----- <public key> -----END PUBLIC KEY-----)"};
BearSSL::HashSHA256 hash;
BearSSL::SigningVerifier sign{&signPubKey};
const char *ssid = "<ssid>";
const char *password = "<password>";
WiFiEventHandler gotIpEventHandler, disconnectedEventHandler;
bool wifiConnected = false;
const char *ip;
void setupWifi() {
gotIpEventHandler =
WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP &event) {
ip = WiFi.localIP().toString().c_str();
wifiConnected = true;
Serial.print("Station connected, IP: ");
Serial.println(ip);
});
disconnectedEventHandler = WiFi.onStationModeDisconnected(
[](const WiFiEventStationModeDisconnected &event) {
wifiConnected = false;
Serial.println("Station disconnected");
});
Serial.printf("Connecting to %s ...\n", ssid);
WiFi.begin(ssid, password);
}
void setupOta() {
Update.installSignature(&hash, &sign);
ArduinoOTA.onStart(std::function<void()>{[]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else // U_SPIFFS
type = "filesystem";
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using
// SPIFFS.end()
Serial.println("Start updating " + type);
}});
ArduinoOTA.onEnd([]() { Serial.println("\nEnd"); });
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR)
Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR)
Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR)
Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR)
Serial.println("Receive Failed");
else if (error == OTA_END_ERROR)
Serial.println("End Failed");
});
ArduinoOTA.begin();
}
void setup() {
Serial.begin(115200);
Serial.println();
setupWifi();
setupOta();
}
void loop() {
ArduinoOTA.handle();
}
Output with thunked call
[begin] roundedSize: 0x00057000 (356352)
[begin] updateEndAddress: 0x00300000 (3145728)
[begin] currentSketchSize: 0x00057000 (356352)
[begin] _startAddress: 0x002A9000 (2789376)
[begin] _currentAddress: 0x002A9000 (2789376)
[begin] _size: 0x00056B04 (355076)
Start updating sketch
Header: 0xE9 1 2 40
[Updater] sigLen: 256
[Updater] Adjusted binsize: 354816
[Updater] Computed Hash: 94 94 96 05 6a 8d f0 45 4c e1 3b 86 8c e6 d5 46 33 a2 c0 77 2a a6 7d a0 22 6f 24 76 0c 34 96 ed
[Updater] Received Signature: 5d 3d 2b 98 bb 42 47 d4 10 04 f2 26 35 57 95 ca dd 39 bc 9b 41 b7 96 c3 44 ed 4c fb 5d 1f e7 9d 13 3b fd 32 14 a3 b8 5c b5 44 f6 ab d1 5c d2 9a 6d e9 08 9e 11 73 20 a8 44 e8 a7 de 2c 1d 10 3e 2a 25 03 e8 3a 1f 28 4b 14 20 43 d9 2e f5 e0 45 e1 64 c0 8e 0b 10 fd ae 46 fd 99 bf 3b a9 7c a4 ef 20 34 6b b4 2d 22 bb 26 87 45 ec a3 97 ab 17 7f da 0a f0 8c 1e 05 5e 88 90 01 cb a2 bb 99 06 09 d9 14 1d 91 dd 36 4a dd dc 3a 56 dd f4 71 24 f0 9c 8a 5a 6f cd 85 99 36 3c 73 f0 47 fa 46 ad da 37 24 20 e1 f2 51 5b 6c 16 b4 00 80 41 0a bf 7b 4e 2e fe b1 29 da f7 f2 70 7d 67 d4 65 96 fa eb 7e f4 2e 17 2a e2 f4 77 bf fb ee 6a f1 ca 6f bb ee 28 78 a2 ff 7c 70 0d ea 80 58 1c 1d d2 00 8c 15 ed 5e cc 11 33 dc 54 fe 8c 31 95 fd 68 5f b3 fd a4 c5 f8 7a 09 93 2d d2 61 23 b1 47 8d 9c
ets Jan 8 2013,rst cause:4, boot mode:(3,7)
wdt reset
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
v56bbb99e
~ld
Output without normal call
[begin] roundedSize: 0x00057000 (356352)
[begin] updateEndAddress: 0x00300000 (3145728)
[begin] currentSketchSize: 0x00057000 (356352)
[begin] _startAddress: 0x002A9000 (2789376)
[begin] _currentAddress: 0x002A9000 (2789376)
[begin] _size: 0x000563C4 (353220)
Start updating sketch
Header: 0xE9 1 2 40
[Updater] sigLen: 256
[Updater] Adjusted binsize: 352960
[Updater] Computed Hash: 30 5d d9 91 1b 0a aa 1b b7 0b 8c 67 f9 bc 5c e7 75 ed 18 68 d2 c4 2e 57 90 88 50 df 48 72 ee 46
[Updater] Received Signature: 4c 7f 4a db f3 87 8e 0d 6c fb f0 f7 69 dc b8 e9 1b 6e 75 5b ef 25 c6 42 e3 4a ec ff de f3 f1 d5 3d 9c 3a 29 09 76 e5 a6 a6 f9 8c 65 10 81 ad 79 20 fa 9a ae bf e8 69 f7 21 88 d8 5b 15 8f b3 20 3f 97 da e8 c1 0d 58 44 6e d6 c8 a3 46 24 44 cb 88 4c 1f d4 7e bf ac 3f 8c d8 3a 68 8c 36 57 5d 1d 7d 2c c4 40 15 29 aa 5f 33 02 ef b4 29 12 71 7e 06 84 e0 77 11 c0 a1 b3 22 c3 f2 5b de 16 04 03 cb 55 12 09 26 83 da 01 2b 38 0a 4f 49 c3 c0 f0 6c 55 80 f5 33 26 ee 2c 75 50 52 9c 33 39 b6 78 66 09 9f 9a 72 31 20 ae 73 21 6e a5 63 1b 0a d4 fe 37 08 47 01 9f 2c 53 7d ce d5 c5 d3 c1 30 75 d9 be 61 22 81 b6 d6 08 cb 24 0b 86 a8 7d 65 bd 1a 18 ce a8 6b a9 8d 3b e1 c7 3d f5 24 4f eb dc 9b 6a 38 15 6e 26 e6 2b 23 8c 4e f8 02 d9 92 01 c8 88 85 8f bc 0b d2 1c 27 3e 90 88 89 2e 88
[Updater] Signature matches
Staged: address:0x002A9000, size:0x000563C4
End
Station disconnected
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
v56bbb99e
@cp:
Metadata
Metadata
Assignees
Labels
No labels