From dadbeff43375e586e42f614b548d4d2b5288b48e Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Tue, 26 Nov 2019 09:55:17 +1000 Subject: [PATCH] sp_int: When setting digit of 0, set used to 0 --- wolfcrypt/src/sp_int.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 137f75f16..1acda20a3 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -420,8 +420,14 @@ int sp_init_copy (sp_int * a, sp_int * b) */ int sp_set(sp_int* a, sp_int_digit d) { - a->dp[0] = d; - a->used = 1; + if (d == 0) { + a->dp[0] = d; + a->used = 0; + } + else { + a->dp[0] = d; + a->used = 1; + } return MP_OKAY; }