From 92565101ca7bc1587ff1d87f9efa8aa1cfbe62f7 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Tue, 27 Mar 2018 17:31:56 +0100 Subject: [PATCH] Remove some code This commit removes the contribution of a user that we cannot trace to gain their consent for the licence change. After this commit the various IS_*() macros in the auto-generated file conf_def.h may incorrectly return true if the supplied character has its most significant bit set. The IS_*() macros should be able to correctly handle 8-bit characters. Note that UTF-8 support is not a requirement. Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/5767) --- crypto/conf/conf_def.h | 42 ++++-------------------------------------- crypto/conf/keysets.pl | 19 +++++++------------ 2 files changed, 11 insertions(+), 50 deletions(-) diff --git a/crypto/conf/conf_def.h b/crypto/conf/conf_def.h index f0734ecafc..aa14d4ad06 100644 --- a/crypto/conf/conf_def.h +++ b/crypto/conf/conf_def.h @@ -21,7 +21,6 @@ #define CONF_COMMENT 128 #define CONF_FCOMMENT 2048 #define CONF_EOF 8 -#define CONF_HIGHBIT 4096 #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) #define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) #define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT) @@ -29,9 +28,9 @@ #define KEYTYPES(c) ((const unsigned short *)((c)->meth_data)) #ifndef CHARSET_EBCDIC -# define CVT(a) ((a) & 0xFF) +# define CVT(a) ((a) & 0x7F) #else -# define CVT(a) os_toascci[(a) & 0FF] +# define CVT(a) os_toascci[(a) & 0x7F] #endif #define IS_COMMENT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_COMMENT) @@ -44,9 +43,8 @@ #define IS_ALNUM_PUNCT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_ALNUM_PUNCT) #define IS_QUOTE(c,a) (KEYTYPES(c)[CVT(a)] & CONF_QUOTE) #define IS_DQUOTE(c,a) (KEYTYPES(c)[CVT(a)] & CONF_DQUOTE) -#define IS_HIGHBIT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_HIGHBIT) -static const unsigned short CONF_type_default[256] = { +static const unsigned short CONF_type_default[128] = { 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -63,25 +61,9 @@ static const unsigned short CONF_type_default[256] = { 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, }; -static const unsigned short CONF_type_win32[256] = { +static const unsigned short CONF_type_win32[128] = { 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -98,20 +80,4 @@ static const unsigned short CONF_type_win32[256] = { 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, }; diff --git a/crypto/conf/keysets.pl b/crypto/conf/keysets.pl index fc0db2067d..e2af26c89f 100644 --- a/crypto/conf/keysets.pl +++ b/crypto/conf/keysets.pl @@ -21,13 +21,12 @@ my $DQUOTE = 0x0400; my $COMMENT = 0x0080; my $FCOMMENT = 0x0800; my $EOF = 0x0008; -my $HIGHBIT = 0x1000; my @V_def; my @V_w32; my $v; my $c; -foreach (0 .. 255) { +foreach (0 .. 127) { $c = sprintf("%c", $_); $v = 0; $v |= $NUMBER if $c =~ /[0-9]/; @@ -40,7 +39,6 @@ foreach (0 .. 255) { $v |= $QUOTE if $c =~ /['`"]/; # for emacs: "`' $v |= $COMMENT if $c =~ /\#/; $v |= $EOF if $c =~ /\0/; - $v |= $HIGHBIT if $c =~ /[\x80-\xff]/; push(@V_def, $v); $v = 0; @@ -53,7 +51,6 @@ foreach (0 .. 255) { $v |= $DQUOTE if $c =~ /["]/; # for emacs: " $v |= $FCOMMENT if $c =~ /;/; $v |= $EOF if $c =~ /\0/; - $v |= $HIGHBIT if $c =~ /[\x80-\xff]/; push(@V_w32, $v); } @@ -84,7 +81,6 @@ print <<"EOF"; #define CONF_COMMENT $COMMENT #define CONF_FCOMMENT $FCOMMENT #define CONF_EOF $EOF -#define CONF_HIGHBIT $HIGHBIT #define CONF_ALPHA (CONF_UPPER|CONF_LOWER) #define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) #define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT) @@ -92,9 +88,9 @@ print <<"EOF"; #define KEYTYPES(c) ((const unsigned short *)((c)->meth_data)) #ifndef CHARSET_EBCDIC -# define CVT(a) ((a) & 0xFF) +# define CVT(a) ((a) & 0x7F) #else -# define CVT(a) os_toascci[(a) & 0FF] +# define CVT(a) os_toascci[(a) & 0x7F] #endif #define IS_COMMENT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_COMMENT) @@ -107,21 +103,20 @@ print <<"EOF"; #define IS_ALNUM_PUNCT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_ALNUM_PUNCT) #define IS_QUOTE(c,a) (KEYTYPES(c)[CVT(a)] & CONF_QUOTE) #define IS_DQUOTE(c,a) (KEYTYPES(c)[CVT(a)] & CONF_DQUOTE) -#define IS_HIGHBIT(c,a) (KEYTYPES(c)[CVT(a)] & CONF_HIGHBIT) EOF my $i; -print "static const unsigned short CONF_type_default[256] = {"; -for ($i = 0; $i < 256; $i++) { +print "static const unsigned short CONF_type_default[128] = {"; +for ($i = 0; $i < 128; $i++) { print "\n " if ($i % 8) == 0; printf " 0x%04X,", $V_def[$i]; } print "\n};\n\n"; -print "static const unsigned short CONF_type_win32[256] = {"; -for ($i = 0; $i < 256; $i++) { +print "static const unsigned short CONF_type_win32[128] = {"; +for ($i = 0; $i < 128; $i++) { print "\n " if ($i % 8) == 0; printf " 0x%04X,", $V_w32[$i]; } -- 2.25.1