Ask for tests in CONTRIBUTING
[openssl.git] / util / mkdef.pl
index 03c8d805752b6ceebd0ec6a23d10048cc434744f..097d25283b322d1ef2565c23433a415d42f3969a 100755 (executable)
@@ -38,6 +38,9 @@
 #   exclude.
 #
 
+use lib ".";
+use configdata;
+
 my $debug=0;
 
 my $crypto_num= "util/libeay.num";
@@ -84,6 +87,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
                          "CRYPTO_MDEBUG",
                         # Engines
                          "STATIC_ENGINE", "ENGINE", "HW", "GMP",
+                        # Entropy Gathering
+                        "EGD",
                          # X.509v3 Signed Certificate Timestamps
                          "SCT",
                         # RFC3779
@@ -124,19 +129,11 @@ foreach (@known_algorithms) {
     $disabled_algorithms{$_} = 0;
 }
 # disabled by default
-$disabled_algorithms{"CRYPTO_MDEBUG"} = 1;
 $disabled_algorithms{"STATIC_ENGINE"} = 1;
 
-my $options="";
-open(IN,"<Makefile") || die "unable to open Makefile!\n";
-while(<IN>) {
-    $options=$1 if (/^OPTIONS=(.*)$/);
-}
-close(IN);
-
 my $zlib;
 
-foreach (@ARGV, split(/ /, $options))
+foreach (@ARGV, split(/ /, $config{options}))
        {
        $debug=1 if $_ eq "debug";
        $W32=1 if $_ eq "32";
@@ -295,7 +292,6 @@ $crypto.=" include/openssl/comp.h" ; # unless $no_comp;
 $crypto.=" include/openssl/ocsp.h";
 $crypto.=" include/openssl/ui.h";
 #$crypto.=" include/openssl/store.h";
-$crypto.=" include/openssl/pqueue.h";
 $crypto.=" include/openssl/cms.h";
 $crypto.=" include/openssl/jpake.h";
 $crypto.=" include/openssl/srp.h";
@@ -1176,14 +1172,7 @@ sub print_test_file
 }
 
 sub get_version {
-   local *MF;
-   my $v = '?';
-   open MF, 'Makefile' or return $v;
-   while (<MF>) {
-     $v = $1, last if /^VERSION=(.*?)\s*$/;
-   }
-   close MF;
-   return $v;
+   return $config{version};
 }
 
 sub print_def_file
@@ -1199,7 +1188,7 @@ sub print_def_file
        my $prevsymversion = "", $prevprevsymversion = "";
         # For VMS
         my $prevnum = 0;
-        my $symbolcount = 0;
+        my $symvtextcount = 0;
 
        if ($W32)
                { $libname.="32"; }
@@ -1235,11 +1224,13 @@ EOF
                 {
                 my $libref = $name eq "ssl" ? "LIBCRYPTO.EXE /SHARE" : "";
                 print OUT <<"EOF";
-IDENTIFICATION="LIB$libname V$version"
+IDENTIFICATION="V$version"
+CASE_SENSITIVE=YES
 LIB$libname.OLB /LIBRARY
 $libref
 SYMBOL_VECTOR=(-
 EOF
+                $symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
                 }
 
        (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols);
@@ -1303,25 +1294,34 @@ EOF
                                                print OUT "        $s2;\n";
                                         } elsif ($VMS) {
                                             while(++$prevnum < $n) {
-                                                if ($symbolcount > 1023) {
+                                                my $symline="SPARE, SPARE -";
+                                                if ($symvtextcount + length($symline) + 1 > 1024) {
                                                     print OUT ")\nSYMBOL_VECTOR=(-\n";
-                                                    $symbolcount = 0;
+                                                    $symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
                                                 }
-                                                print OUT $symbolcount
-                                                    ? "    ," : "    ";
-                                                print OUT "dummy$prevnum=PRIVATE_PROCEDURE -\n";
-                                                $symbolcount++;
+                                                if ($symvtextcount > 16) {
+                                                    $symline = ",".$symline;
+                                                }
+                                                print OUT "    $symline\n";
+                                                $symvtextcount += length($symline);
                                             }
                                             (my $s_uc = $s) =~ tr/a-z/A-Z/;
-                                            if ($symbolcount > 1023) {
+                                            my $symtype=
+                                                $v ? "DATA" : "PROCEDURE";
+                                            my $symline=
+                                                ($s_uc ne $s
+                                                 ? "$s_uc/$s=$symtype, $s=$symtype"
+                                                 : "$s=$symtype, SPARE")
+                                                ." -";
+                                            if ($symvtextcount + length($symline) + 1 > 1024) {
                                                 print OUT ")\nSYMBOL_VECTOR=(-\n";
-                                                $symbolcount = 0;
+                                                $symvtextcount = 16; # length of "SYMBOL_VECTOR=(-"
+                                            }
+                                            if ($symvtextcount > 16) {
+                                                $symline = ",".$symline;
                                             }
-                                            print OUT $symbolcount
-                                                ? "    ," : "    ";
-                                            print OUT "$s_uc/$s="
-                                                , ($v ? "DATA" : "PROCEDURE"), " -\n";
-                                            $symbolcount++;
+                                            print OUT "    $symline\n";
+                                            $symvtextcount += length($symline);
                                        } elsif($v && !$OS2) {
                                                printf OUT "    %s%-39s @%-8d DATA\n",
                                                                ($W32)?"":"_",$s2,$n;
@@ -1560,7 +1560,7 @@ sub get_openssl_version()
        while(<IN>) {
                if (/OPENSSL_VERSION_TEXT\s+"OpenSSL (\d\.\d\.)(\d[a-z]*)(-| )/) {
                        my $suffix = $2;
-                       my $baseversion = $1 =~ s/\./_/gr;
+                       (my $baseversion = $1) =~ s/\./_/g;
                        close IN;
                        return ($baseversion."0", $baseversion.$suffix);
                }