summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_s_mp_mul_digs_fast.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_s_mp_mul_digs_fast.c')
-rw-r--r--libtommath/bn_s_mp_mul_digs_fast.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libtommath/bn_s_mp_mul_digs_fast.c b/libtommath/bn_s_mp_mul_digs_fast.c
index b2a287b..3c4176a 100644
--- a/libtommath/bn_s_mp_mul_digs_fast.c
+++ b/libtommath/bn_s_mp_mul_digs_fast.c
@@ -26,6 +26,10 @@ mp_err s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs)
mp_digit W[MP_WARRAY];
mp_word _W;
+ if (digs < 0) {
+ return MP_VAL;
+ }
+
/* grow the destination as required */
if (c->alloc < digs) {
if ((err = mp_grow(c, digs)) != MP_OKAY) {