aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-11-14 11:29:41 -0500
committerPaul Selkirk <paul@psgd.org>2018-11-14 11:29:41 -0500
commit44debb4679f3c470ddc22561d1fcae7c3dd99df1 (patch)
tree9687920f56f57ac414900a7a438d320be02e92d6
parent6de40f118b11fb0229d3899967cc075b5580cf83 (diff)
Add some yields to hal_hashsig_ks_init, so other tasks can run while we're rebuilding the hash tree.
-rw-r--r--hashsig.c6
1 files changed, 6 insertions, 0 deletions
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();
}
}