sp_int.c, srp.c: fixes for 5 deadcode.DeadStores found by LLVM11 scan-build.

This commit is contained in:
Daniel Pouzzner 2020-12-02 13:15:20 -06:00
parent f49e9bf954
commit 741098c108
2 changed files with 9 additions and 5 deletions

View File

@ -1980,6 +1980,10 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo,
#if defined(WOLFSSL_HAVE_SP_DH) || defined(WOLFSSL_HAVE_SP_RSA)
#ifdef __cplusplus
extern "C" {
#endif
/* Modular exponentiation implementations using Single Precision. */
WOLFSSL_LOCAL int sp_ModExp_1024(sp_int* base, sp_int* exp, sp_int* mod,
sp_int* res);
@ -1992,6 +1996,10 @@ WOLFSSL_LOCAL int sp_ModExp_3072(sp_int* base, sp_int* exp, sp_int* mod,
WOLFSSL_LOCAL int sp_ModExp_4096(sp_int* base, sp_int* exp, sp_int* mod,
sp_int* res);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
#if defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)
@ -4994,7 +5002,6 @@ int sp_mod(sp_int* a, sp_int* m, sp_int* r)
t->dp[5] = l;
l = h;
h = o;
o = 0;
SP_ASM_MUL_ADD_NO(l, h, a->dp[3], b->dp[3]);
t->dp[6] = l;
t->dp[7] = h;
@ -5118,7 +5125,6 @@ int sp_mod(sp_int* a, sp_int* m, sp_int* r)
t->dp[9] = l;
l = h;
h = o;
o = 0;
SP_ASM_MUL_ADD_NO(l, h, a->dp[5], b->dp[5]);
t->dp[10] = l;
t->dp[11] = h;
@ -9687,7 +9693,6 @@ int sp_mul_2d(sp_int* a, int e, sp_int* r)
t->dp[5] = l;
l = h;
h = o;
o = 0;
SP_ASM_SQR_ADD_NO(l, h, a->dp[3]);
t->dp[6] = l;
t->dp[7] = h;
@ -9803,7 +9808,6 @@ int sp_mul_2d(sp_int* a, int e, sp_int* r)
t->dp[9] = l;
l = h;
h = o;
o = 0;
SP_ASM_SQR_ADD_NO(l, h, a->dp[5]);
t->dp[10] = l;
t->dp[11] = h;

View File

@ -650,7 +650,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
/* validating params */
if ((r = mp_init_multi(u, s, temp1, temp2, 0, 0)) != MP_OKAY) {
if ((mp_init_multi(u, s, temp1, temp2, 0, 0)) != MP_OKAY) {
r = MP_INIT_E;
goto out;
}