aboutsummaryrefslogtreecommitdiff
path: root/hal_internal.h
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-04-23 18:30:50 -0400
committerRob Austein <sra@hactrn.net>2017-04-23 18:30:50 -0400
commitc9fc4a5779db08a6c8a0029b779826a188d8b438 (patch)
tree35a17eb13db940ce8cd67f38a683f325c150348b /hal_internal.h
parentf502844d18282c928cf5fedb483514c1fcfd0b92 (diff)
Avoid deadlock triggered by low-probability race condition.
Static code analysis (Doxygen call graph) detected a low-probability race condition which could have triggered a deadlock on the keystore mutex if the mkmif code returns with an error like HAL_ERROR_CORE_BUSY when we're trying to fetch the KEK. This is a knock-on effect of the awful kludge of backing up the KEK in the keystore flash as an alternative to powering the MKM with a battery as called for in the design. This code path should not exist at all, but, for now, we avoid the deadlock by making it the caller's responsibility to grab the keystore mutex before looking up the KEK.
Diffstat (limited to 'hal_internal.h')
-rw-r--r--hal_internal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/hal_internal.h b/hal_internal.h
index f17179c..56d0936 100644
--- a/hal_internal.h
+++ b/hal_internal.h
@@ -421,6 +421,7 @@ extern hal_error_t hal_mkm_volatile_erase(const size_t len);
/* #warning MKM flash backup kludge enabled. Do NOT use this in production! */
extern hal_error_t hal_mkm_flash_read(uint8_t *buf, const size_t len);
+extern hal_error_t hal_mkm_flash_read_no_lock(uint8_t *buf, const size_t len);
extern hal_error_t hal_mkm_flash_write(const uint8_t * const buf, const size_t len);
extern hal_error_t hal_mkm_flash_erase(const size_t len);