summaryrefslogtreecommitdiffstats
path: root/util/ck_errf.pl
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-06-11 16:26:19 +0200
committerRichard Levitte <levitte@openssl.org>2018-06-11 17:52:28 +0200
commita21180b70f6372fee836557df187d72f7a91b686 (patch)
tree8abcceade2e5ba7d76bb1358a274bae2e88402b6 /util/ck_errf.pl
parentfa92c69aafc40a87c9b0dded9c365348a8ac4b33 (diff)
util/ck_errf.pl: add detection of unknown libcrypto and libssl libs
The list of known libs are readily available in crypto/err/openssl.ec, so lets use it to figure out if all error function codes belong to known libs. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6455)
Diffstat (limited to 'util/ck_errf.pl')
-rwxr-xr-xutil/ck_errf.pl23
1 files changed, 21 insertions, 2 deletions
diff --git a/util/ck_errf.pl b/util/ck_errf.pl
index ada23523fc..a0784279de 100755
--- a/util/ck_errf.pl
+++ b/util/ck_errf.pl
@@ -19,6 +19,20 @@ use warnings;
my $err_strict = 0;
my $bad = 0;
+# To detect if there is any error generation for a libcrypto/libssl libs
+# we don't know, we need to find out what libs we do know. That list is
+# readily available in crypto/err/openssl.ec, in form of lines starting
+# with "L ".
+my $config = "crypto/err/openssl.ec";
+my %libs = ( "SYS" => 1 );
+open my $cfh, $config or die "Trying to read $config: $!\n";
+while (<$cfh>) {
+ s|\R$||; # Better chomp
+ next unless m|^L ([0-9A-Z_]+)\s|;
+ next if $1 eq "NONE";
+ $libs{$1} = 1;
+}
+
foreach my $file (@ARGV) {
if ( $file eq "-strict" ) {
$err_strict = 1;
@@ -33,17 +47,22 @@ foreach my $file (@ARGV) {
$func = $1;
$func =~ tr/A-Z/a-z/;
}
- if ( /([A-Z0-9]+)err\(([^,]+)/ && !/ckerr_ignore/ ) {
+ if ( /([A-Z0-9_]+[A-Z0-9])err\(([^,]+)/ && !/ckerr_ignore/ ) {
my $errlib = $1;
my $n = $2;
+ unless ( $libs{$errlib} ) {
+ print "$file:$.:$errlib unknown\n";
+ $bad = 1;
+ }
+
if ( $func eq "" ) {
print "$file:$.:???:$n\n";
$bad = 1;
next;
}
- if ( $n !~ /([^_]+)_F_(.+)$/ ) {
+ if ( $n !~ /^(.+)_F_(.+)$/ ) {
#print "check -$file:$.:$func:$n\n";
next;
}