Make the 'crypto' and 'ssl' options in the perl script mkdef.pl really work,
authorDr. Stephen Henson <steve@openssl.org>
Thu, 11 Feb 1999 01:39:30 +0000 (01:39 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 11 Feb 1999 01:39:30 +0000 (01:39 +0000)
also add an 'update' option to automatically append any new functions to the
ssleay.num and libeay.num files.

CHANGES
util/libeay.num
util/mkdef.pl

diff --git a/CHANGES b/CHANGES
index df4d3e25a799be994ac2f35464557eff5479b9ac..697252b1600e2b3795f99648806512383e186444 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,14 @@
 
  Changes between 0.9.1c and 0.9.2
 
+  *) Modifications to the mkdef.pl for Win32 DEF file creation. The usage
+     message is now correct (it understands "crypto" and "ssl" on its
+     command line). There is also now an "update" option. This will update
+     the util/ssleay.num and util/libeay.num files with any new functions.
+     If you do a: 
+     perl util/mkdef.pl crypto ssl update
+     it will update them.
+
   *) Overhauled the Perl interface (perl/*):
      - ported BN stuff to OpenSSL's different BN library
      - made the perl/ source tree CVS-aware
index e8b636cf963ff3c93ff276eae95b6d4632dbf876..271a5c9c705e85bb563f90a100c5b47e0c232dda 100755 (executable)
@@ -1174,3 +1174,25 @@ i2d_BASIC_CONSTRAINTS                    1199
 i2d_NETSCAPE_CERT_SEQUENCE             1200
 i2d_ext_ku                             1201
 EVP_MD_CTX_copy                                1202
+i2d_ASN1_ENUMERATED                     1203
+d2i_ASN1_ENUMERATED                     1204
+ASN1_ENUMERATED_set                     1205
+ASN1_ENUMERATED_get                     1206
+BN_to_ASN1_ENUMERATED                   1207
+ASN1_ENUMERATED_to_BN                   1208
+i2a_ASN1_ENUMERATED                     1209
+a2i_ASN1_ENUMERATED                     1210
+i2d_GENERAL_NAME                        1211
+d2i_GENERAL_NAME                        1212
+GENERAL_NAME_new                        1213
+GENERAL_NAME_free                       1214
+GENERAL_NAMES_new                       1215
+GENERAL_NAMES_free                      1216
+d2i_GENERAL_NAMES                       1217
+i2d_GENERAL_NAMES                       1218
+i2v_GENERAL_NAMES                       1219
+i2s_ASN1_OCTET_STRING                   1220
+s2i_ASN1_OCTET_STRING                   1221
+X509V3_EXT_check_conf                   1222
+hex_to_string                           1223
+string_to_hex                           1224
index 5b2f355bb48ccee18d969dc64457f685ac29c614..e1f2ca99a10571bb911b830e5a0a4c8fd3c59c43 100755 (executable)
@@ -15,7 +15,10 @@ foreach (@ARGV)
        $NT=1 if $_ eq "32";
        $NT=0 if $_ eq "16";
        $do_ssl=1 if $_ eq "ssleay";
+       $do_ssl=1 if $_ eq "ssl";
        $do_crypto=1 if $_ eq "libeay";
+       $do_crypto=1 if $_ eq "crypto";
+       $do_update=1 if $_ eq "update";
        }
 
 if (!$do_ssl && !$do_crypto)
@@ -25,7 +28,9 @@ if (!$do_ssl && !$do_crypto)
        }
 
 %ssl_list=&load_numbers($ssl_num);
+$max_ssl = $max_num;
 %crypto_list=&load_numbers($crypto_num);
+$max_crypto = $max_num;
 
 $ssl="ssl/ssl.h";
 
@@ -74,11 +79,33 @@ $crypto.=" crypto/tmdiff.h";
 $match{'NOPROTO'}=1;
 $match2{'PERL5'}=1;
 
-&print_def_file(*STDOUT,"SSLEAY",*ssl_list,&do_defs("SSLEAY",$ssl))
-       if $do_ssl == 1;
+@ssl_func = &do_defs("SSLEAY", $ssl);
+@crypto_func = &do_defs("LIBEAY", $crypto);
+
+if ($do_update) {
+
+if ($do_ssl == 1) {
+       open(OUT, ">>$ssl_num");
+       &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl, @ssl_func);
+       close OUT;
+}
+
+if($do_crypto == 1) {
+       open(OUT, ">>$crypto_num");
+       &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto, @crypto_func);
+       close OUT;
+}
+
+} else {
+
+       &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_func)
+               if $do_ssl == 1;
+
+       &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_func)
+               if $do_crypto == 1;
+
+}
 
-&print_def_file(*STDOUT,"LIBEAY",*crypto_list,&do_defs("LIBEAY",$crypto))
-       if $do_crypto == 1;
 
 sub do_defs
        {
@@ -98,7 +125,7 @@ sub do_defs
                while (($i=index($a,"/*")) >= 0)
                        {
                        $j=index($a,"*/");
-                       break unless ($j >= 0);
+                       last unless ($j >= 0);
                        $a=substr($a,0,$i).substr($a,$j+2);
                #       print "$i $j\n";
                        }
@@ -265,7 +292,8 @@ EOF
                {
                if (!defined($nums{$func}))
                        {
-                       printf STDERR "$func does not have a number assigned\n";
+                       printf STDERR "$func does not have a number assigned\n"
+                                       if(!$do_update);
                        }
                else
                        {
@@ -281,6 +309,8 @@ sub load_numbers
        local($name)=@_;
        local($j,@a,%ret);
 
+       $max_num = 0;
+
        open(IN,"<$name") || die "unable to open $name:$!\n";
        while (<IN>)
                {
@@ -289,7 +319,28 @@ sub load_numbers
                next if /^\s*$/;
                @a=split;
                $ret{$a[0]}=$a[1];
+               $max_num = $a[1] if $a[1] > $max_num;
                }
        close(IN);
        return(%ret);
        }
+
+sub update_numbers
+       {
+       local(*OUT,$name,*nums,$start_num, @functions)=@_;
+       my $new_funcs = 0;
+       print STDERR "Updating $name\n";
+       foreach $func (@functions)
+               {
+               if (!defined($nums{$func}))
+                       {
+                       $new_funcs++;
+                       printf OUT "%s%-40s%d\n","",$func, ++$start_num;
+                       }
+               }
+       if($new_funcs) {
+               print STDERR "$new_funcs New Functions added\n";
+       } else {
+               print STDERR "No New Functions Added\n";
+       }
+       }