[Gnuk-users] [PATCH] Erase CERTDO on terminate.

Jeremy Drake jeremydrake+gnuk at eacceleration.com
Tue Aug 1 23:00:28 UTC 2017


I don't know if this is the proper place to send patches, but I came 
across this apparent oversight while messing around and thought I'd try 
sending a simple patch.

-- >8 --
Subject: [PATCH] Erase CERTDO on terminate.

When both certdo and lifecycle support are enabled, flash_terminate
neglected to erase the certdo pages.  It now does so.
---
 src/flash.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/flash.c b/src/flash.c
index 60582e1..973bd26 100644
--- a/src/flash.c
+++ b/src/flash.c
@@ -154,6 +154,11 @@ flash_terminate (void)
   flash_erase_page ((uint32_t)(&_data_pool + flash_page_size));
   data_pool = &_data_pool;
   last_p = &_data_pool + FLASH_DATA_POOL_HEADER_SIZE;
+#ifdef CERTDO_SUPPORT
+  flash_erase_page ((uint32_t)&ch_certificate_start);
+  if (FLASH_CH_CERTIFICATE_SIZE > flash_page_size)
+    flash_erase_page ((uint32_t)(&ch_certificate_start + flash_page_size));
+#endif
 }

 void
-- 
2.11.0




More information about the gnuk-users mailing list