Merge branch 'tcl-fixes' into develop This closes #75
diff --git a/bn_mp_read_radix.c b/bn_mp_read_radix.c
index 5decdeb..12aa499 100644
--- a/bn_mp_read_radix.c
+++ b/bn_mp_read_radix.c
@@ -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;
diff --git a/tommath.h b/tommath.h
index 7dda0a5..80bae69 100644
--- a/tommath.h
+++ b/tommath.h
@@ -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)