Skip to content

Commit d8452a7

Browse files
committed
removed mtest work-around
1 parent 1eb63c9 commit d8452a7

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

mp_read_radix.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ mp_err mp_read_radix(mp_int *a, const char *str, int radix)
1919

2020
mp_err err;
2121
mp_sign sign = MP_ZPOS;
22-
int correction = 0;
2322
size_t slen;
24-
/* should sit at the EOS now */
25-
const char *t;
2623

2724
/* make sure the radix is ok */
2825
if ((radix < 2) || (radix > 64)) {
@@ -38,23 +35,14 @@ mp_err mp_read_radix(mp_int *a, const char *str, int radix)
3835
}
3936

4037
slen = s_mp_strlen(str);
41-
t = str + slen - 1;
42-
43-
/* Check input (needed to get rid of unclean input from "mtest") */
44-
while ((*t == '\r') || (*t == '\n') || (*t == '\t')) {
45-
correction++;
46-
t--;
47-
}
4838

4939
mp_zero(a);
5040

5141
/* Try faster version first */
5242
if (MP_HAS(S_MP_FASTER_READ_RADIX)) {
53-
if ((err = s_mp_faster_read_radix(a, str, 0, (int)slen - correction,
54-
radix)) != MP_OKAY) goto LTM_ERR;
43+
if ((err = s_mp_faster_read_radix(a, str, 0, (int)slen, radix)) != MP_OKAY) goto LTM_ERR;
5544
} else if (MP_HAS(S_MP_SLOWER_READ_RADIX)) {
56-
if ((err = s_mp_slower_read_radix(a, str, 0, (int)slen - correction,
57-
radix)) != MP_OKAY) goto LTM_ERR;
45+
if ((err = s_mp_slower_read_radix(a, str, 0, (int)slen, radix)) != MP_OKAY) goto LTM_ERR;
5846
}
5947

6048
/* set the sign only if a != 0 */
@@ -64,7 +52,6 @@ mp_err mp_read_radix(mp_int *a, const char *str, int radix)
6452

6553
LTM_ERR:
6654
return err;
67-
6855
}
6956

7057
#endif

0 commit comments

Comments
 (0)