Add a simple method to run regression tests
[openssl.git] / util / mkdef.pl
index 16a660f5a5c9cf7a043c5235b7dfd583da10d0db..7b5e28c3344a15a590bf299f4754a392fce32ce1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /usr/bin/env perl
-# Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -133,76 +133,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;
@@ -240,14 +190,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;
@@ -299,10 +241,9 @@ 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";
 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 +1079,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;