Minor typos
[openssl.git] / util / mkdef.pl
index 2c003c4b23a3d5bbb4754c860b817adfbaaad976..9d0979939518bdefaeb7ae3f77177c65253a4d2d 100755 (executable)
@@ -43,8 +43,8 @@
 #   EXPORT_VAR_AS_FUNCTION).  This script assumes renaming of symbols is found
 #   in the file crypto/symhacks.h.
 #   The semantics for the platforms is that every item is checked against the
-#   enviroment.  For the negative items ("!FOO"), if any of them is false
-#   (i.e. "FOO" is true) in the enviroment, the corresponding symbol can't be
+#   environment.  For the negative items ("!FOO"), if any of them is false
+#   (i.e. "FOO" is true) in the environment, the corresponding symbol can't be
 #   used.  For the positive itms, if all of them are false in the environment,
 #   the corresponding symbol can't be used.  Any combination of positive and
 #   negative items are possible, and of course leave room for some redundancy.
@@ -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;
@@ -82,7 +82,7 @@ my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT" );
 my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
                         "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
                         "RIPEMD",
-                        "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES",
+                        "MDC2", "RSA", "DSA", "DH", "EC", "ECDSA", "HMAC", "AES",
                         # Envelope "algorithms"
                         "EVP", "X509", "ASN1_TYPEDEFS",
                         # Helper "algorithms"
@@ -105,7 +105,7 @@ my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
 my $no_cast;
 my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
-my $no_ec;
+my $no_ec; my $no_ecdsa;
 my $no_fp_api;
 
 foreach (@ARGV, split(/ /, $options))
@@ -155,6 +155,7 @@ foreach (@ARGV, split(/ /, $options))
        elsif (/^no-dsa$/)      { $no_dsa=1; }
        elsif (/^no-dh$/)       { $no_dh=1; }
        elsif (/^no-ec$/)       { $no_ec=1; }
+       elsif (/^no-ecdsa$/)    { $no_ecdsa=1; }
        elsif (/^no-hmac$/)     { $no_hmac=1; }
        elsif (/^no-aes$/)      { $no_aes=1; }
        elsif (/^no-evp$/)      { $no_evp=1; }
@@ -195,7 +196,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,14 +209,14 @@ $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;
 $crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa;
 $crypto.=" crypto/dh/dh.h" ; # unless $no_dh;
 $crypto.=" crypto/ec/ec.h" ; # unless $no_ec;
+$crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa;
 $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac;
 
 $crypto.=" crypto/engine/engine.h";
@@ -243,7 +244,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.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
+$crypto.=" crypto/krb5/krb5_asn.h";
 $crypto.=" crypto/tmdiff.h";
 
 my $symhacks="crypto/symhacks.h";
@@ -259,7 +261,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");
        }
@@ -332,6 +333,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 = (
@@ -400,7 +402,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 = '';
@@ -785,14 +787,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) {
@@ -802,6 +808,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;
@@ -994,7 +1001,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 || $W32)) {
+                       if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
                                return 1;
                        }
                        return 0;
@@ -1017,6 +1024,7 @@ sub is_valid
                        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 "ECDSA" && $no_ecdsa) { 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; }
@@ -1244,7 +1252,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+\)/;