Fix #41: Updater SHA256 check implemented and tested

This commit is contained in:
Mario Hüttel 2021-10-03 19:38:01 +02:00
parent ae60c30919
commit 20b460cd5a

View File

@ -333,6 +333,13 @@ int ram_code_main(void)
} else if (res >= SIZE_OF_SHA_256_HASH*2) { } else if (res >= SIZE_OF_SHA_256_HASH*2) {
tmp_buff[res] = 0; tmp_buff[res] = 0;
uart_send_string("Expected sha: "); uart_send_string("Expected sha: ");
/* Strip out the newline form the file for printing */
if (tmp_buff[res-1] == '\n' || tmp_buff[res-1] == '\r')
tmp_buff[res-1] = 0;
if (tmp_buff[res-2] == '\n' || tmp_buff[res-2] == '\r')
tmp_buff[res-2] = 0;
uart_send_string(tmp_buff); uart_send_string(tmp_buff);
uart_send_string("\r\n"); uart_send_string("\r\n");
if (strncmp(sha_string, tmp_buff, SIZE_OF_SHA_256_HASH*2) != 0) { if (strncmp(sha_string, tmp_buff, SIZE_OF_SHA_256_HASH*2) != 0) {