Add EVP_PKEY_set_alias_type
[openssl.git] / util / mkdef.pl
index 98cdae537c45cbdbc64b9f9b4cac43e58919c480..327728eedaad7fc3df114f982d2cb43d2e99106f 100755 (executable)
@@ -126,6 +126,7 @@ my $W32=0;
 my $NT=0;
 my $UNIX=0;
 my $linux=0;
+my $aix=0;
 # Set this to make typesafe STACK definitions appear in DEF
 my $safe_stack_def = 0;
 
@@ -133,76 +134,26 @@ my @known_platforms = ( "__FreeBSD__", "PERL5",
                        "EXPORT_VAR_AS_FUNCTION", "ZLIB", "_WIN32"
                        );
 my @known_ossl_platforms = ( "UNIX", "VMS", "WIN32", "WINNT", "OS2" );
-my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
-                        "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
-                        "SHA256", "SHA512", "RMD160",
-                        "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "EC2M",
-                        "HMAC", "AES", "CAMELLIA", "SEED", "GOST", "ARIA", "SM4",
-                         "SCRYPT", "CHACHA", "POLY1305", "BLAKE2",
-                        "SIPHASH", "SM3",
-                        # EC_NISTP_64_GCC_128
-                        "EC_NISTP_64_GCC_128",
-                        # Envelope "algorithms"
-                        "EVP", "X509", "ASN1_TYPEDEFS",
-                        # Helper "algorithms"
-                        "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR",
-                        "LOCKING",
-                        # External "algorithms"
-                        "FP_API", "STDIO", "SOCK", "DGRAM",
-                         "CRYPTO_MDEBUG",
-                        # Engines
-                         "STATIC_ENGINE", "ENGINE", "HW", "GMP",
-                        # Entropy Gathering
-                        "EGD",
-                        # Certificate Transparency
-                        "CT",
-                        # RFC3779
-                        "RFC3779",
-                        # TLS
-                        "PSK", "SRP", "HEARTBEATS",
-                        # CMS
-                        "CMS",
-                         "OCSP",
-                        # CryptoAPI Engine
-                        "CAPIENG",
-                        # SSL methods
-                        "SSL3_METHOD", "TLS1_METHOD", "TLS1_1_METHOD", "TLS1_2_METHOD", "DTLS1_METHOD", "DTLS1_2_METHOD",
-                        # NEXTPROTONEG
-                        "NEXTPROTONEG",
-                        # Deprecated functions
+my @known_algorithms = ( # These are algorithms we know are guarded in relevant
+                        # header files, but aren't actually disablable.
+                        # Without these, this script will warn a lot.
+                        "RSA", "MD5",
+                        # @disablables comes from configdata.pm
+                        map { (my $x = uc $_) =~ s|-|_|g; $x; } @disablables,
+                        # Deprecated functions.  Not really algorithmss, but
+                        # treated as such here for the sake of simplicity
                         "DEPRECATEDIN_0_9_8",
                         "DEPRECATEDIN_1_0_0",
                         "DEPRECATEDIN_1_1_0",
                         "DEPRECATEDIN_1_2_0",
-                        # SCTP
-                        "SCTP",
-                        # SRTP
-                        "SRTP",
-                        # SSL TRACE
-                        "SSL_TRACE",
-                        # Unit testing
-                        "UNIT_TEST",
-                        # User Interface
-                        "UI_CONSOLE",
-                        #
-                        "TS",
-                        # OCB mode
-                        "OCB",
-                        "CMAC",
-                         # APPLINK (win build feature?)
-                         "APPLINK"
                      );
 
-my %disabled_algorithms;
-
-foreach (@known_algorithms) {
-    $disabled_algorithms{$_} = 0;
-}
-# disabled by default
-$disabled_algorithms{"STATIC_ENGINE"} = 1;
+# %disabled comes from configdata.pm
+my %disabled_algorithms =
+    map { (my $x = uc $_) =~ s|-|_|g; $x => 1; } keys %disabled;
 
 my $apiv = sprintf "%x%02x%02x", split(/\./, $config{api});
