mirror of https://github.com/wolfSSL/wolfBoot.git
Addressed copilot's comments
parent
2a9aa60d40
commit
8eb7fa6a18
|
|
@ -82,15 +82,13 @@ static int lms_write_key(const byte * priv, word32 privSz, void * context)
|
|||
if (n_read != n_write) {
|
||||
fprintf(stderr, "error: read %d, expected %d: %d\n",
|
||||
(int)n_read, (int)n_write, ferror(file));
|
||||
wc_ForceZero(buff, sizeof(buff));
|
||||
return WC_LMS_RC_WRITE_FAIL;
|
||||
goto verify_fail;
|
||||
}
|
||||
|
||||
n_cmp = XMEMCMP(buff, priv, n_write);
|
||||
if (n_cmp != 0) {
|
||||
fprintf(stderr, "error: write data was corrupted: %d\n", n_cmp);
|
||||
wc_ForceZero(buff, sizeof(buff));
|
||||
return WC_LMS_RC_WRITE_FAIL;
|
||||
goto verify_fail;
|
||||
}
|
||||
|
||||
err = fclose(file);
|
||||
|
|
@ -102,6 +100,14 @@ static int lms_write_key(const byte * priv, word32 privSz, void * context)
|
|||
|
||||
wc_ForceZero(buff, sizeof(buff));
|
||||
return WC_LMS_RC_SAVED_TO_NV_MEMORY;
|
||||
|
||||
verify_fail:
|
||||
wc_ForceZero(buff, sizeof(buff));
|
||||
err = fclose(file);
|
||||
if (err) {
|
||||
fprintf(stderr, "error: fclose returned %d\n", err);
|
||||
}
|
||||
return WC_LMS_RC_WRITE_FAIL;
|
||||
}
|
||||
|
||||
static int lms_read_key(byte * priv, word32 privSz, void * context)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ int uart_rx(uint8_t *c)
|
|||
|
||||
static void reset_uart_script(const uint8_t *script, int len)
|
||||
{
|
||||
ck_assert_int_le(len, (int)sizeof(rx_script));
|
||||
memset(rx_script, 0, sizeof(rx_script));
|
||||
memcpy(rx_script, script, len);
|
||||
rx_script_len = len;
|
||||
|
|
|
|||
Loading…
Reference in New Issue