Merge branch 'tcl-fixes' into develop

This closes #75
This commit is contained in:
Steffen Jaeckel 2017-08-29 23:48:49 +02:00
commit a0a86c696a
2 changed files with 8 additions and 2 deletions

View File

@ -71,7 +71,13 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
}
++str;
}
/* if an illegal character was found, fail. */
if (!(*str == '\0' || *str == '\r' || *str == '\n')) {
mp_zero(a);
return MP_VAL;
}
/* set the sign only if a != 0 */
if (mp_iszero(a) != MP_YES) {
a->sign = neg;

View File

@ -203,7 +203,7 @@ int mp_init_size(mp_int *a, int size);
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
#define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)