Skip to content

Commit 55e312b

Browse files
authored
Merge pull request #244 from libtom/warn-unused-result
add warn_unused_result, found one missing check!
2 parents 5d8f04a + adf9605 commit 55e312b

File tree

5 files changed

+162
-137
lines changed

5 files changed

+162
-137
lines changed

bn_mp_mod_2d.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ int mp_mod_2d(const mp_int *a, int b, mp_int *c)
1616

1717
/* if the modulus is larger than the value than return */
1818
if (b >= (a->used * MP_DIGIT_BIT)) {
19-
res = mp_copy(a, c);
20-
return res;
19+
return mp_copy(a, c);
2120
}
2221

2322
/* copy */

bn_s_mp_toom_mul.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ int s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
5252
goto LBL_ERR;
5353
}
5454
mp_rshd(&b1, B);
55-
(void)mp_mod_2d(&b1, MP_DIGIT_BIT * B, &b1);
55+
if ((res = mp_mod_2d(&b1, MP_DIGIT_BIT * B, &b1)) != MP_OKAY) {
56+
goto LBL_ERR;
57+
}
5658

5759
if ((res = mp_copy(b, &b2)) != MP_OKAY) {
5860
goto LBL_ERR;

demo/shared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define LTM_DEMO_RAND_SEED 23
2525
#endif
2626

27+
#define MP_WUR /* TODO: result checks disabled for now */
2728
#include "tommath.h"
2829

2930
extern void ndraw(mp_int* a, const char* name);

0 commit comments

Comments
 (0)