Skip to content

Commit e1fe186

Browse files
committed
wolfcrypt/src/sp_int.c: in _sp_prime_trials(), use DECL_SP_INT() not DECL_SP_INT_ARRAY() for n1 and r, to mollify a very confused clang-tidy (fixes false positive clang-analyzer-core.UndefinedBinaryOperatorResult and clang-analyzer-core.CallAndMessage).
1 parent 0f119ab commit e1fe186

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

wolfcrypt/src/sp_int.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19271,18 +19271,15 @@ static int _sp_prime_trials(const sp_int* a, int trials, int* result)
1927119271
{
1927219272
int err = MP_OKAY;
1927319273
int i;
19274-
sp_int* n1;
19275-
sp_int* r;
19276-
DECL_SP_INT_ARRAY(t, a->used + 1, 2);
19274+
DECL_SP_INT(n1, a->used + 1);
19275+
DECL_SP_INT(r, a->used + 1);
1927719276
DECL_SP_INT(b, a->used * 2 + 1);
1927819277

19279-
ALLOC_SP_INT_ARRAY(t, a->used + 1, 2, err, NULL);
19278+
ALLOC_SP_INT(n1, a->used + 1, err, NULL);
19279+
ALLOC_SP_INT(r, a->used + 1, err, NULL);
1928019280
/* Allocate number that will hold modular exponentiation result. */
1928119281
ALLOC_SP_INT(b, a->used * 2 + 1, err, NULL);
1928219282
if (err == MP_OKAY) {
19283-
n1 = t[0];
19284-
r = t[1];
19285-
1928619283
_sp_init_size(n1, a->used + 1U);
1928719284
_sp_init_size(r, a->used + 1U);
1928819285
_sp_init_size(b, (sp_size_t)(a->used * 2U + 1U));
@@ -19305,7 +19302,8 @@ static int _sp_prime_trials(const sp_int* a, int trials, int* result)
1930519302

1930619303
/* Free allocated temporary. */
1930719304
FREE_SP_INT(b, NULL);
19308-
FREE_SP_INT_ARRAY(t, NULL);
19305+
FREE_SP_INT(r, NULL);
19306+
FREE_SP_INT(n1, NULL);
1930919307
return err;
1931019308
}
1931119309

0 commit comments

Comments
 (0)