aboutsummaryrefslogtreecommitdiff
path: root/ecdsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ecdsa.c')
-rw-r--r--ecdsa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ecdsa.c b/ecdsa.c
index 16d2b27..d654a78 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -1010,7 +1010,8 @@ hal_error_t hal_ecdsa_key_gen(const hal_core_t *core,
if ((err = point_pick_random(curve, key->d, key->Q)) != HAL_OK)
return err;
- assert(point_is_on_curve(key->Q, curve));
+ if (!point_is_on_curve(key->Q, curve))
+ return HAL_ERROR_KEY_NOT_ON_CURVE;
*key_ = key;
return HAL_OK;
@@ -1668,7 +1669,8 @@ hal_error_t hal_ecdsa_sign(const hal_core_t *core,
if ((err = point_pick_random(curve, k, R)) != HAL_OK)
goto fail;
- assert(point_is_on_curve(R, curve));
+ if (!point_is_on_curve(R, curve))
+ lose(HAL_ERROR_IMPOSSIBLE);
if (fp_mod(R->x, n, r) != FP_OKAY)
lose(HAL_ERROR_IMPOSSIBLE);