[Cryptech-Commits] [sw/libhal] branch master updated: Add some yields to hal_hashsig_ks_init, so other tasks can run while we're rebuilding the hash tree.

git at cryptech.is git at cryptech.is
Wed Nov 14 16:30:00 UTC 2018


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

The following commit(s) were added to refs/heads/master by this push:
     new 44debb4  Add some yields to hal_hashsig_ks_init, so other tasks can run while we're rebuilding the hash tree.
44debb4 is described below

commit 44debb4679f3c470ddc22561d1fcae7c3dd99df1
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Wed Nov 14 11:29:41 2018 -0500

    Add some yields to hal_hashsig_ks_init, so other tasks can run while we're rebuilding the hash tree.
---
 hashsig.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hashsig.c b/hashsig.c
index e7c1576..9c48805 100644
--- a/hashsig.c
+++ b/hashsig.c
@@ -1975,6 +1975,7 @@ hal_error_t hal_hashsig_ks_init(void)
         key->lms_keys[0].q = lms_key.q;
 
         prev_name = slot.name;
+        hal_task_yield_maybe();
     }
 
     /* Delete orphaned lms keys */
@@ -1993,6 +1994,7 @@ hal_error_t hal_hashsig_ks_init(void)
         }
 
         prev_name = slot.name;
+        hal_task_yield_maybe();
     }
 
     /* Find all lmots keys */
@@ -2039,6 +2041,7 @@ hal_error_t hal_hashsig_ks_init(void)
         hal_hash_finalize(state, (uint8_t *)&hss_key->lms_keys[0].T[r], sizeof(hss_key->lms_keys[0].T[r]));
 
         prev_name = slot.name;
+        hal_task_yield_maybe();
     }
 
     /* After all keys have been read, scan for completeness. */
@@ -2082,6 +2085,7 @@ hal_error_t hal_hashsig_ks_init(void)
                 }
             }
             (void)hal_free_static_memory(hss_key);
+            hal_task_yield_maybe();
             continue;
         }
 
@@ -2096,6 +2100,7 @@ hal_error_t hal_hashsig_ks_init(void)
             hal_hash_update(state, (const uint8_t *)&hss_key->lms_keys[0].T[2*r], sizeof(hss_key->lms_keys[0].T[r]));
             hal_hash_update(state, (const uint8_t *)&hss_key->lms_keys[0].T[2*r+1], sizeof(hss_key->lms_keys[0].T[r]));
             hal_hash_finalize(state, (uint8_t *)&hss_key->lms_keys[0].T[r], sizeof(hss_key->lms_keys[0].T[r]));
+            hal_task_yield_maybe();
         }
         if (memcmp(&hss_key->lms_keys[0].T[1], &hss_key->T1, sizeof(hss_key->lms_keys[0].T[1])) != 0)
             goto fail;
@@ -2117,6 +2122,7 @@ hal_error_t hal_hashsig_ks_init(void)
                          (const uint8_t * const)lms_key->pubkey, lms_key->pubkey_len,
                          lms_key->signature, NULL, lms_key->signature_len) != HAL_OK)
                 goto fail;
+            hal_task_yield_maybe();
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list