aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-05-01 17:35:18 -0400
committerPaul Selkirk <paul@psgd.org>2018-05-01 17:35:18 -0400
commit2b9f5c433514135a0409d99dd347dd6070fcf1e6 (patch)
treeecab1e3881dabbbe6b8c64c5c7aceea8647683ac
parent110754870a5db73b064ae065b7927476c880b48a (diff)
Add some yields to try to improve responsiveness during hashsig key generation and deletion.
-rw-r--r--hashsig.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hashsig.c b/hashsig.c
index 0396ff7..2ffe995 100644
--- a/hashsig.c
+++ b/hashsig.c
@@ -716,6 +716,7 @@ static hal_error_t lms_generate(lms_key_t *key)
s = u16str(D_LEAF); check(hal_hash_update(state, (const uint8_t *)&s, sizeof(s)));
check(hal_hash_update(state, (const uint8_t *)&lmots_key.K, sizeof(lmots_key.K)));
check(hal_hash_finalize(state, (uint8_t *)&key->T[r], sizeof(key->T[r])));
+ hal_task_yield_maybe();
}
/* generate the rest of T[r] = H(I || u32str(r) || u16str(D_INTR) || T[2*r] || T[2*r+1]) */
@@ -727,6 +728,7 @@ static hal_error_t lms_generate(lms_key_t *key)
check(hal_hash_update(state, (const uint8_t *)&key->T[2*r], sizeof(key->T[r])));
check(hal_hash_update(state, (const uint8_t *)&key->T[2*r+1], sizeof(key->T[r])));
check(hal_hash_finalize(state, (uint8_t *)&key->T[r], sizeof(key->T[r])));
+ hal_task_yield_maybe();
}
memcpy(&key->T1, &key->T[1], sizeof(key->T1));
@@ -754,6 +756,7 @@ static hal_error_t lms_delete(const lms_key_t * const key)
for (size_t i = 0; i < (1U << key->lms->h); ++i) {
memcpy(&slot.name, &key->lmots_keys[i], sizeof(slot.name));
check(hal_ks_delete(ks, &slot));
+ hal_task_yield_maybe();
}
/* delete the lms key */