Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/ck_errf.pl: add detection of unknown libcrypto and libssl libs #6455

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 21 additions & 2 deletions util/ck_errf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
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;
Expand All @@ -33,17 +47,22 @@
$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;
}
Expand Down