diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/util/mkdef.pl | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/util/mkdef.pl')
| -rw-r--r-- | src/lib/libcrypto/util/mkdef.pl | 444 |
1 files changed, 289 insertions, 155 deletions
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index 8124f11292..80384af325 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
| @@ -1,52 +1,96 @@ | |||
| 1 | #!/usr/bin/perl | 1 | #!/usr/local/bin/perl -w |
| 2 | # | 2 | # |
| 3 | # generate a .def file | 3 | # generate a .def file |
| 4 | # | 4 | # |
| 5 | # It does this by parsing the header files and looking for the | 5 | # It does this by parsing the header files and looking for the |
| 6 | # non-prototyped functions. | 6 | # prototyped functions: it then prunes the output. |
| 7 | # | 7 | # |
| 8 | 8 | ||
| 9 | $crypto_num="util/libeay.num"; | 9 | $crypto_num="util/libeay.num"; |
| 10 | $ssl_num= "util/ssleay.num"; | 10 | $ssl_num= "util/ssleay.num"; |
| 11 | 11 | ||
| 12 | $NT=1; | 12 | my $do_update = 0; |
| 13 | foreach (@ARGV) | 13 | my $do_crypto = 0; |
| 14 | my $do_ssl = 0; | ||
| 15 | $rsaref = 0; | ||
| 16 | |||
| 17 | $W32=1; | ||
| 18 | $NT=0; | ||
| 19 | # Set this to make typesafe STACK definitions appear in DEF | ||
| 20 | $safe_stack_def = 1; | ||
| 21 | |||
| 22 | $options=""; | ||
| 23 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | ||
| 24 | while(<IN>) { | ||
| 25 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
| 26 | } | ||
| 27 | close(IN); | ||
| 28 | |||
| 29 | foreach (@ARGV, split(/ /, $options)) | ||
| 14 | { | 30 | { |
| 15 | $NT=1 if $_ eq "32"; | 31 | $W32=1 if $_ eq "32"; |
| 16 | $NT=0 if $_ eq "16"; | 32 | $W32=0 if $_ eq "16"; |
| 33 | if($_ eq "NT") { | ||
| 34 | $W32 = 1; | ||
| 35 | $NT = 1; | ||
| 36 | } | ||
| 17 | $do_ssl=1 if $_ eq "ssleay"; | 37 | $do_ssl=1 if $_ eq "ssleay"; |
| 38 | $do_ssl=1 if $_ eq "ssl"; | ||
| 18 | $do_crypto=1 if $_ eq "libeay"; | 39 | $do_crypto=1 if $_ eq "libeay"; |
| 40 | $do_crypto=1 if $_ eq "crypto"; | ||
| 41 | $do_update=1 if $_ eq "update"; | ||
| 42 | $rsaref=1 if $_ eq "rsaref"; | ||
| 43 | |||
| 44 | if (/^no-rc2$/) { $no_rc2=1; } | ||
| 45 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
| 46 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
| 47 | elsif (/^no-idea$/) { $no_idea=1; } | ||
| 48 | elsif (/^no-des$/) { $no_des=1; } | ||
| 49 | elsif (/^no-bf$/) { $no_bf=1; } | ||
| 50 | elsif (/^no-cast$/) { $no_cast=1; } | ||
| 51 | elsif (/^no-md2$/) { $no_md2=1; } | ||
| 52 | elsif (/^no-md5$/) { $no_md5=1; } | ||
| 53 | elsif (/^no-sha$/) { $no_sha=1; } | ||
| 54 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | ||
| 55 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
| 56 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
| 57 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
| 58 | elsif (/^no-dh$/) { $no_dh=1; } | ||
| 59 | elsif (/^no-hmac$/) { $no_hmac=1; } | ||
| 19 | } | 60 | } |
| 20 | 61 | ||
| 21 | if (!$do_ssl && !$do_crypto) | 62 | if (!$do_ssl && !$do_crypto) |
| 22 | { | 63 | { |
| 23 | print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 ]\n"; | 64 | print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT ] [rsaref]\n"; |
| 24 | exit(1); | 65 | exit(1); |
| 25 | } | 66 | } |
| 26 | 67 | ||
| 27 | %ssl_list=&load_numbers($ssl_num); | 68 | %ssl_list=&load_numbers($ssl_num); |
| 69 | $max_ssl = $max_num; | ||
| 28 | %crypto_list=&load_numbers($crypto_num); | 70 | %crypto_list=&load_numbers($crypto_num); |
| 71 | $max_crypto = $max_num; | ||
| 29 | 72 | ||
| 30 | $ssl="ssl/ssl.h"; | 73 | $ssl="ssl/ssl.h"; |
| 31 | 74 | ||
| 32 | $crypto ="crypto/crypto.h"; | 75 | $crypto ="crypto/crypto.h"; |
| 33 | $crypto.=" crypto/des/des.h"; | 76 | $crypto.=" crypto/des/des.h" unless $no_des; |
| 34 | $crypto.=" crypto/idea/idea.h"; | 77 | $crypto.=" crypto/idea/idea.h" unless $no_idea; |
| 35 | $crypto.=" crypto/rc4/rc4.h"; | 78 | $crypto.=" crypto/rc4/rc4.h" unless $no_rc4; |
| 36 | $crypto.=" crypto/rc5/rc5.h"; | 79 | $crypto.=" crypto/rc5/rc5.h" unless $no_rc5; |
| 37 | $crypto.=" crypto/rc2/rc2.h"; | 80 | $crypto.=" crypto/rc2/rc2.h" unless $no_rc2; |
| 38 | $crypto.=" crypto/bf/blowfish.h"; | 81 | $crypto.=" crypto/bf/blowfish.h" unless $no_bf; |
| 39 | $crypto.=" crypto/cast/cast.h"; | 82 | $crypto.=" crypto/cast/cast.h" unless $no_cast; |
| 40 | $crypto.=" crypto/md2/md2.h"; | 83 | $crypto.=" crypto/md2/md2.h" unless $no_md2; |
| 41 | $crypto.=" crypto/md5/md5.h"; | 84 | $crypto.=" crypto/md5/md5.h" unless $no_md5; |
| 42 | $crypto.=" crypto/mdc2/mdc2.h"; | 85 | $crypto.=" crypto/mdc2/mdc2.h" unless $no_mdc2; |
| 43 | $crypto.=" crypto/sha/sha.h"; | 86 | $crypto.=" crypto/sha/sha.h" unless $no_sha; |
| 44 | $crypto.=" crypto/ripemd/ripemd.h"; | 87 | $crypto.=" crypto/ripemd/ripemd.h" unless $no_ripemd; |
| 45 | 88 | ||
| 46 | $crypto.=" crypto/bn/bn.h"; | 89 | $crypto.=" crypto/bn/bn.h"; |
| 47 | $crypto.=" crypto/rsa/rsa.h"; | 90 | $crypto.=" crypto/rsa/rsa.h" unless $no_rsa; |
| 48 | $crypto.=" crypto/dsa/dsa.h"; | 91 | $crypto.=" crypto/dsa/dsa.h" unless $no_dsa; |
| 49 | $crypto.=" crypto/dh/dh.h"; | 92 | $crypto.=" crypto/dh/dh.h" unless $no_dh; |
| 93 | $crypto.=" crypto/hmac/hmac.h" unless $no_hmac; | ||
| 50 | 94 | ||
| 51 | $crypto.=" crypto/stack/stack.h"; | 95 | $crypto.=" crypto/stack/stack.h"; |
| 52 | $crypto.=" crypto/buffer/buffer.h"; | 96 | $crypto.=" crypto/buffer/buffer.h"; |
| @@ -63,182 +107,255 @@ $crypto.=" crypto/asn1/asn1.h"; | |||
| 63 | $crypto.=" crypto/asn1/asn1_mac.h"; | 107 | $crypto.=" crypto/asn1/asn1_mac.h"; |
| 64 | $crypto.=" crypto/err/err.h"; | 108 | $crypto.=" crypto/err/err.h"; |
| 65 | $crypto.=" crypto/pkcs7/pkcs7.h"; | 109 | $crypto.=" crypto/pkcs7/pkcs7.h"; |
| 110 | $crypto.=" crypto/pkcs12/pkcs12.h"; | ||
| 66 | $crypto.=" crypto/x509/x509.h"; | 111 | $crypto.=" crypto/x509/x509.h"; |
| 67 | $crypto.=" crypto/x509/x509_vfy.h"; | 112 | $crypto.=" crypto/x509/x509_vfy.h"; |
| 113 | $crypto.=" crypto/x509v3/x509v3.h"; | ||
| 68 | $crypto.=" crypto/rand/rand.h"; | 114 | $crypto.=" crypto/rand/rand.h"; |
| 69 | $crypto.=" crypto/hmac/hmac.h"; | 115 | $crypto.=" crypto/comp/comp.h"; |
| 116 | $crypto.=" crypto/tmdiff.h"; | ||
| 117 | |||
| 118 | @ssl_func = &do_defs("SSLEAY", $ssl); | ||
| 119 | @crypto_func = &do_defs("LIBEAY", $crypto); | ||
| 120 | |||
| 121 | |||
| 122 | if ($do_update) { | ||
| 123 | |||
| 124 | if ($do_ssl == 1) { | ||
| 125 | open(OUT, ">>$ssl_num"); | ||
| 126 | &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl, @ssl_func); | ||
| 127 | close OUT; | ||
| 128 | } | ||
| 70 | 129 | ||
| 71 | $match{'NOPROTO'}=1; | 130 | if($do_crypto == 1) { |
| 72 | $match2{'PERL5'}=1; | 131 | open(OUT, ">>$crypto_num"); |
| 132 | &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto, @crypto_func); | ||
| 133 | close OUT; | ||
| 134 | } | ||
| 73 | 135 | ||
| 74 | &print_def_file(*STDOUT,"SSLEAY",*ssl_list,&do_defs("SSLEAY",$ssl)) | 136 | } else { |
| 75 | if $do_ssl == 1; | 137 | |
| 138 | &print_def_file(*STDOUT,"SSLEAY",*ssl_list,@ssl_func) | ||
| 139 | if $do_ssl == 1; | ||
| 140 | |||
| 141 | &print_def_file(*STDOUT,"LIBEAY",*crypto_list,@crypto_func) | ||
| 142 | if $do_crypto == 1; | ||
| 143 | |||
| 144 | } | ||
| 76 | 145 | ||
| 77 | &print_def_file(*STDOUT,"LIBEAY",*crypto_list,&do_defs("LIBEAY",$crypto)) | ||
| 78 | if $do_crypto == 1; | ||
| 79 | 146 | ||
| 80 | sub do_defs | 147 | sub do_defs |
| 81 | { | 148 | { |
| 82 | local($name,$files)=@_; | 149 | my($name,$files)=@_; |
| 83 | local(@ret); | 150 | my @ret; |
| 151 | my %funcs; | ||
| 84 | 152 | ||
| 85 | $off=-1; | ||
| 86 | foreach $file (split(/\s+/,$files)) | 153 | foreach $file (split(/\s+/,$files)) |
| 87 | { | 154 | { |
| 88 | # print STDERR "reading $file\n"; | ||
| 89 | open(IN,"<$file") || die "unable to open $file:$!\n"; | 155 | open(IN,"<$file") || die "unable to open $file:$!\n"; |
| 90 | $depth=0; | 156 | |
| 91 | $pr=-1; | 157 | my $line = "", $def= ""; |
| 92 | @np=""; | 158 | my %tag = ( |
| 93 | $/=undef; | 159 | FreeBSD => 0, |
| 94 | $a=<IN>; | 160 | NOPROTO => 0, |
| 95 | while (($i=index($a,"/*")) >= 0) | 161 | WIN16 => 0, |
| 96 | { | 162 | PERL5 => 0, |
| 97 | $j=index($a,"*/"); | 163 | _WINDLL => 0, |
| 98 | break unless ($j >= 0); | 164 | NO_FP_API => 0, |
| 99 | $a=substr($a,0,$i).substr($a,$j+2); | 165 | CONST_STRICT => 0, |
| 100 | # print "$i $j\n"; | 166 | TRUE => 1, |
| 167 | ); | ||
| 168 | while(<IN>) { | ||
| 169 | last if (/BEGIN ERROR CODES/); | ||
| 170 | if ($line ne '') { | ||
| 171 | $_ = $line . $_; | ||
| 172 | $line = ''; | ||
| 101 | } | 173 | } |
| 102 | foreach (split("\n",$a)) | 174 | |
| 103 | { | 175 | if (/\\$/) { |
| 104 | if (/^\#\s*ifndef (.*)/) | 176 | $line = $_; |
| 105 | { | 177 | next; |
| 178 | } | ||
| 179 | |||
| 180 | $cpp = 1 if /^#.*ifdef.*cplusplus/; | ||
| 181 | if ($cpp) { | ||
| 182 | $cpp = 0 if /^#.*endif/; | ||
| 183 | next; | ||
| 184 | } | ||
| 185 | |||
| 186 | s/\/\*.*?\*\///gs; # ignore comments | ||
| 187 | s/{[^{}]*}//gs; # ignore {} blocks | ||
| 188 | if (/^\#\s*ifndef (.*)/) { | ||
| 106 | push(@tag,$1); | 189 | push(@tag,$1); |
| 107 | $tag{$1}=-1; | 190 | $tag{$1}=-1; |
| 108 | next; | 191 | next; |
| 109 | } | 192 | } elsif (/^\#\s*if !defined\(([^\)]+)\)/) { |
| 110 | elsif (/^\#\s*if !defined\(([^\)]+)\)/) | ||
| 111 | { | ||
| 112 | push(@tag,$1); | 193 | push(@tag,$1); |
| 113 | $tag{$1}=-1; | 194 | $tag{$1}=-1; |
| 114 | next; | 195 | next; |
| 115 | } | 196 | } elsif (/^\#\s*ifdef (.*)/) { |
| 116 | elsif (/^\#\s*ifdef (.*)/) | ||
| 117 | { | ||
| 118 | push(@tag,$1); | 197 | push(@tag,$1); |
| 119 | $tag{$1}=1; | 198 | $tag{$1}=1; |
| 120 | next; | 199 | next; |
| 121 | } | 200 | } elsif (/^\#\s*if defined(.*)/) { |
| 122 | elsif (/^\#\s*if defined(.*)/) | ||
| 123 | { | ||
| 124 | push(@tag,$1); | 201 | push(@tag,$1); |
| 125 | $tag{$1}=1; | 202 | $tag{$1}=1; |
| 126 | next; | 203 | next; |
| 127 | } | 204 | } elsif (/^\#\s*endif/) { |
| 128 | elsif (/^\#\s*endif/) | ||
| 129 | { | ||
| 130 | $tag{$tag[$#tag]}=0; | 205 | $tag{$tag[$#tag]}=0; |
| 131 | pop(@tag); | 206 | pop(@tag); |
| 132 | next; | 207 | next; |
| 133 | } | 208 | } elsif (/^\#\s*else/) { |
| 134 | elsif (/^\#\s*else/) | 209 | my $t=$tag[$#tag]; |
| 135 | { | ||
| 136 | $t=$tag[$#tag]; | ||
| 137 | $tag{$t}= -$tag{$t}; | 210 | $tag{$t}= -$tag{$t}; |
| 138 | next; | 211 | next; |
| 212 | } elsif (/^\#\s*if\s+1/) { | ||
| 213 | # Dummy tag | ||
| 214 | push(@tag,"TRUE"); | ||
| 215 | $tag{"TRUE"}=1; | ||
| 216 | next; | ||
| 217 | } elsif (/^\#/) { | ||
| 218 | next; | ||
| 219 | } | ||
| 220 | if ($safe_stack_def && | ||
| 221 | /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
| 222 | $funcs{"sk_${1}_new"} = 1; | ||
| 223 | $funcs{"sk_${1}_new_null"} = 1; | ||
| 224 | $funcs{"sk_${1}_free"} = 1; | ||
| 225 | $funcs{"sk_${1}_num"} = 1; | ||
| 226 | $funcs{"sk_${1}_value"} = 1; | ||
| 227 | $funcs{"sk_${1}_set"} = 1; | ||
| 228 | $funcs{"sk_${1}_zero"} = 1; | ||
| 229 | $funcs{"sk_${1}_push"} = 1; | ||
| 230 | $funcs{"sk_${1}_unshift"} = 1; | ||
| 231 | $funcs{"sk_${1}_find"} = 1; | ||
| 232 | $funcs{"sk_${1}_delete"} = 1; | ||
| 233 | $funcs{"sk_${1}_delete_ptr"} = 1; | ||
| 234 | $funcs{"sk_${1}_insert"} = 1; | ||
| 235 | $funcs{"sk_${1}_set_cmp_func"} = 1; | ||
| 236 | $funcs{"sk_${1}_dup"} = 1; | ||
| 237 | $funcs{"sk_${1}_pop_free"} = 1; | ||
| 238 | $funcs{"sk_${1}_shift"} = 1; | ||
| 239 | $funcs{"sk_${1}_pop"} = 1; | ||
| 240 | $funcs{"sk_${1}_sort"} = 1; | ||
| 241 | } elsif ($safe_stack_def && | ||
| 242 | /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { | ||
| 243 | $funcs{"d2i_ASN1_SET_OF_${1}"} = 1; | ||
| 244 | $funcs{"i2d_ASN1_SET_OF_${1}"} = 1; | ||
| 245 | } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || | ||
| 246 | /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) { | ||
| 247 | if($W32) { | ||
| 248 | $funcs{"PEM_read_${1}"} = 1; | ||
| 249 | $funcs{"PEM_write_${1}"} = 1; | ||
| 139 | } | 250 | } |
| 140 | #printf STDERR "$_\n%2d %2d %2d %2d %2d $NT\n", | 251 | $funcs{"PEM_read_bio_${1}"} = 1; |
| 141 | #$tag{'NOPROTO'},$tag{'FreeBSD'},$tag{'WIN16'},$tag{'PERL5'},$tag{'NO_FP_API'}; | 252 | $funcs{"PEM_write_bio_${1}"} = 1; |
| 142 | 253 | } elsif ( | |
| 143 | $t=undef; | ||
| 144 | if (/^extern .*;$/) | ||
| 145 | { $t=&do_extern($name,$_); } | ||
| 146 | elsif ( ($tag{'NOPROTO'} == 1) && | ||
| 147 | ($tag{'FreeBSD'} != 1) && | 254 | ($tag{'FreeBSD'} != 1) && |
| 148 | (($NT && ($tag{'WIN16'} != 1)) || | 255 | ($tag{'CONST_STRICT'} != 1) && |
| 149 | (!$NT && ($tag{'WIN16'} != -1))) && | 256 | (($W32 && ($tag{'WIN16'} != 1)) || |
| 257 | (!$W32 && ($tag{'WIN16'} != -1))) && | ||
| 150 | ($tag{'PERL5'} != 1) && | 258 | ($tag{'PERL5'} != 1) && |
| 151 | # ($tag{'_WINDLL'} != -1) && | 259 | # ($tag{'_WINDLL'} != -1) && |
| 152 | ((!$NT && $tag{'_WINDLL'} != -1) || | 260 | ((!$W32 && $tag{'_WINDLL'} != -1) || |
| 153 | ($NT && $tag{'_WINDLL'} != 1)) && | 261 | ($W32 && $tag{'_WINDLL'} != 1)) && |
| 154 | ((($tag{'NO_FP_API'} != 1) && $NT) || | 262 | ((($tag{'NO_FP_API'} != 1) && $W32) || |
| 155 | (($tag{'NO_FP_API'} != -1) && !$NT))) | 263 | (($tag{'NO_FP_API'} != -1) && !$W32))) |
| 156 | { $t=&do_line($name,$_); } | ||
| 157 | else | ||
| 158 | { $t=undef; } | ||
| 159 | if (($t ne undef) && (!$done{$name,$t})) | ||
| 160 | { | 264 | { |
| 161 | $done{$name,$t}++; | 265 | if (/{|\/\*/) { # } |
| 162 | push(@ret,$t); | 266 | $line = $_; |
| 163 | #printf STDERR "one:$t\n" if $t =~ /BIO_/; | 267 | } else { |
| 268 | $def .= $_; | ||
| 269 | } | ||
| 164 | } | 270 | } |
| 165 | } | 271 | } |
| 166 | close(IN); | 272 | close(IN); |
| 273 | |||
| 274 | foreach (split /;/, $def) { | ||
| 275 | s/^[\n\s]*//g; | ||
| 276 | s/[\n\s]*$//g; | ||
| 277 | next if(/typedef\W/); | ||
| 278 | next if(/EVP_bf/ and $no_bf); | ||
| 279 | next if(/EVP_cast/ and $no_cast); | ||
| 280 | next if(/EVP_des/ and $no_des); | ||
| 281 | next if(/EVP_dss/ and $no_dsa); | ||
| 282 | next if(/EVP_idea/ and $no_idea); | ||
| 283 | next if(/EVP_md2/ and $no_md2); | ||
| 284 | next if(/EVP_md5/ and $no_md5); | ||
| 285 | next if(/EVP_rc2/ and $no_rc2); | ||
| 286 | next if(/EVP_rc4/ and $no_rc4); | ||
| 287 | next if(/EVP_rc5/ and $no_rc5); | ||
| 288 | next if(/EVP_ripemd/ and $no_ripemd); | ||
| 289 | next if(/EVP_sha/ and $no_sha); | ||
| 290 | if (/\(\*(\w*)\([^\)]+/) { | ||
| 291 | $funcs{$1} = 1; | ||
| 292 | } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) { | ||
| 293 | # K&R C | ||
| 294 | next; | ||
| 295 | } elsif (/\w+\W+\w+\W*\(.*\)$/s) { | ||
| 296 | while (not /\(\)$/s) { | ||
| 297 | s/[^\(\)]*\)$/\)/s; | ||
| 298 | s/\([^\(\)]*\)\)$/\)/s; | ||
| 299 | } | ||
| 300 | s/\(void\)//; | ||
| 301 | /(\w+)\W*\(\)/s; | ||
| 302 | $funcs{$1} = 1; | ||
| 303 | } elsif (/\(/ and not (/=/)) { | ||
| 304 | print STDERR "File $file: cannot parse: $_;\n"; | ||
| 305 | } | ||
| 167 | } | 306 | } |
| 168 | return(@ret); | ||
| 169 | } | 307 | } |
| 170 | 308 | ||
| 171 | sub do_line | 309 | # Prune the returned functions |
| 172 | { | 310 | |
| 173 | local($file,$_)=@_; | 311 | delete $funcs{"SSL_add_dir_cert_subjects_to_stack"}; |
| 174 | local($n); | 312 | delete $funcs{"des_crypt"}; |
| 175 | 313 | delete $funcs{"RSA_PKCS1_RSAref"} unless $rsaref; | |
| 176 | return(undef) if /^$/; | 314 | |
| 177 | return(undef) if /^\s/; | 315 | if($W32) { |
| 178 | #printf STDERR "two:$_\n" if $_ =~ /BIO_/; | 316 | delete $funcs{"BIO_s_file_internal"}; |
| 179 | if (/(CRYPTO_get_locking_callback)/) | 317 | delete $funcs{"BIO_new_file_internal"}; |
| 180 | { return($1); } | 318 | delete $funcs{"BIO_new_fp_internal"}; |
| 181 | elsif (/(CRYPTO_get_id_callback)/) | 319 | } else { |
| 182 | { return($1); } | 320 | if(exists $funcs{"ERR_load_CRYPTO_strings"}) { |
| 183 | elsif (/(CRYPTO_get_add_lock_callback)/) | 321 | delete $funcs{"ERR_load_CRYPTO_strings"}; |
| 184 | { return($1); } | 322 | $funcs{"ERR_load_CRYPTOlib_strings"} = 1; |
| 185 | elsif (/(SSL_CTX_get_verify_callback)/) | ||
| 186 | { return($1); } | ||
| 187 | elsif (/(SSL_get_info_callback)/) | ||
| 188 | { return($1); } | ||
| 189 | elsif ((!$NT) && /(ERR_load_CRYPTO_strings)/) | ||
| 190 | { return("ERR_load_CRYPTOlib_strings"); } | ||
| 191 | elsif (!$NT && /BIO_s_file/) | ||
| 192 | { return(undef); } | ||
| 193 | elsif (!$NT && /BIO_new_file/) | ||
| 194 | { return(undef); } | ||
| 195 | elsif (!$NT && /BIO_new_fp/) | ||
| 196 | { return(undef); } | ||
| 197 | elsif ($NT && /BIO_s_file_internal/) | ||
| 198 | { return(undef); } | ||
| 199 | elsif ($NT && /BIO_new_file_internal/) | ||
| 200 | { return(undef); } | ||
| 201 | elsif ($NT && /BIO_new_fp_internal/) | ||
| 202 | { return(undef); } | ||
| 203 | else | ||
| 204 | { | ||
| 205 | /\s\**(\S+)\s*\(/; | ||
| 206 | return($1); | ||
| 207 | } | 323 | } |
| 324 | delete $funcs{"BIO_s_file"}; | ||
| 325 | delete $funcs{"BIO_new_file"}; | ||
| 326 | delete $funcs{"BIO_new_fp"}; | ||
| 327 | } | ||
| 328 | if (!$NT) { | ||
| 329 | delete $funcs{"BIO_s_log"}; | ||
| 208 | } | 330 | } |
| 209 | 331 | ||
| 210 | sub do_extern | 332 | push @ret, keys %funcs; |
| 211 | { | ||
| 212 | local($file,$_)=@_; | ||
| 213 | local($n); | ||
| 214 | 333 | ||
| 215 | /\s\**(\S+);$/; | 334 | return(@ret); |
| 216 | return($1); | 335 | } |
| 217 | } | ||
| 218 | 336 | ||
| 219 | sub print_def_file | 337 | sub print_def_file |
| 220 | { | 338 | { |
| 221 | local(*OUT,$name,*nums,@functions)=@_; | 339 | (*OUT,my $name,*nums,@functions)=@_; |
| 222 | local($n)=1; | 340 | my $n =1; |
| 223 | 341 | ||
| 224 | if ($NT) | 342 | if ($W32) |
| 225 | { $name.="32"; } | 343 | { $name.="32"; } |
| 226 | else | 344 | else |
| 227 | { $name.="16"; } | 345 | { $name.="16"; } |
| 228 | 346 | ||
| 229 | print OUT <<"EOF"; | 347 | print OUT <<"EOF"; |
| 230 | ; | 348 | ; |
| 231 | ; Definition file for the DDL version of the $name library from SSLeay | 349 | ; Definition file for the DLL version of the $name library from OpenSSL |
| 232 | ; | 350 | ; |
| 233 | 351 | ||
| 234 | LIBRARY $name | 352 | LIBRARY $name |
| 235 | 353 | ||
| 236 | DESCRIPTION 'SSLeay $name - eay\@cryptsoft.com' | 354 | DESCRIPTION 'OpenSSL $name - http://www.openssl.org/' |
| 237 | 355 | ||
| 238 | EOF | 356 | EOF |
| 239 | 357 | ||
| 240 | if (!$NT) | 358 | if (!$W32) { |
| 241 | { | ||
| 242 | print <<"EOF"; | 359 | print <<"EOF"; |
| 243 | CODE PRELOAD MOVEABLE | 360 | CODE PRELOAD MOVEABLE |
| 244 | DATA PRELOAD MOVEABLE SINGLE | 361 | DATA PRELOAD MOVEABLE SINGLE |
| @@ -249,7 +366,7 @@ HEAPSIZE 4096 | |||
| 249 | STACKSIZE 8192 | 366 | STACKSIZE 8192 |
| 250 | 367 | ||
| 251 | EOF | 368 | EOF |
| 252 | } | 369 | } |
| 253 | 370 | ||
| 254 | print "EXPORTS\n"; | 371 | print "EXPORTS\n"; |
| 255 | 372 | ||
| @@ -258,35 +375,52 @@ EOF | |||
| 258 | (@r)=grep(!/^SSLeay/,@functions); | 375 | (@r)=grep(!/^SSLeay/,@functions); |
| 259 | @functions=((sort @e),(sort @r)); | 376 | @functions=((sort @e),(sort @r)); |
| 260 | 377 | ||
| 261 | foreach $func (@functions) | 378 | foreach $func (@functions) { |
| 262 | { | 379 | if (!defined($nums{$func})) { |
| 263 | if (!defined($nums{$func})) | 380 | printf STDERR "$func does not have a number assigned\n" |
| 264 | { | 381 | if(!$do_update); |
| 265 | printf STDERR "$func does not have a number assigned\n"; | 382 | } else { |
| 266 | } | ||
| 267 | else | ||
| 268 | { | ||
| 269 | $n=$nums{$func}; | 383 | $n=$nums{$func}; |
| 270 | printf OUT " %s%-35s@%d\n",($NT)?"":"_",$func,$n; | 384 | printf OUT " %s%-40s@%d\n",($W32)?"":"_",$func,$n; |
| 271 | } | ||
| 272 | } | 385 | } |
| 273 | printf OUT "\n"; | ||
| 274 | } | 386 | } |
| 387 | printf OUT "\n"; | ||
| 388 | } | ||
| 275 | 389 | ||
| 276 | sub load_numbers | 390 | sub load_numbers |
| 277 | { | 391 | { |
| 278 | local($name)=@_; | 392 | my($name)=@_; |
| 279 | local($j,@a,%ret); | 393 | my(@a,%ret); |
| 394 | |||
| 395 | $max_num = 0; | ||
| 280 | 396 | ||
| 281 | open(IN,"<$name") || die "unable to open $name:$!\n"; | 397 | open(IN,"<$name") || die "unable to open $name:$!\n"; |
| 282 | while (<IN>) | 398 | while (<IN>) { |
| 283 | { | ||
| 284 | chop; | 399 | chop; |
| 285 | s/#.*$//; | 400 | s/#.*$//; |
| 286 | next if /^\s*$/; | 401 | next if /^\s*$/; |
| 287 | @a=split; | 402 | @a=split; |
| 288 | $ret{$a[0]}=$a[1]; | 403 | $ret{$a[0]}=$a[1]; |
| 289 | } | 404 | $max_num = $a[1] if $a[1] > $max_num; |
| 405 | } | ||
| 290 | close(IN); | 406 | close(IN); |
| 291 | return(%ret); | 407 | return(%ret); |
| 408 | } | ||
| 409 | |||
| 410 | sub update_numbers | ||
| 411 | { | ||
| 412 | (*OUT,$name,*nums,my $start_num, my @functions)=@_; | ||
| 413 | my $new_funcs = 0; | ||
| 414 | print STDERR "Updating $name\n"; | ||
| 415 | foreach $func (@functions) { | ||
| 416 | if (!exists $nums{$func}) { | ||
| 417 | $new_funcs++; | ||
| 418 | printf OUT "%s%-40s%d\n","",$func, ++$start_num; | ||
| 419 | } | ||
| 420 | } | ||
| 421 | if($new_funcs) { | ||
| 422 | print STDERR "$new_funcs New Functions added\n"; | ||
| 423 | } else { | ||
| 424 | print STDERR "No New Functions Added\n"; | ||
| 292 | } | 425 | } |
| 426 | } | ||
