summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_s_mp_mul_digs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_s_mp_mul_digs.c')
-rw-r--r--libtommath/bn_s_mp_mul_digs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c
index 64509d4..3682b49 100644
--- a/libtommath/bn_s_mp_mul_digs.c
+++ b/libtommath/bn_s_mp_mul_digs.c
@@ -16,6 +16,10 @@ mp_err s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
mp_word r;
mp_digit tmpx, *tmpt, *tmpy;
+ if (digs < 0) {
+ return MP_VAL;
+ }
+
/* can we use the fast multiplier? */
if ((digs < MP_WARRAY) &&
(MP_MIN(a->used, b->used) < MP_MAXFAST)) {