Accept Windows line endings on inputs on any platform

Accept Windows line endings in input files on any platform. This makes
the scripts work even when running a Unix perl with a source tree that
has Windows line endings, as happens for example on our Travis Windows
instances. This change is harmless in the common case where the input
has the platform's default line endings.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/scripts/generate_errors.pl b/scripts/generate_errors.pl
index ed17a0d..606714f 100755
--- a/scripts/generate_errors.pl
+++ b/scripts/generate_errors.pl
@@ -56,7 +56,7 @@
 my $line_separator = $/;
 undef $/;
 
-open(FORMAT_FILE, "$error_format_file") or die "Opening error format file '$error_format_file': $!";
+open(FORMAT_FILE, '<:crlf', "$error_format_file") or die "Opening error format file '$error_format_file': $!";
 my $error_format = <FORMAT_FILE>;
 close(FORMAT_FILE);
 
@@ -66,7 +66,7 @@
 my @necessary_include_files;
 my @matches;
 foreach my $file (@files) {
-    open(FILE, "$file");
+    open(FILE, '<:crlf', "$file");
     my @grep_res = grep(/^\s*#define\s+MBEDTLS_ERR_\w+\s+\-0x[0-9A-Fa-f]+/, <FILE>);
     push(@matches, @grep_res);
     close FILE;
diff --git a/scripts/generate_features.pl b/scripts/generate_features.pl
index 74a9527..6b1dcbf 100755
--- a/scripts/generate_features.pl
+++ b/scripts/generate_features.pl
@@ -45,13 +45,13 @@
 my $line_separator = $/;
 undef $/;
 
-open(FORMAT_FILE, "$feature_format_file") or die "Opening feature format file '$feature_format_file': $!";
+open(FORMAT_FILE, '<:crlf', "$feature_format_file") or die "Opening feature format file '$feature_format_file': $!";
 my $feature_format = <FORMAT_FILE>;
 close(FORMAT_FILE);
 
 $/ = $line_separator;
 
-open(CONFIG_H, "$include_dir/config.h") || die("Failure when opening config.h: $!");
+open(CONFIG_H, '<:crlf', "$include_dir/config.h") || die("Failure when opening config.h: $!");
 
 my $feature_defines = "";
 my $in_section = 0;