Remove some unreachable character types in the CONF parser DQUOTE and FCOMMENT are remnants of a second parser in OpenSSL. OpenSSL has CONF_type_default, which is the one we imported, and CONF_type_win32 which is a different syntax which looks to be modeled after Windows ini files. DQUOTE and FCOMMENT only exist in this one. Change-Id: Iffa01fcb012b0f3e7f8dbf87a01ba867bdc7bcc7 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60087 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/conf/conf.c b/crypto/conf/conf.c index 3e95e8b..14caa70 100644 --- a/crypto/conf/conf.c +++ b/crypto/conf/conf.c
@@ -228,22 +228,6 @@ if (*from == q) { from++; } - } else if (IS_DQUOTE(conf, *from)) { - q = *from; - from++; - while (!IS_EOF(conf, *from)) { - if (*from == q) { - if (*(from + 1) == q) { - from++; - } else { - break; - } - } - buf->data[to++] = *(from++); - } - if (*from == q) { - from++; - } } else if (IS_ESC(conf, *from)) { from++; v = *(from++); @@ -454,33 +438,8 @@ return p; } - -static char *scan_dquote(CONF *conf, char *p) { - int q = *p; - - p++; - while (!(IS_EOF(conf, *p))) { - if (*p == q) { - if (*(p + 1) == q) { - p++; - } else { - break; - } - } - p++; - } - if (*p == q) { - p++; - } - return p; -} - static void clear_comments(CONF *conf, char *p) { for (;;) { - if (IS_FCOMMENT(conf, *p)) { - *p = '\0'; - return; - } if (!IS_WS(conf, *p)) { break; } @@ -492,10 +451,6 @@ *p = '\0'; return; } - if (IS_DQUOTE(conf, *p)) { - p = scan_dquote(conf, p); - continue; - } if (IS_QUOTE(conf, *p)) { p = scan_quote(conf, p); continue;
diff --git a/crypto/conf/conf_def.h b/crypto/conf/conf_def.h index f01a79b..d2c285a 100644 --- a/crypto/conf/conf_def.h +++ b/crypto/conf/conf_def.h
@@ -55,8 +55,9 @@ * [including the GNU Public Licence.] */ -/* THIS FILE WAS AUTOMAGICALLY GENERATED! - Please modify and use keysets.pl to regenerate it. */ +// This file was historically generated by keysets.pl in OpenSSL. +// +// TODO(davidben): Replace it with something more readable. #define CONF_NUMBER 1 #define CONF_UPPER 2 @@ -66,9 +67,7 @@ #define CONF_WS 16 #define CONF_ESC 32 #define CONF_QUOTE 64 -#define CONF_DQUOTE 1024 #define CONF_COMMENT 128 -#define CONF_FCOMMENT 2048 #define CONF_EOF 8 #define CONF_HIGHBIT 4096 #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) @@ -78,7 +77,6 @@ #define KEYTYPES(c) CONF_type_default #define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) -#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) #define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) #define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC) #define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER) @@ -87,8 +85,6 @@ #define IS_ALPHA_NUMERIC_PUNCT(c,a) \ (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT) #define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE) -#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) -#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) static const unsigned short CONF_type_default[256]={ 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,