Fix DSA to skip EOL test when parsing mod line.

This commit is contained in:
Dr. Stephen Henson 2011-08-08 14:47:51 +00:00
parent 49e9b97885
commit 8d7fbd021b
2 changed files with 9 additions and 3 deletions

View File

@ -41,7 +41,7 @@ static int parse_mod(char *line, int *pdsa2, int *pL, int *pN,
}
*pdsa2 = 1;
*p = 0;
if (!parse_line(&keyword, &value, lbuf, line))
if (!parse_line2(&keyword, &value, lbuf, line, 0))
return 0;
if (strcmp(keyword, "L"))
return 0;
@ -54,7 +54,7 @@ static int parse_mod(char *line, int *pdsa2, int *pL, int *pN,
if (!p)
return 0;
*p = 0;
if (!parse_line(&keyword, &value, lbuf, line))
if (!parse_line2(&keyword, &value, lbuf, line, 0))
return 0;
if (strcmp(keyword, "N"))
return 0;

View File

@ -58,6 +58,7 @@ int do_hex2bn(BIGNUM **pr, const char *in);
int do_bn_print(FILE *out, const BIGNUM *bn);
int do_bn_print_name(FILE *out, const char *name, const BIGNUM *bn);
int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf);
int parse_line2(char **pkw, char **pval, char *linebuf, char *olinebuf, int eol);
BIGNUM *hex2bn(const char *in);
int tidy_line(char *linebuf, char *olinebuf);
int bint2bin(const char *in, int len, unsigned char *out);
@ -261,6 +262,11 @@ int do_bn_print_name(FILE *out, const char *name, const BIGNUM *bn)
}
int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf)
{
return parse_line2(pkw, pval, linebuf, olinebuf, 1);
}
int parse_line2(char **pkw, char **pval, char *linebuf, char *olinebuf, int eol)
{
char *keyword, *value, *p, *q;
strcpy(linebuf, olinebuf);
@ -292,7 +298,7 @@ int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf)
/* Remove trailing space from value */
p = value + strlen(value) - 1;
if (*p != '\n')
if (eol && *p != '\n')
fprintf(stderr, "Warning: missing EOL\n");
while (*p == '\n' || isspace((unsigned char)*p))