-foreach (keys %disabled_algorithms) {
+foreach (@known_algorithms) {
        if (/^DEPRECATEDIN_(\d+)_(\d+)_(\d+)$/) {
                my $depv = sprintf "%x%02x%02x", $1, $2, $3;
                $disabled_algorithms{$_} = 1 if $apiv ge $depv;
@@ -221,12 +172,15 @@ foreach (@ARGV, split(/ /, $config{options}))
        if($_ eq "NT") {
                $W32 = 1;
                $NT = 1;
-       }
-       if ($_ eq "linux") {
+       } elsif ($_ eq "linux") {
                $linux=1;
                $UNIX=1;
+       } elsif ($_ eq "aix") {
+               $aix=1;
+               $UNIX=1;
+       } elsif ($_ eq "VMS") {
+               $VMS=1;
        }
-       $VMS=1 if $_ eq "VMS";
        if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic"
                         || $_ eq "enable-zlib-dynamic") {
                $zlib = 1;
@@ -240,14 +194,6 @@ foreach (@ARGV, split(/ /, $config{options}))
        $do_ctest=1 if $_ eq "ctest";
        $do_ctestall=1 if $_ eq "ctestall";
        $do_checkexist=1 if $_ eq "exist";
-       if (/^(enable|disable|no)-(.*)$/) {
-               my $alg = uc $2;
-               $alg =~ tr/-/_/;
-               if (exists $disabled_algorithms{$alg}) {
-                       $disabled_algorithms{$alg} = $1 eq "enable" ? 0 : 1;
-               }
-       }
-
        }
 $libname = $unified_info{sharednames}->{libcrypto} if $do_crypto;
 $libname = $unified_info{sharednames}->{libssl} if $do_ssl;
@@ -262,11 +208,11 @@ if (!$libname) {
 }
 
 # If no platform is given, assume WIN32
-if ($W32 + $VMS + $linux == 0) {
+if ($W32 + $VMS + $linux + $aix == 0) {
        $W32 = 1;
 }
 die "Please, only one platform at a time"
-    if ($W32 + $VMS + $linux > 1);
+    if ($W32 + $VMS + $linux + $aix > 1);
 
 if (!$do_ssl && !$do_crypto)
        {
@@ -299,10 +245,10 @@ my $crypto ="include/internal/dso.h";
 $crypto.=" include/internal/o_dir.h";
 $crypto.=" include/internal/o_str.h";
 $crypto.=" include/internal/err.h";
-$crypto.=" include/internal/rand.h";
+$crypto.=" include/internal/sslconf.h";
 foreach my $f ( glob(catfile($config{sourcedir},'include/openssl/*.h')) ) {
     my $fn = "include/openssl/" . lc(basename($f));
-    $crypto .= " $fn" if !defined $skipthese{$fn} && $f !~ m@/[a-z]+err\.h$@;
+    $crypto .= " $fn" if !defined $skipthese{$fn};
 }
 
 my $symhacks="include/openssl/symhacks.h";
@@ -1138,7 +1084,7 @@ sub is_valid
                        return 0;
                } else {
                        # algorithms
-                       if ($disabled_algorithms{$keyword} == 1) { return 0;}
+                       if ($disabled_algorithms{$keyword}) { return 0;}
 
                        # Nothing recognise as true
                        return 1;
@@ -1295,6 +1241,8 @@ EOF
                                                        $prevsymversion = $symversion;
                                                }
                                                print OUT "        $s2;\n";
+                                       } elsif ($aix) {
+                                               print OUT "$s2\n";
                                         } elsif ($VMS) {
                                             while(++$prevnum < $n) {
                                                 my $symline=" ,SPARE -\n  ,SPARE -\n";
@@ -1346,7 +1294,7 @@ EOF
        } elsif ($VMS) {
             print OUT ")\n";
             (my $libvmaj, my $libvmin, my $libvedit) =
-                $currversion =~ /^(\d+)_(\d+)_(\d+)$/;
+                $currversion =~ /^(\d+)_(\d+)_(\d+)[a-z]{0,2}$/;
             # The reason to multiply the edit number with 100 is to make space
             # for the possibility that we want to encode the patch letters
             print OUT "GSMATCH=LEQUAL,",($libvmaj * 100 + $libvmin),",",($libvedit * 100),"\n";