Because Rijndael is more known as AES, use crypto/aes instead of
[openssl.git] / util / mkdef.pl
index ea2ae499f9778c307043197d7bfc9711362ba50e..071036a6d2caf6b67540cc16399512f12626a86b 100755 (executable)
@@ -60,7 +60,7 @@ my $crypto_num= "util/libeay.num";
 my $ssl_num=    "util/ssleay.num";
 
 my $do_update = 0;
-my $do_rewrite = 0;
+my $do_rewrite = 1;
 my $do_crypto = 0;
 my $do_ssl = 0;
 my $do_ctest = 0;
@@ -195,7 +195,7 @@ my $ssl="ssl/ssl.h";
 $ssl.=" ssl/kssl.h";
 
 my $crypto ="crypto/crypto.h";
-$crypto.=" crypto/des/des.h" ; # unless $no_des;
+$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des;
 $crypto.=" crypto/idea/idea.h" ; # unless $no_idea;
 $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4;
 $crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5;
@@ -208,8 +208,7 @@ $crypto.=" crypto/md5/md5.h" ; # unless $no_md5;
 $crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2;
 $crypto.=" crypto/sha/sha.h" ; # unless $no_sha;
 $crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd;
-$crypto.=" crypto/rijndael/rijndael.h" ; # unless $no_aes;
-$crypto.=" crypto/rijndael/rd_fst.h" ; # unless $no_aes;
+$crypto.=" crypto/aes/aes.h" ; # unless $no_aes;
 
 $crypto.=" crypto/bn/bn.h";
 $crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa;
@@ -243,6 +242,8 @@ $crypto.=" crypto/x509v3/x509v3.h";
 $crypto.=" crypto/rand/rand.h";
 $crypto.=" crypto/comp/comp.h" ; # unless $no_comp;
 $crypto.=" crypto/ocsp/ocsp.h";
+$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
+$crypto.=" crypto/krb5/krb5_asn.h";
 $crypto.=" crypto/tmdiff.h";
 
 my $symhacks="crypto/symhacks.h";
@@ -258,7 +259,6 @@ if ($do_ssl == 1) {
        if ($do_rewrite == 1) {
                open(OUT, ">$ssl_num");
                &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
-               close OUT;
        } else {
                open(OUT, ">>$ssl_num");
        }
@@ -331,6 +331,7 @@ sub do_defs
 
        foreach $file (split(/\s+/,$symhacksfile." ".$files))
                {
+               print STDERR "DEBUG: starting on $file:\n" if $debug;
                open(IN,"<$file") || die "unable to open $file:$!\n";
                my $line = "", my $def= "";
                my %tag = (
@@ -399,7 +400,7 @@ sub do_defs
 
                print STDERR "DEBUG: parsing ----------\n" if $debug;
                while(<IN>) {
-                       last if (/BEGIN ERROR CODES/);
+                       last if (/\/\* Error codes for the \w+ functions\. \*\//);
                        if ($line ne '') {
                                $_ = $line . $_;
                                $line = '';
@@ -784,14 +785,18 @@ sub do_defs
                        if (/^\#INFO:([^:]*):(.*)$/) {
                                $plats = $1;
                                $algs = $2;
+                               print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug;
                                next;
                        } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) {
                                $s = $1;
                                $k = "VARIABLE";
+                               print STDERR "DEBUG: found external variable $s\n" if $debug;
                        } elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) {
                                $s = $1;
+                               print STDERR "DEBUG: found ANSI C function $s\n" if $debug;
                        } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) {
                                # K&R C
+                               print STDERR "DEBUG: found K&R C function $s\n" if $debug;
                                next;
                        } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)$/s) {
                                while (not /\(\)$/s) {
@@ -801,6 +806,7 @@ sub do_defs
                                s/\(void\)//;
                                /(\w+(\{[0-9]+\})?)\W*\(\)/s;
                                $s = $1;
+                               print STDERR "DEBUG: found function $s\n" if $debug;
                        } elsif (/\(/ and not (/=/)) {
                                print STDERR "File $file: cannot parse: $_;\n";
                                next;
@@ -993,7 +999,7 @@ sub is_valid
                        # EXPORT_VAR_AS_FUNCTION means that global variables
                        # will be represented as functions.  This currently
                        # only happens on VMS-VAX.
-                       if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && $VMSVAX) {
+                       if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
                                return 1;
                        }
                        return 0;
@@ -1015,8 +1021,17 @@ sub is_valid
                        if ($keyword eq "RSA" && $no_rsa) { return 0; }
                        if ($keyword eq "DSA" && $no_dsa) { return 0; }
                        if ($keyword eq "DH" && $no_dh) { return 0; }
+                       if ($keyword eq "EC" && $no_ec) { return 0; }
                        if ($keyword eq "HMAC" && $no_hmac) { return 0; }
                        if ($keyword eq "AES" && $no_aes) { return 0; }
+                       if ($keyword eq "EVP" && $no_evp) { return 0; }
+                       if ($keyword eq "LHASH" && $no_lhash) { return 0; }
+                       if ($keyword eq "STACK" && $no_stack) { return 0; }
+                       if ($keyword eq "ERR" && $no_err) { return 0; }
+                       if ($keyword eq "BUFFER" && $no_buffer) { return 0; }
+                       if ($keyword eq "BIO" && $no_bio) { return 0; }
+                       if ($keyword eq "COMP" && $no_comp) { return 0; }
+                       if ($keyword eq "DSO" && $no_dso) { return 0; }
                        if ($keyword eq "KRB5" && $no_krb5) { return 0; }
                        if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
 
@@ -1234,7 +1249,10 @@ sub rewrite_numbers
                $syms{$n} = 1;
        }
 
-       my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
+       my @s=sort {
+           &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n")
+           || $a cmp $b
+       } keys %nums;
        foreach $sym (@s) {
                (my $n, my $i) = split /\\/, $nums{$sym};
                next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;