File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -108,11 +108,11 @@ OTACloudProcessInterface::State OTACloudProcessInterface::otaBegin() {
108
108
OtaBeginUpId,
109
109
};
110
110
111
- SHA256Class sha256_calc;
111
+ SHA256 sha256_calc;
112
112
calculateSHA256 (sha256_calc);
113
113
114
- sha256_calc.endHash ( );
115
- sha256_calc. readBytes (msg.params .sha , SHA256_DIGEST_SIZE );
114
+ sha256_calc.finalize (sha256 );
115
+ memcpy (msg.params .sha , sha256, SHA256::HASH_SIZE );
116
116
117
117
DEBUG_VERBOSE (" calculated SHA256: "
118
118
" 0x%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X"
@@ -128,15 +128,15 @@ OTACloudProcessInterface::State OTACloudProcessInterface::otaBegin() {
128
128
return Idle;
129
129
}
130
130
131
- void OTACloudProcessInterface::calculateSHA256 (SHA256Class & sha256_calc) {
131
+ void OTACloudProcessInterface::calculateSHA256 (SHA256 & sha256_calc) {
132
132
auto res = appFlashOpen ();
133
133
if (!res) {
134
134
// TODO return error
135
135
return ;
136
136
}
137
137
138
- sha256_calc.beginHash ();
139
- sha256_calc.write (
138
+ sha256_calc.begin ();
139
+ sha256_calc.update (
140
140
reinterpret_cast <const uint8_t *>(appStartAddress ()),
141
141
appSize ());
142
142
appFlashClose ();
Original file line number Diff line number Diff line change 18
18
19
19
#if OTA_ENABLED
20
20
#include " ../OTATypes.h"
21
- #include < SHA256.h>
21
+ #include " tls/utility/ SHA256.h"
22
22
23
23
#include < interfaces/CloudProcess.h>
24
24
#include < Arduino_DebugUtils.h>
@@ -156,10 +156,10 @@ class OTACloudProcessInterface: public CloudProcess {
156
156
virtual bool appFlashClose () = 0;
157
157
158
158
// sha256 is going to be used in the ota process for validation, avoid calculating it twice
159
- uint8_t sha256[SHA256_DIGEST_SIZE ];
159
+ uint8_t sha256[SHA256::HASH_SIZE ];
160
160
161
161
// calculateSHA256 method is overridable for platforms that do not support access through pointer to program memory
162
- virtual void calculateSHA256 (SHA256Class &); // FIXME return error
162
+ virtual void calculateSHA256 (SHA256 &); // FIXME return error
163
163
private:
164
164
void clean ();
165
165
You can’t perform that action at this time.
0 commit comments