aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-04-19 19:40:03 -0400
committerPaul Selkirk <paul@psgd.org>2018-04-19 19:40:03 -0400
commit110754870a5db73b064ae065b7927476c880b48a (patch)
treef082643a3fcf2cffc82b370955ac4426d7751741
parent34cf7ef55d66886757a36eb327dc3e22be54c918 (diff)
parentc6543a796c8b560b06cb1d53fad9ffa3906df111 (diff)
Merge branch 'profiling' into hashsig
-rw-r--r--ecdsa.c1
-rw-r--r--hal_internal.h1
-rw-r--r--locks.c5
-rw-r--r--pbkdf2.c2
4 files changed, 9 insertions, 0 deletions
diff --git a/ecdsa.c b/ecdsa.c
index 28cfa02..d1b8d0c 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -707,6 +707,7 @@ static hal_error_t point_scalar_multiply(const fp_int * const k,
point_double (M[1], M[1], curve);
point_add (M[bit], P, M[bit], curve);
+ hal_task_yield_maybe();
}
/*
diff --git a/hal_internal.h b/hal_internal.h
index 95785ae..b698611 100644
--- a/hal_internal.h
+++ b/hal_internal.h
@@ -153,6 +153,7 @@ extern void hal_critical_section_end(void);
extern void hal_ks_lock(void);
extern void hal_ks_unlock(void);
extern void hal_task_yield(void);
+extern void hal_task_yield_maybe(void);
/*
* Thread sleep. Currently used only for bad-PIN delays.
diff --git a/locks.c b/locks.c
index 9b81769..72af43b 100644
--- a/locks.c
+++ b/locks.c
@@ -106,6 +106,11 @@ WEAK_FUNCTION void hal_task_yield(void)
return;
}
+WEAK_FUNCTION void hal_task_yield_maybe(void)
+{
+ return;
+}
+
/*
* Local variables:
* indent-tabs-mode: nil
diff --git a/pbkdf2.c b/pbkdf2.c
index 0a1e57e..87ff574 100644
--- a/pbkdf2.c
+++ b/pbkdf2.c
@@ -140,6 +140,8 @@ hal_error_t hal_pbkdf2(hal_core_t *core,
for (iteration = 2; iteration <= iterations_desired; iteration++) {
+ hal_task_yield_maybe();
+
if ((err = do_hmac(core, descriptor, password, password_length,
mac, descriptor->digest_length,
0, mac, sizeof(mac))) != HAL_OK)