+
+ my $algs;
+ my $plays;
+
+ foreach (split /;/, $def) {
+ my $s; my $k = "FUNCTION"; my $p; my $a;
+ s/^[\n\s]*//g;
+ s/[\n\s]*$//g;
+ next if(/\#undef/);
+ next if(/typedef\W/);
+ next if(/\#define/);
+
+ if (/^\#INFO:([^:]*):(.*)$/) {
+ $plats = $1;
+ $algs = $2;
+ next;
+ } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+)(\[[0-9]*\])*\s*$/) {
+ $s = $1;
+ $k = "VARIABLE";
+ } elsif (/\(\*(\w*)\([^\)]+/) {
+ $s = $1;
+ } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) {
+ # K&R C
+ next;
+ } elsif (/\w+\W+\w+\W*\(.*\)$/s) {
+ while (not /\(\)$/s) {
+ s/[^\(\)]*\)$/\)/s;
+ s/\([^\(\)]*\)\)$/\)/s;
+ }
+ s/\(void\)//;
+ /(\w+)\W*\(\)/s;
+ $s = $1;
+ } elsif (/\(/ and not (/=/)) {
+ print STDERR "File $file: cannot parse: $_;\n";
+ next;
+ } else {
+ next;
+ }
+
+ $syms{$s} = 1;
+ $kind{$s} = $k;
+
+ $p = $plats;
+ $a = $algs;
+ $a .= ",BF" if($s =~ /EVP_bf/);
+ $a .= ",CAST" if($s =~ /EVP_cast/);
+ $a .= ",DES" if($s =~ /EVP_des/);
+ $a .= ",DSA" if($s =~ /EVP_dss/);
+ $a .= ",IDEA" if($s =~ /EVP_idea/);
+ $a .= ",MD2" if($s =~ /EVP_md2/);
+ $a .= ",MD4" if($s =~ /EVP_md4/);
+ $a .= ",MD5" if($s =~ /EVP_md5/);
+ $a .= ",RC2" if($s =~ /EVP_rc2/);
+ $a .= ",RC4" if($s =~ /EVP_rc4/);
+ $a .= ",RC5" if($s =~ /EVP_rc5/);
+ $a .= ",RIPEMD" if($s =~ /EVP_ripemd/);
+ $a .= ",SHA" if($s =~ /EVP_sha/);
+ $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/);
+ $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
+ $a .= ",RSA" if($s =~ /RSAPrivateKey/);
+ $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
+
+ $platform{$s} .= ','.$p;
+ $algorithm{$s} .= ','.$a;
+
+ if (defined($rename{$s})) {
+ (my $r, my $p) = split(/:/,$rename{$s});
+ my @ip = map { /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p;
+ $syms{$r} = 1;
+ $kind{$r} = $kind{$s}."(".$s.")";
+ $algorithm{$r} = $algorithm{$s};
+ $platform{$r} = $platform{$s}.",".$p;
+ $platform{$s} .= ','.join(',', @ip).','.join(',', @ip);
+ }