Bug fix against flash GC
This commit is contained in:
@@ -306,7 +306,7 @@ extern uint8_t admin_authorized;
|
|||||||
/*
|
/*
|
||||||
* Representation of Boolean object:
|
* Representation of Boolean object:
|
||||||
* 0: No record in flash memory
|
* 0: No record in flash memory
|
||||||
* 1: 0xc?00
|
* 1: 0xf000
|
||||||
*/
|
*/
|
||||||
#define NR_BOOL_PW1_LIFETIME 0xf0
|
#define NR_BOOL_PW1_LIFETIME 0xf0
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -877,6 +877,7 @@ gpg_do_chks_prvkey (enum kind_of_key kk,
|
|||||||
dek_p += DATA_ENCRYPTION_KEY_SIZE * (who_new - who_old);
|
dek_p += DATA_ENCRYPTION_KEY_SIZE * (who_new - who_old);
|
||||||
memcpy (dek_p, dek, DATA_ENCRYPTION_KEY_SIZE);
|
memcpy (dek_p, dek, DATA_ENCRYPTION_KEY_SIZE);
|
||||||
|
|
||||||
|
do_ptr[nr - NR_DO__FIRST__] = NULL;
|
||||||
p = flash_do_write (nr, (const uint8_t *)pd, sizeof (struct prvkey_data));
|
p = flash_do_write (nr, (const uint8_t *)pd, sizeof (struct prvkey_data));
|
||||||
do_ptr[nr - NR_DO__FIRST__] = p;
|
do_ptr[nr - NR_DO__FIRST__] = p;
|
||||||
|
|
||||||
@@ -1398,6 +1399,7 @@ gpg_do_put_data (uint16_t tag, const uint8_t *data, int len)
|
|||||||
GPG_MEMORY_FAILURE ();
|
GPG_MEMORY_FAILURE ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*do_data_p = NULL;
|
||||||
*do_data_p = flash_do_write (nr, data, len);
|
*do_data_p = flash_do_write (nr, data, len);
|
||||||
if (*do_data_p)
|
if (*do_data_p)
|
||||||
GPG_SUCCESS ();
|
GPG_SUCCESS ();
|
||||||
@@ -1512,6 +1514,7 @@ gpg_do_write_simple (uint8_t nr, const uint8_t *data, int size)
|
|||||||
|
|
||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
{
|
{
|
||||||
|
*do_data_p = NULL;
|
||||||
*do_data_p = flash_do_write (nr, data, size);
|
*do_data_p = flash_do_write (nr, data, size);
|
||||||
if (*do_data_p == NULL)
|
if (*do_data_p == NULL)
|
||||||
flash_warning ("DO WRITE ERROR");
|
flash_warning ("DO WRITE ERROR");
|
||||||
|
|||||||
Reference in New Issue
Block a user