Perl's chop / chomp considered bad, use a regexp instead
[openssl.git] / util / fipslink.pl
index 4a88fc6d77e07d36b25d95fdb7c8f782e7666d79..7b16e04fb9da7a752254600f6b7d096e2d653780 100644 (file)
@@ -59,7 +59,7 @@ open my $sha1_res, '<', $fips_target.".sha1" or die "Get hash failure";
 $fips_hash=<$sha1_res>;
 close $sha1_res;
 unlink $fips_target.".sha1";
-chomp $fips_hash;
+$fips_hash =~ s|\R$||;          # Better chomp
 die "Get hash failure" if $? != 0;
 
 
@@ -97,8 +97,8 @@ sub check_hash
        $hashfile = <IN>;
        close IN;
        $hashval = `$sha1_exe ${fips_libdir}/$filename`;
-       chomp $hashfile;
-       chomp $hashval;
+       $hashfile =~ s|\R$||;    # Better chomp
+       $hashval =~ s|\R$||;     # Better chomp
        $hashfile =~ s/^.*=\s+//;
        $hashval =~ s/^.*=\s+//;
        die "Invalid hash syntax in file" if (length($hashfile) != 40);