From: Dr. Stephen Henson Date: Mon, 8 Aug 2011 14:47:51 +0000 (+0000) Subject: Fix DSA to skip EOL test when parsing mod line. X-Git-Tag: OpenSSL-fips-2_0-rc1~230 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8d7fbd021b5ee42fcd963b158ce9880abdf64573;p=oweals%2Fopenssl.git Fix DSA to skip EOL test when parsing mod line. --- diff --git a/fips/dsa/fips_dssvs.c b/fips/dsa/fips_dssvs.c index 09001615dc..b6dc56dbdc 100644 --- a/fips/dsa/fips_dssvs.c +++ b/fips/dsa/fips_dssvs.c @@ -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; diff --git a/fips/fips_utl.h b/fips/fips_utl.h index 6cb58094b8..899422f438 100644 --- a/fips/fips_utl.h +++ b/fips/fips_utl.h @@ -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))