File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,11 @@ String portenta_h7_getOTAImageSHA256()
101
101
* communicated to the bootloader, that is by writing to the non-volatile
102
102
* storage registers of the RTC.
103
103
*/
104
- SHA256 sha256;
104
+ SHA256Class sha256;
105
105
uint32_t const app_start = 0x8040000 ;
106
106
uint32_t const app_size = HAL_RTCEx_BKUPRead (&RTCHandle, RTC_BKP_DR3);
107
107
108
- sha256.begin ();
108
+ sha256.beginHash ();
109
109
uint32_t b = 0 ;
110
110
uint32_t bytes_read = 0 ; for (uint32_t a = app_start;
111
111
bytes_read < app_size;
@@ -114,11 +114,13 @@ String portenta_h7_getOTAImageSHA256()
114
114
/* Read the next chunk of memory. */
115
115
memcpy (&b, reinterpret_cast <const void *>(a), sizeof (b));
116
116
/* Feed it to SHA256. */
117
- sha256.update (reinterpret_cast <uint8_t *>(&b), sizeof (b));
117
+ sha256.write (reinterpret_cast <uint8_t *>(&b), sizeof (b));
118
118
}
119
+ sha256.endHash ();
119
120
/* Retrieve the final hash string. */
120
121
uint8_t sha256_hash[SHA256_DIGEST_SIZE] = {0 };
121
- sha256.finalize (sha256_hash);
122
+ sha256.readBytes (sha256_hash, SHA256_DIGEST_SIZE);
123
+
122
124
String sha256_str;
123
125
std::for_each (sha256_hash,
124
126
sha256_hash + SHA256_DIGEST_SIZE,
You can’t perform that action at this time.
0 commit comments