1ebfedea0SLionel Sambuc#!/usr/local/bin/perl -w 2ebfedea0SLionel Sambuc# 3ebfedea0SLionel Sambuc# generate a .def file 4ebfedea0SLionel Sambuc# 5ebfedea0SLionel Sambuc# It does this by parsing the header files and looking for the 6ebfedea0SLionel Sambuc# prototyped functions: it then prunes the output. 7ebfedea0SLionel Sambuc# 8ebfedea0SLionel Sambuc# Intermediary files are created, call libeay.num and ssleay.num,... 9ebfedea0SLionel Sambuc# Previously, they had the following format: 10ebfedea0SLionel Sambuc# 11ebfedea0SLionel Sambuc# routine-name nnnn 12ebfedea0SLionel Sambuc# 13ebfedea0SLionel Sambuc# But that isn't enough for a number of reasons, the first on being that 14ebfedea0SLionel Sambuc# this format is (needlessly) very Win32-centric, and even then... 15ebfedea0SLionel Sambuc# One of the biggest problems is that there's no information about what 16ebfedea0SLionel Sambuc# routines should actually be used, which varies with what crypto algorithms 17ebfedea0SLionel Sambuc# are disabled. Also, some operating systems (for example VMS with VAX C) 18ebfedea0SLionel Sambuc# need to keep track of the global variables as well as the functions. 19ebfedea0SLionel Sambuc# 20ebfedea0SLionel Sambuc# So, a remake of this script is done so as to include information on the 21ebfedea0SLionel Sambuc# kind of symbol it is (function or variable) and what algorithms they're 22ebfedea0SLionel Sambuc# part of. This will allow easy translating to .def files or the corresponding 23ebfedea0SLionel Sambuc# file in other operating systems (a .opt file for VMS, possibly with a .mar 24ebfedea0SLionel Sambuc# file). 25ebfedea0SLionel Sambuc# 26ebfedea0SLionel Sambuc# The format now becomes: 27ebfedea0SLionel Sambuc# 28ebfedea0SLionel Sambuc# routine-name nnnn info 29ebfedea0SLionel Sambuc# 30ebfedea0SLionel Sambuc# and the "info" part is actually a colon-separated string of fields with 31ebfedea0SLionel Sambuc# the following meaning: 32ebfedea0SLionel Sambuc# 33ebfedea0SLionel Sambuc# existence:platform:kind:algorithms 34ebfedea0SLionel Sambuc# 35ebfedea0SLionel Sambuc# - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is 36ebfedea0SLionel Sambuc# found somewhere in the source, 37ebfedea0SLionel Sambuc# - "platforms" is empty if it exists on all platforms, otherwise it contains 38ebfedea0SLionel Sambuc# comma-separated list of the platform, just as they are if the symbol exists 39ebfedea0SLionel Sambuc# for those platforms, or prepended with a "!" if not. This helps resolve 40ebfedea0SLionel Sambuc# symbol name variants for platforms where the names are too long for the 41ebfedea0SLionel Sambuc# compiler or linker, or if the systems is case insensitive and there is a 42ebfedea0SLionel Sambuc# clash, or the symbol is implemented differently (see 43ebfedea0SLionel Sambuc# EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found 44ebfedea0SLionel Sambuc# in the file crypto/symhacks.h. 45ebfedea0SLionel Sambuc# The semantics for the platforms is that every item is checked against the 46ebfedea0SLionel Sambuc# environment. For the negative items ("!FOO"), if any of them is false 47ebfedea0SLionel Sambuc# (i.e. "FOO" is true) in the environment, the corresponding symbol can't be 48ebfedea0SLionel Sambuc# used. For the positive itms, if all of them are false in the environment, 49ebfedea0SLionel Sambuc# the corresponding symbol can't be used. Any combination of positive and 50ebfedea0SLionel Sambuc# negative items are possible, and of course leave room for some redundancy. 51ebfedea0SLionel Sambuc# - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. 52ebfedea0SLionel Sambuc# - "algorithms" is a comma-separated list of algorithm names. This helps 53ebfedea0SLionel Sambuc# exclude symbols that are part of an algorithm that some user wants to 54ebfedea0SLionel Sambuc# exclude. 55ebfedea0SLionel Sambuc# 56ebfedea0SLionel Sambuc 57ebfedea0SLionel Sambucmy $debug=0; 58ebfedea0SLionel Sambuc 59ebfedea0SLionel Sambucmy $crypto_num= "util/libeay.num"; 60ebfedea0SLionel Sambucmy $ssl_num= "util/ssleay.num"; 61ebfedea0SLionel Sambucmy $libname; 62ebfedea0SLionel Sambuc 63ebfedea0SLionel Sambucmy $do_update = 0; 64ebfedea0SLionel Sambucmy $do_rewrite = 1; 65ebfedea0SLionel Sambucmy $do_crypto = 0; 66ebfedea0SLionel Sambucmy $do_ssl = 0; 67ebfedea0SLionel Sambucmy $do_ctest = 0; 68ebfedea0SLionel Sambucmy $do_ctestall = 0; 69ebfedea0SLionel Sambucmy $do_checkexist = 0; 70ebfedea0SLionel Sambuc 71ebfedea0SLionel Sambucmy $VMSVAX=0; 72ebfedea0SLionel Sambucmy $VMSNonVAX=0; 73ebfedea0SLionel Sambucmy $VMS=0; 74ebfedea0SLionel Sambucmy $W32=0; 75ebfedea0SLionel Sambucmy $W16=0; 76ebfedea0SLionel Sambucmy $NT=0; 77ebfedea0SLionel Sambucmy $OS2=0; 78ebfedea0SLionel Sambuc# Set this to make typesafe STACK definitions appear in DEF 79ebfedea0SLionel Sambucmy $safe_stack_def = 0; 80ebfedea0SLionel Sambuc 81ebfedea0SLionel Sambucmy @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", 82ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" ); 83ebfedea0SLionel Sambucmy @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); 84ebfedea0SLionel Sambucmy @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", 85ebfedea0SLionel Sambuc "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", 86ebfedea0SLionel Sambuc "SHA256", "SHA512", "RIPEMD", 87ebfedea0SLionel Sambuc "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M", 88ebfedea0SLionel Sambuc "HMAC", "AES", "CAMELLIA", "SEED", "GOST", 89ebfedea0SLionel Sambuc # EC_NISTP_64_GCC_128 90ebfedea0SLionel Sambuc "EC_NISTP_64_GCC_128", 91ebfedea0SLionel Sambuc # Envelope "algorithms" 92ebfedea0SLionel Sambuc "EVP", "X509", "ASN1_TYPEDEFS", 93ebfedea0SLionel Sambuc # Helper "algorithms" 94ebfedea0SLionel Sambuc "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", 95ebfedea0SLionel Sambuc "LOCKING", 96ebfedea0SLionel Sambuc # External "algorithms" 97ebfedea0SLionel Sambuc "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", 98ebfedea0SLionel Sambuc # Engines 99ebfedea0SLionel Sambuc "STATIC_ENGINE", "ENGINE", "HW", "GMP", 100ebfedea0SLionel Sambuc # RFC3779 101ebfedea0SLionel Sambuc "RFC3779", 102ebfedea0SLionel Sambuc # TLS 103ebfedea0SLionel Sambuc "TLSEXT", "PSK", "SRP", "HEARTBEATS", 104ebfedea0SLionel Sambuc # CMS 105ebfedea0SLionel Sambuc "CMS", 106ebfedea0SLionel Sambuc # CryptoAPI Engine 107ebfedea0SLionel Sambuc "CAPIENG", 108ebfedea0SLionel Sambuc # SSL v2 109ebfedea0SLionel Sambuc "SSL2", 110*0a6a1f1dSLionel Sambuc # SSL v3 method 111*0a6a1f1dSLionel Sambuc "SSL3_METHOD", 112ebfedea0SLionel Sambuc # JPAKE 113ebfedea0SLionel Sambuc "JPAKE", 114ebfedea0SLionel Sambuc # NEXTPROTONEG 115ebfedea0SLionel Sambuc "NEXTPROTONEG", 116ebfedea0SLionel Sambuc # Deprecated functions 117ebfedea0SLionel Sambuc "DEPRECATED", 118ebfedea0SLionel Sambuc # Hide SSL internals 119ebfedea0SLionel Sambuc "SSL_INTERN", 120ebfedea0SLionel Sambuc # SCTP 121*0a6a1f1dSLionel Sambuc "SCTP", 122*0a6a1f1dSLionel Sambuc # SRTP 123*0a6a1f1dSLionel Sambuc "SRTP", 124*0a6a1f1dSLionel Sambuc # Unit testing 125*0a6a1f1dSLionel Sambuc "UNIT_TEST"); 126ebfedea0SLionel Sambuc 127ebfedea0SLionel Sambucmy $options=""; 128ebfedea0SLionel Sambucopen(IN,"<Makefile") || die "unable to open Makefile!\n"; 129ebfedea0SLionel Sambucwhile(<IN>) { 130ebfedea0SLionel Sambuc $options=$1 if (/^OPTIONS=(.*)$/); 131ebfedea0SLionel Sambuc} 132ebfedea0SLionel Sambucclose(IN); 133ebfedea0SLionel Sambuc 134ebfedea0SLionel Sambuc# The following ciphers may be excluded (by Configure). This means functions 135ebfedea0SLionel Sambuc# defined with ifndef(NO_XXX) are not included in the .def file, and everything 136ebfedea0SLionel Sambuc# in directory xxx is ignored. 137ebfedea0SLionel Sambucmy $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; 138ebfedea0SLionel Sambucmy $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; 139ebfedea0SLionel Sambucmy $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; 140ebfedea0SLionel Sambucmy $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; 141ebfedea0SLionel Sambucmy $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; 142ebfedea0SLionel Sambucmy $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; 143ebfedea0SLionel Sambucmy $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; 144ebfedea0SLionel Sambucmy $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; 145*0a6a1f1dSLionel Sambucmy $no_nextprotoneg; my $no_sctp; my $no_srtp; 146*0a6a1f1dSLionel Sambucmy $no_unit_test; my $no_ssl3_method; 147ebfedea0SLionel Sambuc 148ebfedea0SLionel Sambucmy $fips; 149ebfedea0SLionel Sambuc 150ebfedea0SLionel Sambucmy $zlib; 151ebfedea0SLionel Sambuc 152ebfedea0SLionel Sambuc 153ebfedea0SLionel Sambucforeach (@ARGV, split(/ /, $options)) 154ebfedea0SLionel Sambuc { 155ebfedea0SLionel Sambuc $debug=1 if $_ eq "debug"; 156ebfedea0SLionel Sambuc $W32=1 if $_ eq "32"; 157ebfedea0SLionel Sambuc $W16=1 if $_ eq "16"; 158ebfedea0SLionel Sambuc if($_ eq "NT") { 159ebfedea0SLionel Sambuc $W32 = 1; 160ebfedea0SLionel Sambuc $NT = 1; 161ebfedea0SLionel Sambuc } 162ebfedea0SLionel Sambuc if ($_ eq "VMS-VAX") { 163ebfedea0SLionel Sambuc $VMS=1; 164ebfedea0SLionel Sambuc $VMSVAX=1; 165ebfedea0SLionel Sambuc } 166ebfedea0SLionel Sambuc if ($_ eq "VMS-NonVAX") { 167ebfedea0SLionel Sambuc $VMS=1; 168ebfedea0SLionel Sambuc $VMSNonVAX=1; 169ebfedea0SLionel Sambuc } 170ebfedea0SLionel Sambuc $VMS=1 if $_ eq "VMS"; 171ebfedea0SLionel Sambuc $OS2=1 if $_ eq "OS2"; 172ebfedea0SLionel Sambuc $fips=1 if /^fips/; 173ebfedea0SLionel Sambuc if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" 174ebfedea0SLionel Sambuc || $_ eq "enable-zlib-dynamic") { 175ebfedea0SLionel Sambuc $zlib = 1; 176ebfedea0SLionel Sambuc } 177ebfedea0SLionel Sambuc 178ebfedea0SLionel Sambuc $do_ssl=1 if $_ eq "ssleay"; 179ebfedea0SLionel Sambuc if ($_ eq "ssl") { 180ebfedea0SLionel Sambuc $do_ssl=1; 181ebfedea0SLionel Sambuc $libname=$_ 182ebfedea0SLionel Sambuc } 183ebfedea0SLionel Sambuc $do_crypto=1 if $_ eq "libeay"; 184ebfedea0SLionel Sambuc if ($_ eq "crypto") { 185ebfedea0SLionel Sambuc $do_crypto=1; 186ebfedea0SLionel Sambuc $libname=$_; 187ebfedea0SLionel Sambuc } 188ebfedea0SLionel Sambuc $no_static_engine=1 if $_ eq "no-static-engine"; 189ebfedea0SLionel Sambuc $no_static_engine=0 if $_ eq "enable-static-engine"; 190ebfedea0SLionel Sambuc $do_update=1 if $_ eq "update"; 191ebfedea0SLionel Sambuc $do_rewrite=1 if $_ eq "rewrite"; 192ebfedea0SLionel Sambuc $do_ctest=1 if $_ eq "ctest"; 193ebfedea0SLionel Sambuc $do_ctestall=1 if $_ eq "ctestall"; 194ebfedea0SLionel Sambuc $do_checkexist=1 if $_ eq "exist"; 195ebfedea0SLionel Sambuc #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; 196ebfedea0SLionel Sambuc 197ebfedea0SLionel Sambuc if (/^no-rc2$/) { $no_rc2=1; } 198ebfedea0SLionel Sambuc elsif (/^no-rc4$/) { $no_rc4=1; } 199ebfedea0SLionel Sambuc elsif (/^no-rc5$/) { $no_rc5=1; } 200ebfedea0SLionel Sambuc elsif (/^no-idea$/) { $no_idea=1; } 201ebfedea0SLionel Sambuc elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } 202ebfedea0SLionel Sambuc elsif (/^no-bf$/) { $no_bf=1; } 203ebfedea0SLionel Sambuc elsif (/^no-cast$/) { $no_cast=1; } 204ebfedea0SLionel Sambuc elsif (/^no-whirlpool$/) { $no_whirlpool=1; } 205ebfedea0SLionel Sambuc elsif (/^no-md2$/) { $no_md2=1; } 206ebfedea0SLionel Sambuc elsif (/^no-md4$/) { $no_md4=1; } 207ebfedea0SLionel Sambuc elsif (/^no-md5$/) { $no_md5=1; } 208ebfedea0SLionel Sambuc elsif (/^no-sha$/) { $no_sha=1; } 209ebfedea0SLionel Sambuc elsif (/^no-ripemd$/) { $no_ripemd=1; } 210ebfedea0SLionel Sambuc elsif (/^no-mdc2$/) { $no_mdc2=1; } 211ebfedea0SLionel Sambuc elsif (/^no-rsa$/) { $no_rsa=1; } 212ebfedea0SLionel Sambuc elsif (/^no-dsa$/) { $no_dsa=1; } 213ebfedea0SLionel Sambuc elsif (/^no-dh$/) { $no_dh=1; } 214ebfedea0SLionel Sambuc elsif (/^no-ec$/) { $no_ec=1; } 215ebfedea0SLionel Sambuc elsif (/^no-ecdsa$/) { $no_ecdsa=1; } 216ebfedea0SLionel Sambuc elsif (/^no-ecdh$/) { $no_ecdh=1; } 217ebfedea0SLionel Sambuc elsif (/^no-hmac$/) { $no_hmac=1; } 218ebfedea0SLionel Sambuc elsif (/^no-aes$/) { $no_aes=1; } 219ebfedea0SLionel Sambuc elsif (/^no-camellia$/) { $no_camellia=1; } 220ebfedea0SLionel Sambuc elsif (/^no-seed$/) { $no_seed=1; } 221ebfedea0SLionel Sambuc elsif (/^no-evp$/) { $no_evp=1; } 222ebfedea0SLionel Sambuc elsif (/^no-lhash$/) { $no_lhash=1; } 223ebfedea0SLionel Sambuc elsif (/^no-stack$/) { $no_stack=1; } 224ebfedea0SLionel Sambuc elsif (/^no-err$/) { $no_err=1; } 225ebfedea0SLionel Sambuc elsif (/^no-buffer$/) { $no_buffer=1; } 226ebfedea0SLionel Sambuc elsif (/^no-bio$/) { $no_bio=1; } 227ebfedea0SLionel Sambuc #elsif (/^no-locking$/) { $no_locking=1; } 228ebfedea0SLionel Sambuc elsif (/^no-comp$/) { $no_comp=1; } 229ebfedea0SLionel Sambuc elsif (/^no-dso$/) { $no_dso=1; } 230ebfedea0SLionel Sambuc elsif (/^no-krb5$/) { $no_krb5=1; } 231ebfedea0SLionel Sambuc elsif (/^no-engine$/) { $no_engine=1; } 232ebfedea0SLionel Sambuc elsif (/^no-hw$/) { $no_hw=1; } 233ebfedea0SLionel Sambuc elsif (/^no-gmp$/) { $no_gmp=1; } 234ebfedea0SLionel Sambuc elsif (/^no-rfc3779$/) { $no_rfc3779=1; } 235ebfedea0SLionel Sambuc elsif (/^no-tlsext$/) { $no_tlsext=1; } 236ebfedea0SLionel Sambuc elsif (/^no-cms$/) { $no_cms=1; } 237ebfedea0SLionel Sambuc elsif (/^no-ec2m$/) { $no_ec2m=1; } 238ebfedea0SLionel Sambuc elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; } 239ebfedea0SLionel Sambuc elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; } 240ebfedea0SLionel Sambuc elsif (/^no-ssl2$/) { $no_ssl2=1; } 241*0a6a1f1dSLionel Sambuc elsif (/^no-ssl3-method$/) { $no_ssl3_method=1; } 242ebfedea0SLionel Sambuc elsif (/^no-capieng$/) { $no_capieng=1; } 243ebfedea0SLionel Sambuc elsif (/^no-jpake$/) { $no_jpake=1; } 244ebfedea0SLionel Sambuc elsif (/^no-srp$/) { $no_srp=1; } 245ebfedea0SLionel Sambuc elsif (/^no-sctp$/) { $no_sctp=1; } 246*0a6a1f1dSLionel Sambuc elsif (/^no-srtp$/) { $no_srtp=1; } 247*0a6a1f1dSLionel Sambuc elsif (/^no-unit-test$/){ $no_unit_test=1; } 248ebfedea0SLionel Sambuc } 249ebfedea0SLionel Sambuc 250ebfedea0SLionel Sambuc 251ebfedea0SLionel Sambucif (!$libname) { 252ebfedea0SLionel Sambuc if ($do_ssl) { 253ebfedea0SLionel Sambuc $libname="SSLEAY"; 254ebfedea0SLionel Sambuc } 255ebfedea0SLionel Sambuc if ($do_crypto) { 256ebfedea0SLionel Sambuc $libname="LIBEAY"; 257ebfedea0SLionel Sambuc } 258ebfedea0SLionel Sambuc} 259ebfedea0SLionel Sambuc 260ebfedea0SLionel Sambuc# If no platform is given, assume WIN32 261ebfedea0SLionel Sambucif ($W32 + $W16 + $VMS + $OS2 == 0) { 262ebfedea0SLionel Sambuc $W32 = 1; 263ebfedea0SLionel Sambuc} 264ebfedea0SLionel Sambuc 265ebfedea0SLionel Sambuc# Add extra knowledge 266ebfedea0SLionel Sambucif ($W16) { 267ebfedea0SLionel Sambuc $no_fp_api=1; 268ebfedea0SLionel Sambuc} 269ebfedea0SLionel Sambuc 270ebfedea0SLionel Sambucif (!$do_ssl && !$do_crypto) 271ebfedea0SLionel Sambuc { 272ebfedea0SLionel Sambuc print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; 273ebfedea0SLionel Sambuc exit(1); 274ebfedea0SLionel Sambuc } 275ebfedea0SLionel Sambuc 276ebfedea0SLionel Sambuc%ssl_list=&load_numbers($ssl_num); 277ebfedea0SLionel Sambuc$max_ssl = $max_num; 278ebfedea0SLionel Sambuc%crypto_list=&load_numbers($crypto_num); 279ebfedea0SLionel Sambuc$max_crypto = $max_num; 280ebfedea0SLionel Sambuc 281ebfedea0SLionel Sambucmy $ssl="ssl/ssl.h"; 282ebfedea0SLionel Sambuc$ssl.=" ssl/kssl.h"; 283ebfedea0SLionel Sambuc$ssl.=" ssl/tls1.h"; 284ebfedea0SLionel Sambuc$ssl.=" ssl/srtp.h"; 285ebfedea0SLionel Sambuc 286ebfedea0SLionel Sambucmy $crypto ="crypto/crypto.h"; 287ebfedea0SLionel Sambuc$crypto.=" crypto/cryptlib.h"; 288ebfedea0SLionel Sambuc$crypto.=" crypto/o_dir.h"; 289ebfedea0SLionel Sambuc$crypto.=" crypto/o_str.h"; 290ebfedea0SLionel Sambuc$crypto.=" crypto/o_time.h"; 291ebfedea0SLionel Sambuc$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; 292ebfedea0SLionel Sambuc$crypto.=" crypto/idea/idea.h" ; # unless $no_idea; 293ebfedea0SLionel Sambuc$crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; 294ebfedea0SLionel Sambuc$crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; 295ebfedea0SLionel Sambuc$crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; 296ebfedea0SLionel Sambuc$crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; 297ebfedea0SLionel Sambuc$crypto.=" crypto/cast/cast.h" ; # unless $no_cast; 298ebfedea0SLionel Sambuc$crypto.=" crypto/whrlpool/whrlpool.h" ; 299ebfedea0SLionel Sambuc$crypto.=" crypto/md2/md2.h" ; # unless $no_md2; 300ebfedea0SLionel Sambuc$crypto.=" crypto/md4/md4.h" ; # unless $no_md4; 301ebfedea0SLionel Sambuc$crypto.=" crypto/md5/md5.h" ; # unless $no_md5; 302ebfedea0SLionel Sambuc$crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; 303ebfedea0SLionel Sambuc$crypto.=" crypto/sha/sha.h" ; # unless $no_sha; 304ebfedea0SLionel Sambuc$crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; 305ebfedea0SLionel Sambuc$crypto.=" crypto/aes/aes.h" ; # unless $no_aes; 306ebfedea0SLionel Sambuc$crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; 307ebfedea0SLionel Sambuc$crypto.=" crypto/seed/seed.h"; # unless $no_seed; 308ebfedea0SLionel Sambuc 309ebfedea0SLionel Sambuc$crypto.=" crypto/bn/bn.h"; 310ebfedea0SLionel Sambuc$crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; 311ebfedea0SLionel Sambuc$crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; 312ebfedea0SLionel Sambuc$crypto.=" crypto/dh/dh.h" ; # unless $no_dh; 313ebfedea0SLionel Sambuc$crypto.=" crypto/ec/ec.h" ; # unless $no_ec; 314ebfedea0SLionel Sambuc$crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; 315ebfedea0SLionel Sambuc$crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; 316ebfedea0SLionel Sambuc$crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; 317ebfedea0SLionel Sambuc$crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac; 318ebfedea0SLionel Sambuc 319ebfedea0SLionel Sambuc$crypto.=" crypto/engine/engine.h"; # unless $no_engine; 320ebfedea0SLionel Sambuc$crypto.=" crypto/stack/stack.h" ; # unless $no_stack; 321ebfedea0SLionel Sambuc$crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; 322ebfedea0SLionel Sambuc$crypto.=" crypto/bio/bio.h" ; # unless $no_bio; 323ebfedea0SLionel Sambuc$crypto.=" crypto/dso/dso.h" ; # unless $no_dso; 324ebfedea0SLionel Sambuc$crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; 325ebfedea0SLionel Sambuc$crypto.=" crypto/conf/conf.h"; 326ebfedea0SLionel Sambuc$crypto.=" crypto/txt_db/txt_db.h"; 327ebfedea0SLionel Sambuc 328ebfedea0SLionel Sambuc$crypto.=" crypto/evp/evp.h" ; # unless $no_evp; 329ebfedea0SLionel Sambuc$crypto.=" crypto/objects/objects.h"; 330ebfedea0SLionel Sambuc$crypto.=" crypto/pem/pem.h"; 331ebfedea0SLionel Sambuc#$crypto.=" crypto/meth/meth.h"; 332ebfedea0SLionel Sambuc$crypto.=" crypto/asn1/asn1.h"; 333ebfedea0SLionel Sambuc$crypto.=" crypto/asn1/asn1t.h"; 334ebfedea0SLionel Sambuc$crypto.=" crypto/asn1/asn1_mac.h"; 335ebfedea0SLionel Sambuc$crypto.=" crypto/err/err.h" ; # unless $no_err; 336ebfedea0SLionel Sambuc$crypto.=" crypto/pkcs7/pkcs7.h"; 337ebfedea0SLionel Sambuc$crypto.=" crypto/pkcs12/pkcs12.h"; 338ebfedea0SLionel Sambuc$crypto.=" crypto/x509/x509.h"; 339ebfedea0SLionel Sambuc$crypto.=" crypto/x509/x509_vfy.h"; 340ebfedea0SLionel Sambuc$crypto.=" crypto/x509v3/x509v3.h"; 341ebfedea0SLionel Sambuc$crypto.=" crypto/ts/ts.h"; 342ebfedea0SLionel Sambuc$crypto.=" crypto/rand/rand.h"; 343ebfedea0SLionel Sambuc$crypto.=" crypto/comp/comp.h" ; # unless $no_comp; 344ebfedea0SLionel Sambuc$crypto.=" crypto/ocsp/ocsp.h"; 345ebfedea0SLionel Sambuc$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; 346ebfedea0SLionel Sambuc$crypto.=" crypto/krb5/krb5_asn.h"; 347ebfedea0SLionel Sambuc#$crypto.=" crypto/store/store.h"; 348ebfedea0SLionel Sambuc$crypto.=" crypto/pqueue/pqueue.h"; 349ebfedea0SLionel Sambuc$crypto.=" crypto/cms/cms.h"; 350ebfedea0SLionel Sambuc$crypto.=" crypto/jpake/jpake.h"; 351ebfedea0SLionel Sambuc$crypto.=" crypto/modes/modes.h"; 352ebfedea0SLionel Sambuc$crypto.=" crypto/srp/srp.h"; 353ebfedea0SLionel Sambuc 354ebfedea0SLionel Sambucmy $symhacks="crypto/symhacks.h"; 355ebfedea0SLionel Sambuc 356ebfedea0SLionel Sambucmy @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); 357ebfedea0SLionel Sambucmy @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); 358ebfedea0SLionel Sambuc 359ebfedea0SLionel Sambucif ($do_update) { 360ebfedea0SLionel Sambuc 361ebfedea0SLionel Sambucif ($do_ssl == 1) { 362ebfedea0SLionel Sambuc 363ebfedea0SLionel Sambuc &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); 364ebfedea0SLionel Sambuc if ($do_rewrite == 1) { 365ebfedea0SLionel Sambuc open(OUT, ">$ssl_num"); 366ebfedea0SLionel Sambuc &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); 367ebfedea0SLionel Sambuc } else { 368ebfedea0SLionel Sambuc open(OUT, ">>$ssl_num"); 369ebfedea0SLionel Sambuc } 370ebfedea0SLionel Sambuc &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); 371ebfedea0SLionel Sambuc close OUT; 372ebfedea0SLionel Sambuc} 373ebfedea0SLionel Sambuc 374ebfedea0SLionel Sambucif($do_crypto == 1) { 375ebfedea0SLionel Sambuc 376ebfedea0SLionel Sambuc &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); 377ebfedea0SLionel Sambuc if ($do_rewrite == 1) { 378ebfedea0SLionel Sambuc open(OUT, ">$crypto_num"); 379ebfedea0SLionel Sambuc &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); 380ebfedea0SLionel Sambuc } else { 381ebfedea0SLionel Sambuc open(OUT, ">>$crypto_num"); 382ebfedea0SLionel Sambuc } 383ebfedea0SLionel Sambuc &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); 384ebfedea0SLionel Sambuc close OUT; 385ebfedea0SLionel Sambuc} 386ebfedea0SLionel Sambuc 387ebfedea0SLionel Sambuc} elsif ($do_checkexist) { 388ebfedea0SLionel Sambuc &check_existing(*ssl_list, @ssl_symbols) 389ebfedea0SLionel Sambuc if $do_ssl == 1; 390ebfedea0SLionel Sambuc &check_existing(*crypto_list, @crypto_symbols) 391ebfedea0SLionel Sambuc if $do_crypto == 1; 392ebfedea0SLionel Sambuc} elsif ($do_ctest || $do_ctestall) { 393ebfedea0SLionel Sambuc 394ebfedea0SLionel Sambuc print <<"EOF"; 395ebfedea0SLionel Sambuc 396ebfedea0SLionel Sambuc/* Test file to check all DEF file symbols are present by trying 397ebfedea0SLionel Sambuc * to link to all of them. This is *not* intended to be run! 398ebfedea0SLionel Sambuc */ 399ebfedea0SLionel Sambuc 400ebfedea0SLionel Sambucint main() 401ebfedea0SLionel Sambuc{ 402ebfedea0SLionel SambucEOF 403ebfedea0SLionel Sambuc &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) 404ebfedea0SLionel Sambuc if $do_ssl == 1; 405ebfedea0SLionel Sambuc 406ebfedea0SLionel Sambuc &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) 407ebfedea0SLionel Sambuc if $do_crypto == 1; 408ebfedea0SLionel Sambuc 409ebfedea0SLionel Sambuc print "}\n"; 410ebfedea0SLionel Sambuc 411ebfedea0SLionel Sambuc} else { 412ebfedea0SLionel Sambuc 413ebfedea0SLionel Sambuc &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) 414ebfedea0SLionel Sambuc if $do_ssl == 1; 415ebfedea0SLionel Sambuc 416ebfedea0SLionel Sambuc &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) 417ebfedea0SLionel Sambuc if $do_crypto == 1; 418ebfedea0SLionel Sambuc 419ebfedea0SLionel Sambuc} 420ebfedea0SLionel Sambuc 421ebfedea0SLionel Sambuc 422ebfedea0SLionel Sambucsub do_defs 423ebfedea0SLionel Sambuc{ 424ebfedea0SLionel Sambuc my($name,$files,$symhacksfile)=@_; 425ebfedea0SLionel Sambuc my $file; 426ebfedea0SLionel Sambuc my @ret; 427ebfedea0SLionel Sambuc my %syms; 428ebfedea0SLionel Sambuc my %platform; # For anything undefined, we assume "" 429ebfedea0SLionel Sambuc my %kind; # For anything undefined, we assume "FUNCTION" 430ebfedea0SLionel Sambuc my %algorithm; # For anything undefined, we assume "" 431ebfedea0SLionel Sambuc my %variant; 432ebfedea0SLionel Sambuc my %variant_cnt; # To be able to allocate "name{n}" if "name" 433ebfedea0SLionel Sambuc # is the same name as the original. 434ebfedea0SLionel Sambuc my $cpp; 435ebfedea0SLionel Sambuc my %unknown_algorithms = (); 436ebfedea0SLionel Sambuc 437ebfedea0SLionel Sambuc foreach $file (split(/\s+/,$symhacksfile." ".$files)) 438ebfedea0SLionel Sambuc { 439ebfedea0SLionel Sambuc print STDERR "DEBUG: starting on $file:\n" if $debug; 440ebfedea0SLionel Sambuc open(IN,"<$file") || die "unable to open $file:$!\n"; 441ebfedea0SLionel Sambuc my $line = "", my $def= ""; 442ebfedea0SLionel Sambuc my %tag = ( 443ebfedea0SLionel Sambuc (map { $_ => 0 } @known_platforms), 444ebfedea0SLionel Sambuc (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), 445ebfedea0SLionel Sambuc (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), 446ebfedea0SLionel Sambuc NOPROTO => 0, 447ebfedea0SLionel Sambuc PERL5 => 0, 448ebfedea0SLionel Sambuc _WINDLL => 0, 449ebfedea0SLionel Sambuc CONST_STRICT => 0, 450ebfedea0SLionel Sambuc TRUE => 1, 451ebfedea0SLionel Sambuc ); 452ebfedea0SLionel Sambuc my $symhacking = $file eq $symhacksfile; 453ebfedea0SLionel Sambuc my @current_platforms = (); 454ebfedea0SLionel Sambuc my @current_algorithms = (); 455ebfedea0SLionel Sambuc 456ebfedea0SLionel Sambuc # params: symbol, alias, platforms, kind 457ebfedea0SLionel Sambuc # The reason to put this subroutine in a variable is that 458ebfedea0SLionel Sambuc # it will otherwise create it's own, unshared, version of 459ebfedea0SLionel Sambuc # %tag and %variant... 460ebfedea0SLionel Sambuc my $make_variant = sub 461ebfedea0SLionel Sambuc { 462ebfedea0SLionel Sambuc my ($s, $a, $p, $k) = @_; 463ebfedea0SLionel Sambuc my ($a1, $a2); 464ebfedea0SLionel Sambuc 465ebfedea0SLionel Sambuc print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; 466ebfedea0SLionel Sambuc if (defined($p)) 467ebfedea0SLionel Sambuc { 468ebfedea0SLionel Sambuc $a1 = join(",",$p, 469ebfedea0SLionel Sambuc grep(!/^$/, 470ebfedea0SLionel Sambuc map { $tag{$_} == 1 ? $_ : "" } 471ebfedea0SLionel Sambuc @known_platforms)); 472ebfedea0SLionel Sambuc } 473ebfedea0SLionel Sambuc else 474ebfedea0SLionel Sambuc { 475ebfedea0SLionel Sambuc $a1 = join(",", 476ebfedea0SLionel Sambuc grep(!/^$/, 477ebfedea0SLionel Sambuc map { $tag{$_} == 1 ? $_ : "" } 478ebfedea0SLionel Sambuc @known_platforms)); 479ebfedea0SLionel Sambuc } 480ebfedea0SLionel Sambuc $a2 = join(",", 481ebfedea0SLionel Sambuc grep(!/^$/, 482ebfedea0SLionel Sambuc map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } 483ebfedea0SLionel Sambuc @known_ossl_platforms)); 484ebfedea0SLionel Sambuc print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; 485ebfedea0SLionel Sambuc if ($a1 eq "") { $a1 = $a2; } 486ebfedea0SLionel Sambuc elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } 487ebfedea0SLionel Sambuc if ($a eq $s) 488ebfedea0SLionel Sambuc { 489ebfedea0SLionel Sambuc if (!defined($variant_cnt{$s})) 490ebfedea0SLionel Sambuc { 491ebfedea0SLionel Sambuc $variant_cnt{$s} = 0; 492ebfedea0SLionel Sambuc } 493ebfedea0SLionel Sambuc $variant_cnt{$s}++; 494ebfedea0SLionel Sambuc $a .= "{$variant_cnt{$s}}"; 495ebfedea0SLionel Sambuc } 496ebfedea0SLionel Sambuc my $toadd = $a.":".$a1.(defined($k)?":".$k:""); 497ebfedea0SLionel Sambuc my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); 498ebfedea0SLionel Sambuc if (!grep(/^$togrep$/, 499ebfedea0SLionel Sambuc split(/;/, defined($variant{$s})?$variant{$s}:""))) { 500ebfedea0SLionel Sambuc if (defined($variant{$s})) { $variant{$s} .= ";"; } 501ebfedea0SLionel Sambuc $variant{$s} .= $toadd; 502ebfedea0SLionel Sambuc } 503ebfedea0SLionel Sambuc print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; 504ebfedea0SLionel Sambuc }; 505ebfedea0SLionel Sambuc 506ebfedea0SLionel Sambuc print STDERR "DEBUG: parsing ----------\n" if $debug; 507ebfedea0SLionel Sambuc while(<IN>) { 508ebfedea0SLionel Sambuc if (/\/\* Error codes for the \w+ functions\. \*\//) 509ebfedea0SLionel Sambuc { 510ebfedea0SLionel Sambuc undef @tag; 511ebfedea0SLionel Sambuc last; 512ebfedea0SLionel Sambuc } 513ebfedea0SLionel Sambuc if ($line ne '') { 514ebfedea0SLionel Sambuc $_ = $line . $_; 515ebfedea0SLionel Sambuc $line = ''; 516ebfedea0SLionel Sambuc } 517ebfedea0SLionel Sambuc 518ebfedea0SLionel Sambuc if (/\\$/) { 519ebfedea0SLionel Sambuc chomp; # remove eol 520ebfedea0SLionel Sambuc chop; # remove ending backslash 521ebfedea0SLionel Sambuc $line = $_; 522ebfedea0SLionel Sambuc next; 523ebfedea0SLionel Sambuc } 524ebfedea0SLionel Sambuc 525ebfedea0SLionel Sambuc if(/\/\*/) { 526ebfedea0SLionel Sambuc if (not /\*\//) { # multiline comment... 527ebfedea0SLionel Sambuc $line = $_; # ... just accumulate 528ebfedea0SLionel Sambuc next; 529ebfedea0SLionel Sambuc } else { 530ebfedea0SLionel Sambuc s/\/\*.*?\*\///gs;# wipe it 531ebfedea0SLionel Sambuc } 532ebfedea0SLionel Sambuc } 533ebfedea0SLionel Sambuc 534ebfedea0SLionel Sambuc if ($cpp) { 535ebfedea0SLionel Sambuc $cpp++ if /^#\s*if/; 536ebfedea0SLionel Sambuc $cpp-- if /^#\s*endif/; 537ebfedea0SLionel Sambuc next; 538ebfedea0SLionel Sambuc } 539ebfedea0SLionel Sambuc $cpp = 1 if /^#.*ifdef.*cplusplus/; 540ebfedea0SLionel Sambuc 541ebfedea0SLionel Sambuc s/{[^{}]*}//gs; # ignore {} blocks 542ebfedea0SLionel Sambuc print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; 543ebfedea0SLionel Sambuc print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; 544ebfedea0SLionel Sambuc if (/^\#\s*ifndef\s+(.*)/) { 545ebfedea0SLionel Sambuc push(@tag,"-"); 546ebfedea0SLionel Sambuc push(@tag,$1); 547ebfedea0SLionel Sambuc $tag{$1}=-1; 548ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; 549ebfedea0SLionel Sambuc } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { 550ebfedea0SLionel Sambuc push(@tag,"-"); 551ebfedea0SLionel Sambuc if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { 552ebfedea0SLionel Sambuc my $tmp_1 = $1; 553ebfedea0SLionel Sambuc my $tmp_; 554ebfedea0SLionel Sambuc foreach $tmp_ (split '\&\&',$tmp_1) { 555ebfedea0SLionel Sambuc $tmp_ =~ /!defined\(([^\)]+)\)/; 556ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; 557ebfedea0SLionel Sambuc push(@tag,$1); 558ebfedea0SLionel Sambuc $tag{$1}=-1; 559ebfedea0SLionel Sambuc } 560ebfedea0SLionel Sambuc } else { 561ebfedea0SLionel Sambuc print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... 562ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; 563ebfedea0SLionel Sambuc push(@tag,$1); 564ebfedea0SLionel Sambuc $tag{$1}=-1; 565ebfedea0SLionel Sambuc } 566ebfedea0SLionel Sambuc } elsif (/^\#\s*ifdef\s+(\S*)/) { 567ebfedea0SLionel Sambuc push(@tag,"-"); 568ebfedea0SLionel Sambuc push(@tag,$1); 569ebfedea0SLionel Sambuc $tag{$1}=1; 570ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; 571ebfedea0SLionel Sambuc } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { 572ebfedea0SLionel Sambuc push(@tag,"-"); 573ebfedea0SLionel Sambuc if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { 574ebfedea0SLionel Sambuc my $tmp_1 = $1; 575ebfedea0SLionel Sambuc my $tmp_; 576ebfedea0SLionel Sambuc foreach $tmp_ (split '\|\|',$tmp_1) { 577ebfedea0SLionel Sambuc $tmp_ =~ /defined\(([^\)]+)\)/; 578ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; 579ebfedea0SLionel Sambuc push(@tag,$1); 580ebfedea0SLionel Sambuc $tag{$1}=1; 581ebfedea0SLionel Sambuc } 582ebfedea0SLionel Sambuc } else { 583ebfedea0SLionel Sambuc print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... 584ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; 585ebfedea0SLionel Sambuc push(@tag,$1); 586ebfedea0SLionel Sambuc $tag{$1}=1; 587ebfedea0SLionel Sambuc } 588ebfedea0SLionel Sambuc } elsif (/^\#\s*error\s+(\w+) is disabled\./) { 589ebfedea0SLionel Sambuc my $tag_i = $#tag; 590ebfedea0SLionel Sambuc while($tag[$tag_i] ne "-") { 591ebfedea0SLionel Sambuc if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { 592ebfedea0SLionel Sambuc $tag{$tag[$tag_i]}=2; 593ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; 594ebfedea0SLionel Sambuc } 595ebfedea0SLionel Sambuc $tag_i--; 596ebfedea0SLionel Sambuc } 597ebfedea0SLionel Sambuc } elsif (/^\#\s*endif/) { 598ebfedea0SLionel Sambuc my $tag_i = $#tag; 599ebfedea0SLionel Sambuc while($tag_i > 0 && $tag[$tag_i] ne "-") { 600ebfedea0SLionel Sambuc my $t=$tag[$tag_i]; 601ebfedea0SLionel Sambuc print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; 602ebfedea0SLionel Sambuc if ($tag{$t}==2) { 603ebfedea0SLionel Sambuc $tag{$t}=-1; 604ebfedea0SLionel Sambuc } else { 605ebfedea0SLionel Sambuc $tag{$t}=0; 606ebfedea0SLionel Sambuc } 607ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; 608ebfedea0SLionel Sambuc pop(@tag); 609ebfedea0SLionel Sambuc if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { 610ebfedea0SLionel Sambuc $t=$1; 611ebfedea0SLionel Sambuc } else { 612ebfedea0SLionel Sambuc $t=""; 613ebfedea0SLionel Sambuc } 614ebfedea0SLionel Sambuc if ($t ne "" 615ebfedea0SLionel Sambuc && !grep(/^$t$/, @known_algorithms)) { 616ebfedea0SLionel Sambuc $unknown_algorithms{$t} = 1; 617ebfedea0SLionel Sambuc #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; 618ebfedea0SLionel Sambuc } 619ebfedea0SLionel Sambuc $tag_i--; 620ebfedea0SLionel Sambuc } 621ebfedea0SLionel Sambuc pop(@tag); 622ebfedea0SLionel Sambuc } elsif (/^\#\s*else/) { 623ebfedea0SLionel Sambuc my $tag_i = $#tag; 624ebfedea0SLionel Sambuc while($tag[$tag_i] ne "-") { 625ebfedea0SLionel Sambuc my $t=$tag[$tag_i]; 626ebfedea0SLionel Sambuc $tag{$t}= -$tag{$t}; 627ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; 628ebfedea0SLionel Sambuc $tag_i--; 629ebfedea0SLionel Sambuc } 630ebfedea0SLionel Sambuc } elsif (/^\#\s*if\s+1/) { 631ebfedea0SLionel Sambuc push(@tag,"-"); 632ebfedea0SLionel Sambuc # Dummy tag 633ebfedea0SLionel Sambuc push(@tag,"TRUE"); 634ebfedea0SLionel Sambuc $tag{"TRUE"}=1; 635ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found 1\n" if $debug; 636ebfedea0SLionel Sambuc } elsif (/^\#\s*if\s+0/) { 637ebfedea0SLionel Sambuc push(@tag,"-"); 638ebfedea0SLionel Sambuc # Dummy tag 639ebfedea0SLionel Sambuc push(@tag,"TRUE"); 640ebfedea0SLionel Sambuc $tag{"TRUE"}=-1; 641ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: found 0\n" if $debug; 642ebfedea0SLionel Sambuc } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ 643ebfedea0SLionel Sambuc && $symhacking && $tag{'TRUE'} != -1) { 644ebfedea0SLionel Sambuc # This is for aliasing. When we find an alias, 645ebfedea0SLionel Sambuc # we have to invert 646ebfedea0SLionel Sambuc &$make_variant($1,$2); 647ebfedea0SLionel Sambuc print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; 648ebfedea0SLionel Sambuc } 649ebfedea0SLionel Sambuc if (/^\#/) { 650ebfedea0SLionel Sambuc @current_platforms = 651ebfedea0SLionel Sambuc grep(!/^$/, 652ebfedea0SLionel Sambuc map { $tag{$_} == 1 ? $_ : 653ebfedea0SLionel Sambuc $tag{$_} == -1 ? "!".$_ : "" } 654ebfedea0SLionel Sambuc @known_platforms); 655ebfedea0SLionel Sambuc push @current_platforms 656ebfedea0SLionel Sambuc , grep(!/^$/, 657ebfedea0SLionel Sambuc map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : 658ebfedea0SLionel Sambuc $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } 659ebfedea0SLionel Sambuc @known_ossl_platforms); 660ebfedea0SLionel Sambuc @current_algorithms = 661ebfedea0SLionel Sambuc grep(!/^$/, 662ebfedea0SLionel Sambuc map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } 663ebfedea0SLionel Sambuc @known_algorithms); 664ebfedea0SLionel Sambuc $def .= 665ebfedea0SLionel Sambuc "#INFO:" 666ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 667ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 668ebfedea0SLionel Sambuc next; 669ebfedea0SLionel Sambuc } 670ebfedea0SLionel Sambuc if ($tag{'TRUE'} != -1) { 671ebfedea0SLionel Sambuc if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { 672ebfedea0SLionel Sambuc next; 673ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { 674ebfedea0SLionel Sambuc $def .= "int d2i_$3(void);"; 675ebfedea0SLionel Sambuc $def .= "int i2d_$3(void);"; 676ebfedea0SLionel Sambuc # Variant for platforms that do not 677ebfedea0SLionel Sambuc # have to access globale variables 678ebfedea0SLionel Sambuc # in shared libraries through functions 679ebfedea0SLionel Sambuc $def .= 680ebfedea0SLionel Sambuc "#INFO:" 681ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 682ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 683ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $2_it;"; 684ebfedea0SLionel Sambuc $def .= 685ebfedea0SLionel Sambuc "#INFO:" 686ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 687ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 688ebfedea0SLionel Sambuc # Variant for platforms that have to 689ebfedea0SLionel Sambuc # access globale variables in shared 690ebfedea0SLionel Sambuc # libraries through functions 691ebfedea0SLionel Sambuc &$make_variant("$2_it","$2_it", 692ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 693ebfedea0SLionel Sambuc "FUNCTION"); 694ebfedea0SLionel Sambuc next; 695ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { 696ebfedea0SLionel Sambuc $def .= "int d2i_$3(void);"; 697ebfedea0SLionel Sambuc $def .= "int i2d_$3(void);"; 698ebfedea0SLionel Sambuc $def .= "int $3_free(void);"; 699ebfedea0SLionel Sambuc $def .= "int $3_new(void);"; 700ebfedea0SLionel Sambuc # Variant for platforms that do not 701ebfedea0SLionel Sambuc # have to access globale variables 702ebfedea0SLionel Sambuc # in shared libraries through functions 703ebfedea0SLionel Sambuc $def .= 704ebfedea0SLionel Sambuc "#INFO:" 705ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 706ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 707ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $2_it;"; 708ebfedea0SLionel Sambuc $def .= 709ebfedea0SLionel Sambuc "#INFO:" 710ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 711ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 712ebfedea0SLionel Sambuc # Variant for platforms that have to 713ebfedea0SLionel Sambuc # access globale variables in shared 714ebfedea0SLionel Sambuc # libraries through functions 715ebfedea0SLionel Sambuc &$make_variant("$2_it","$2_it", 716ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 717ebfedea0SLionel Sambuc "FUNCTION"); 718ebfedea0SLionel Sambuc next; 719ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || 720ebfedea0SLionel Sambuc /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { 721ebfedea0SLionel Sambuc $def .= "int d2i_$1(void);"; 722ebfedea0SLionel Sambuc $def .= "int i2d_$1(void);"; 723ebfedea0SLionel Sambuc $def .= "int $1_free(void);"; 724ebfedea0SLionel Sambuc $def .= "int $1_new(void);"; 725ebfedea0SLionel Sambuc # Variant for platforms that do not 726ebfedea0SLionel Sambuc # have to access globale variables 727ebfedea0SLionel Sambuc # in shared libraries through functions 728ebfedea0SLionel Sambuc $def .= 729ebfedea0SLionel Sambuc "#INFO:" 730ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 731ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 732ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $1_it;"; 733ebfedea0SLionel Sambuc $def .= 734ebfedea0SLionel Sambuc "#INFO:" 735ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 736ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 737ebfedea0SLionel Sambuc # Variant for platforms that have to 738ebfedea0SLionel Sambuc # access globale variables in shared 739ebfedea0SLionel Sambuc # libraries through functions 740ebfedea0SLionel Sambuc &$make_variant("$1_it","$1_it", 741ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 742ebfedea0SLionel Sambuc "FUNCTION"); 743ebfedea0SLionel Sambuc next; 744ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { 745ebfedea0SLionel Sambuc $def .= "int d2i_$2(void);"; 746ebfedea0SLionel Sambuc $def .= "int i2d_$2(void);"; 747ebfedea0SLionel Sambuc # Variant for platforms that do not 748ebfedea0SLionel Sambuc # have to access globale variables 749ebfedea0SLionel Sambuc # in shared libraries through functions 750ebfedea0SLionel Sambuc $def .= 751ebfedea0SLionel Sambuc "#INFO:" 752ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 753ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 754ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $2_it;"; 755ebfedea0SLionel Sambuc $def .= 756ebfedea0SLionel Sambuc "#INFO:" 757ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 758ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 759ebfedea0SLionel Sambuc # Variant for platforms that have to 760ebfedea0SLionel Sambuc # access globale variables in shared 761ebfedea0SLionel Sambuc # libraries through functions 762ebfedea0SLionel Sambuc &$make_variant("$2_it","$2_it", 763ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 764ebfedea0SLionel Sambuc "FUNCTION"); 765ebfedea0SLionel Sambuc next; 766ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { 767ebfedea0SLionel Sambuc $def .= "int $1_free(void);"; 768ebfedea0SLionel Sambuc $def .= "int $1_new(void);"; 769ebfedea0SLionel Sambuc next; 770ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { 771ebfedea0SLionel Sambuc $def .= "int d2i_$2(void);"; 772ebfedea0SLionel Sambuc $def .= "int i2d_$2(void);"; 773ebfedea0SLionel Sambuc $def .= "int $2_free(void);"; 774ebfedea0SLionel Sambuc $def .= "int $2_new(void);"; 775ebfedea0SLionel Sambuc # Variant for platforms that do not 776ebfedea0SLionel Sambuc # have to access globale variables 777ebfedea0SLionel Sambuc # in shared libraries through functions 778ebfedea0SLionel Sambuc $def .= 779ebfedea0SLionel Sambuc "#INFO:" 780ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 781ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 782ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $2_it;"; 783ebfedea0SLionel Sambuc $def .= 784ebfedea0SLionel Sambuc "#INFO:" 785ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 786ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 787ebfedea0SLionel Sambuc # Variant for platforms that have to 788ebfedea0SLionel Sambuc # access globale variables in shared 789ebfedea0SLionel Sambuc # libraries through functions 790ebfedea0SLionel Sambuc &$make_variant("$2_it","$2_it", 791ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 792ebfedea0SLionel Sambuc "FUNCTION"); 793ebfedea0SLionel Sambuc next; 794ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { 795ebfedea0SLionel Sambuc # Variant for platforms that do not 796ebfedea0SLionel Sambuc # have to access globale variables 797ebfedea0SLionel Sambuc # in shared libraries through functions 798ebfedea0SLionel Sambuc $def .= 799ebfedea0SLionel Sambuc "#INFO:" 800ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 801ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 802ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int $1_it;"; 803ebfedea0SLionel Sambuc $def .= 804ebfedea0SLionel Sambuc "#INFO:" 805ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 806ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 807ebfedea0SLionel Sambuc # Variant for platforms that have to 808ebfedea0SLionel Sambuc # access globale variables in shared 809ebfedea0SLionel Sambuc # libraries through functions 810ebfedea0SLionel Sambuc &$make_variant("$1_it","$1_it", 811ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 812ebfedea0SLionel Sambuc "FUNCTION"); 813ebfedea0SLionel Sambuc next; 814ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { 815ebfedea0SLionel Sambuc $def .= "int i2d_$1_NDEF(void);"; 816ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { 817ebfedea0SLionel Sambuc next; 818ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { 819ebfedea0SLionel Sambuc $def .= "int $1_print_ctx(void);"; 820ebfedea0SLionel Sambuc next; 821ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { 822ebfedea0SLionel Sambuc $def .= "int $2_print_ctx(void);"; 823ebfedea0SLionel Sambuc next; 824ebfedea0SLionel Sambuc } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { 825ebfedea0SLionel Sambuc next; 826ebfedea0SLionel Sambuc } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || 827ebfedea0SLionel Sambuc /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || 828ebfedea0SLionel Sambuc /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { 829ebfedea0SLionel Sambuc # Things not in Win16 830ebfedea0SLionel Sambuc $def .= 831ebfedea0SLionel Sambuc "#INFO:" 832ebfedea0SLionel Sambuc .join(',',"!WIN16",@current_platforms).":" 833ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 834ebfedea0SLionel Sambuc $def .= "int PEM_read_$1(void);"; 835ebfedea0SLionel Sambuc $def .= "int PEM_write_$1(void);"; 836ebfedea0SLionel Sambuc $def .= 837ebfedea0SLionel Sambuc "#INFO:" 838ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 839ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 840ebfedea0SLionel Sambuc # Things that are everywhere 841ebfedea0SLionel Sambuc $def .= "int PEM_read_bio_$1(void);"; 842ebfedea0SLionel Sambuc $def .= "int PEM_write_bio_$1(void);"; 843ebfedea0SLionel Sambuc next; 844ebfedea0SLionel Sambuc } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || 845ebfedea0SLionel Sambuc /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { 846ebfedea0SLionel Sambuc # Things not in Win16 847ebfedea0SLionel Sambuc $def .= 848ebfedea0SLionel Sambuc "#INFO:" 849ebfedea0SLionel Sambuc .join(',',"!WIN16",@current_platforms).":" 850ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 851ebfedea0SLionel Sambuc $def .= "int PEM_write_$1(void);"; 852ebfedea0SLionel Sambuc $def .= 853ebfedea0SLionel Sambuc "#INFO:" 854ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 855ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 856ebfedea0SLionel Sambuc # Things that are everywhere 857ebfedea0SLionel Sambuc $def .= "int PEM_write_bio_$1(void);"; 858ebfedea0SLionel Sambuc next; 859ebfedea0SLionel Sambuc } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || 860ebfedea0SLionel Sambuc /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { 861ebfedea0SLionel Sambuc # Things not in Win16 862ebfedea0SLionel Sambuc $def .= 863ebfedea0SLionel Sambuc "#INFO:" 864ebfedea0SLionel Sambuc .join(',',"!WIN16",@current_platforms).":" 865ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 866ebfedea0SLionel Sambuc $def .= "int PEM_read_$1(void);"; 867ebfedea0SLionel Sambuc $def .= 868ebfedea0SLionel Sambuc "#INFO:" 869ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 870ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 871ebfedea0SLionel Sambuc # Things that are everywhere 872ebfedea0SLionel Sambuc $def .= "int PEM_read_bio_$1(void);"; 873ebfedea0SLionel Sambuc next; 874ebfedea0SLionel Sambuc } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { 875ebfedea0SLionel Sambuc # Variant for platforms that do not 876ebfedea0SLionel Sambuc # have to access globale variables 877ebfedea0SLionel Sambuc # in shared libraries through functions 878ebfedea0SLionel Sambuc $def .= 879ebfedea0SLionel Sambuc "#INFO:" 880ebfedea0SLionel Sambuc .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" 881ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 882ebfedea0SLionel Sambuc $def .= "OPENSSL_EXTERN int _shadow_$2;"; 883ebfedea0SLionel Sambuc $def .= 884ebfedea0SLionel Sambuc "#INFO:" 885ebfedea0SLionel Sambuc .join(',',@current_platforms).":" 886ebfedea0SLionel Sambuc .join(',',@current_algorithms).";"; 887ebfedea0SLionel Sambuc # Variant for platforms that have to 888ebfedea0SLionel Sambuc # access globale variables in shared 889ebfedea0SLionel Sambuc # libraries through functions 890ebfedea0SLionel Sambuc &$make_variant("_shadow_$2","_shadow_$2", 891ebfedea0SLionel Sambuc "EXPORT_VAR_AS_FUNCTION", 892ebfedea0SLionel Sambuc "FUNCTION"); 893ebfedea0SLionel Sambuc } elsif ($tag{'CONST_STRICT'} != 1) { 894ebfedea0SLionel Sambuc if (/\{|\/\*|\([^\)]*$/) { 895ebfedea0SLionel Sambuc $line = $_; 896ebfedea0SLionel Sambuc } else { 897ebfedea0SLionel Sambuc $def .= $_; 898ebfedea0SLionel Sambuc } 899ebfedea0SLionel Sambuc } 900ebfedea0SLionel Sambuc } 901ebfedea0SLionel Sambuc } 902ebfedea0SLionel Sambuc close(IN); 903ebfedea0SLionel Sambuc 904ebfedea0SLionel Sambuc my $algs; 905ebfedea0SLionel Sambuc my $plays; 906ebfedea0SLionel Sambuc 907ebfedea0SLionel Sambuc print STDERR "DEBUG: postprocessing ----------\n" if $debug; 908ebfedea0SLionel Sambuc foreach (split /;/, $def) { 909ebfedea0SLionel Sambuc my $s; my $k = "FUNCTION"; my $p; my $a; 910ebfedea0SLionel Sambuc s/^[\n\s]*//g; 911ebfedea0SLionel Sambuc s/[\n\s]*$//g; 912ebfedea0SLionel Sambuc next if(/\#undef/); 913ebfedea0SLionel Sambuc next if(/typedef\W/); 914ebfedea0SLionel Sambuc next if(/\#define/); 915ebfedea0SLionel Sambuc 916ebfedea0SLionel Sambuc # Reduce argument lists to empty () 917ebfedea0SLionel Sambuc # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} 918ebfedea0SLionel Sambuc while(/\(.*\)/s) { 919ebfedea0SLionel Sambuc s/\([^\(\)]+\)/\{\}/gs; 920ebfedea0SLionel Sambuc s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f 921ebfedea0SLionel Sambuc } 922ebfedea0SLionel Sambuc # pretend as we didn't use curly braces: {} -> () 923ebfedea0SLionel Sambuc s/\{\}/\(\)/gs; 924ebfedea0SLionel Sambuc 925ebfedea0SLionel Sambuc s/STACK_OF\(\)/void/gs; 926ebfedea0SLionel Sambuc s/LHASH_OF\(\)/void/gs; 927ebfedea0SLionel Sambuc 928ebfedea0SLionel Sambuc print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; 929ebfedea0SLionel Sambuc if (/^\#INFO:([^:]*):(.*)$/) { 930ebfedea0SLionel Sambuc $plats = $1; 931ebfedea0SLionel Sambuc $algs = $2; 932ebfedea0SLionel Sambuc print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; 933ebfedea0SLionel Sambuc next; 934ebfedea0SLionel Sambuc } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { 935ebfedea0SLionel Sambuc $s = $1; 936ebfedea0SLionel Sambuc $k = "VARIABLE"; 937ebfedea0SLionel Sambuc print STDERR "DEBUG: found external variable $s\n" if $debug; 938ebfedea0SLionel Sambuc } elsif (/TYPEDEF_\w+_OF/s) { 939ebfedea0SLionel Sambuc next; 940ebfedea0SLionel Sambuc } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is 941ebfedea0SLionel Sambuc $s = $1; # a function name! 942ebfedea0SLionel Sambuc print STDERR "DEBUG: found function $s\n" if $debug; 943ebfedea0SLionel Sambuc } elsif (/\(/ and not (/=/)) { 944ebfedea0SLionel Sambuc print STDERR "File $file: cannot parse: $_;\n"; 945ebfedea0SLionel Sambuc next; 946ebfedea0SLionel Sambuc } else { 947ebfedea0SLionel Sambuc next; 948ebfedea0SLionel Sambuc } 949ebfedea0SLionel Sambuc 950ebfedea0SLionel Sambuc $syms{$s} = 1; 951ebfedea0SLionel Sambuc $kind{$s} = $k; 952ebfedea0SLionel Sambuc 953ebfedea0SLionel Sambuc $p = $plats; 954ebfedea0SLionel Sambuc $a = $algs; 955ebfedea0SLionel Sambuc $a .= ",BF" if($s =~ /EVP_bf/); 956ebfedea0SLionel Sambuc $a .= ",CAST" if($s =~ /EVP_cast/); 957ebfedea0SLionel Sambuc $a .= ",DES" if($s =~ /EVP_des/); 958ebfedea0SLionel Sambuc $a .= ",DSA" if($s =~ /EVP_dss/); 959ebfedea0SLionel Sambuc $a .= ",IDEA" if($s =~ /EVP_idea/); 960ebfedea0SLionel Sambuc $a .= ",MD2" if($s =~ /EVP_md2/); 961ebfedea0SLionel Sambuc $a .= ",MD4" if($s =~ /EVP_md4/); 962ebfedea0SLionel Sambuc $a .= ",MD5" if($s =~ /EVP_md5/); 963ebfedea0SLionel Sambuc $a .= ",RC2" if($s =~ /EVP_rc2/); 964ebfedea0SLionel Sambuc $a .= ",RC4" if($s =~ /EVP_rc4/); 965ebfedea0SLionel Sambuc $a .= ",RC5" if($s =~ /EVP_rc5/); 966ebfedea0SLionel Sambuc $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); 967ebfedea0SLionel Sambuc $a .= ",SHA" if($s =~ /EVP_sha/); 968ebfedea0SLionel Sambuc $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); 969ebfedea0SLionel Sambuc $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); 970ebfedea0SLionel Sambuc $a .= ",RSA" if($s =~ /RSAPrivateKey/); 971ebfedea0SLionel Sambuc $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); 972ebfedea0SLionel Sambuc 973ebfedea0SLionel Sambuc $platform{$s} = 974ebfedea0SLionel Sambuc &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); 975ebfedea0SLionel Sambuc $algorithm{$s} .= ','.$a; 976ebfedea0SLionel Sambuc 977ebfedea0SLionel Sambuc if (defined($variant{$s})) { 978ebfedea0SLionel Sambuc foreach $v (split /;/,$variant{$s}) { 979ebfedea0SLionel Sambuc (my $r, my $p, my $k) = split(/:/,$v); 980ebfedea0SLionel Sambuc my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); 981ebfedea0SLionel Sambuc $syms{$r} = 1; 982ebfedea0SLionel Sambuc if (!defined($k)) { $k = $kind{$s}; } 983ebfedea0SLionel Sambuc $kind{$r} = $k."(".$s.")"; 984ebfedea0SLionel Sambuc $algorithm{$r} = $algorithm{$s}; 985ebfedea0SLionel Sambuc $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); 986ebfedea0SLionel Sambuc $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); 987ebfedea0SLionel Sambuc print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; 988ebfedea0SLionel Sambuc } 989ebfedea0SLionel Sambuc } 990ebfedea0SLionel Sambuc print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; 991ebfedea0SLionel Sambuc } 992ebfedea0SLionel Sambuc } 993ebfedea0SLionel Sambuc 994ebfedea0SLionel Sambuc # Prune the returned symbols 995ebfedea0SLionel Sambuc 996ebfedea0SLionel Sambuc delete $syms{"bn_dump1"}; 997ebfedea0SLionel Sambuc $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; 998ebfedea0SLionel Sambuc 999ebfedea0SLionel Sambuc $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; 1000ebfedea0SLionel Sambuc $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; 1001ebfedea0SLionel Sambuc $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; 1002ebfedea0SLionel Sambuc $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; 1003ebfedea0SLionel Sambuc $platform{"EVP_sha384"} = "!VMSVAX"; 1004ebfedea0SLionel Sambuc $platform{"EVP_sha512"} = "!VMSVAX"; 1005ebfedea0SLionel Sambuc $platform{"SHA384_Init"} = "!VMSVAX"; 1006ebfedea0SLionel Sambuc $platform{"SHA384_Transform"} = "!VMSVAX"; 1007ebfedea0SLionel Sambuc $platform{"SHA384_Update"} = "!VMSVAX"; 1008ebfedea0SLionel Sambuc $platform{"SHA384_Final"} = "!VMSVAX"; 1009ebfedea0SLionel Sambuc $platform{"SHA384"} = "!VMSVAX"; 1010ebfedea0SLionel Sambuc $platform{"SHA512_Init"} = "!VMSVAX"; 1011ebfedea0SLionel Sambuc $platform{"SHA512_Transform"} = "!VMSVAX"; 1012ebfedea0SLionel Sambuc $platform{"SHA512_Update"} = "!VMSVAX"; 1013ebfedea0SLionel Sambuc $platform{"SHA512_Final"} = "!VMSVAX"; 1014ebfedea0SLionel Sambuc $platform{"SHA512"} = "!VMSVAX"; 1015ebfedea0SLionel Sambuc $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; 1016ebfedea0SLionel Sambuc $platform{"WHIRLPOOL"} = "!VMSVAX"; 1017ebfedea0SLionel Sambuc $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; 1018ebfedea0SLionel Sambuc $platform{"EVP_whirlpool"} = "!VMSVAX"; 1019ebfedea0SLionel Sambuc $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; 1020ebfedea0SLionel Sambuc $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; 1021ebfedea0SLionel Sambuc 1022ebfedea0SLionel Sambuc 1023ebfedea0SLionel Sambuc # Info we know about 1024ebfedea0SLionel Sambuc 1025ebfedea0SLionel Sambuc push @ret, map { $_."\\".&info_string($_,"EXIST", 1026ebfedea0SLionel Sambuc $platform{$_}, 1027ebfedea0SLionel Sambuc $kind{$_}, 1028ebfedea0SLionel Sambuc $algorithm{$_}) } keys %syms; 1029ebfedea0SLionel Sambuc 1030ebfedea0SLionel Sambuc if (keys %unknown_algorithms) { 1031ebfedea0SLionel Sambuc print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; 1032ebfedea0SLionel Sambuc print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; 1033ebfedea0SLionel Sambuc } 1034ebfedea0SLionel Sambuc return(@ret); 1035ebfedea0SLionel Sambuc} 1036ebfedea0SLionel Sambuc 1037ebfedea0SLionel Sambuc# Param: string of comma-separated platform-specs. 1038ebfedea0SLionel Sambucsub reduce_platforms 1039ebfedea0SLionel Sambuc{ 1040ebfedea0SLionel Sambuc my ($platforms) = @_; 1041ebfedea0SLionel Sambuc my $pl = defined($platforms) ? $platforms : ""; 1042ebfedea0SLionel Sambuc my %p = map { $_ => 0 } split /,/, $pl; 1043ebfedea0SLionel Sambuc my $ret; 1044ebfedea0SLionel Sambuc 1045ebfedea0SLionel Sambuc print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" 1046ebfedea0SLionel Sambuc if $debug; 1047ebfedea0SLionel Sambuc # We do this, because if there's code like the following, it really 1048ebfedea0SLionel Sambuc # means the function exists in all cases and should therefore be 1049ebfedea0SLionel Sambuc # everywhere. By increasing and decreasing, we may attain 0: 1050ebfedea0SLionel Sambuc # 1051ebfedea0SLionel Sambuc # ifndef WIN16 1052ebfedea0SLionel Sambuc # int foo(); 1053ebfedea0SLionel Sambuc # else 1054ebfedea0SLionel Sambuc # int _fat foo(); 1055ebfedea0SLionel Sambuc # endif 1056ebfedea0SLionel Sambuc foreach $platform (split /,/, $pl) { 1057ebfedea0SLionel Sambuc if ($platform =~ /^!(.*)$/) { 1058ebfedea0SLionel Sambuc $p{$1}--; 1059ebfedea0SLionel Sambuc } else { 1060ebfedea0SLionel Sambuc $p{$platform}++; 1061ebfedea0SLionel Sambuc } 1062ebfedea0SLionel Sambuc } 1063ebfedea0SLionel Sambuc foreach $platform (keys %p) { 1064ebfedea0SLionel Sambuc if ($p{$platform} == 0) { delete $p{$platform}; } 1065ebfedea0SLionel Sambuc } 1066ebfedea0SLionel Sambuc 1067ebfedea0SLionel Sambuc delete $p{""}; 1068ebfedea0SLionel Sambuc 1069ebfedea0SLionel Sambuc $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); 1070ebfedea0SLionel Sambuc print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" 1071ebfedea0SLionel Sambuc if $debug; 1072ebfedea0SLionel Sambuc return $ret; 1073ebfedea0SLionel Sambuc} 1074ebfedea0SLionel Sambuc 1075ebfedea0SLionel Sambucsub info_string { 1076ebfedea0SLionel Sambuc (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; 1077ebfedea0SLionel Sambuc 1078ebfedea0SLionel Sambuc my %a = defined($algorithms) ? 1079ebfedea0SLionel Sambuc map { $_ => 1 } split /,/, $algorithms : (); 1080ebfedea0SLionel Sambuc my $k = defined($kind) ? $kind : "FUNCTION"; 1081ebfedea0SLionel Sambuc my $ret; 1082ebfedea0SLionel Sambuc my $p = &reduce_platforms($platforms); 1083ebfedea0SLionel Sambuc 1084ebfedea0SLionel Sambuc delete $a{""}; 1085ebfedea0SLionel Sambuc 1086ebfedea0SLionel Sambuc $ret = $exist; 1087ebfedea0SLionel Sambuc $ret .= ":".$p; 1088ebfedea0SLionel Sambuc $ret .= ":".$k; 1089ebfedea0SLionel Sambuc $ret .= ":".join(',',sort keys %a); 1090ebfedea0SLionel Sambuc return $ret; 1091ebfedea0SLionel Sambuc} 1092ebfedea0SLionel Sambuc 1093ebfedea0SLionel Sambucsub maybe_add_info { 1094ebfedea0SLionel Sambuc (my $name, *nums, my @symbols) = @_; 1095ebfedea0SLionel Sambuc my $sym; 1096ebfedea0SLionel Sambuc my $new_info = 0; 1097ebfedea0SLionel Sambuc my %syms=(); 1098ebfedea0SLionel Sambuc 1099ebfedea0SLionel Sambuc print STDERR "Updating $name info\n"; 1100ebfedea0SLionel Sambuc foreach $sym (@symbols) { 1101ebfedea0SLionel Sambuc (my $s, my $i) = split /\\/, $sym; 1102ebfedea0SLionel Sambuc if (defined($nums{$s})) { 1103ebfedea0SLionel Sambuc $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; 1104ebfedea0SLionel Sambuc (my $n, my $dummy) = split /\\/, $nums{$s}; 1105ebfedea0SLionel Sambuc if (!defined($dummy) || $i ne $dummy) { 1106ebfedea0SLionel Sambuc $nums{$s} = $n."\\".$i; 1107ebfedea0SLionel Sambuc $new_info++; 1108ebfedea0SLionel Sambuc print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; 1109ebfedea0SLionel Sambuc } 1110ebfedea0SLionel Sambuc } 1111ebfedea0SLionel Sambuc $syms{$s} = 1; 1112ebfedea0SLionel Sambuc } 1113ebfedea0SLionel Sambuc 1114ebfedea0SLionel Sambuc my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; 1115ebfedea0SLionel Sambuc foreach $sym (@s) { 1116ebfedea0SLionel Sambuc (my $n, my $i) = split /\\/, $nums{$sym}; 1117ebfedea0SLionel Sambuc if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { 1118ebfedea0SLionel Sambuc $new_info++; 1119ebfedea0SLionel Sambuc print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; 1120ebfedea0SLionel Sambuc } 1121ebfedea0SLionel Sambuc } 1122ebfedea0SLionel Sambuc if ($new_info) { 1123ebfedea0SLionel Sambuc print STDERR "$new_info old symbols got an info update\n"; 1124ebfedea0SLionel Sambuc if (!$do_rewrite) { 1125ebfedea0SLionel Sambuc print STDERR "You should do a rewrite to fix this.\n"; 1126ebfedea0SLionel Sambuc } 1127ebfedea0SLionel Sambuc } else { 1128ebfedea0SLionel Sambuc print STDERR "No old symbols needed info update\n"; 1129ebfedea0SLionel Sambuc } 1130ebfedea0SLionel Sambuc} 1131ebfedea0SLionel Sambuc 1132ebfedea0SLionel Sambuc# Param: string of comma-separated keywords, each possibly prefixed with a "!" 1133ebfedea0SLionel Sambucsub is_valid 1134ebfedea0SLionel Sambuc{ 1135ebfedea0SLionel Sambuc my ($keywords_txt,$platforms) = @_; 1136ebfedea0SLionel Sambuc my (@keywords) = split /,/,$keywords_txt; 1137ebfedea0SLionel Sambuc my ($falsesum, $truesum) = (0, 1); 1138ebfedea0SLionel Sambuc 1139ebfedea0SLionel Sambuc # Param: one keyword 1140ebfedea0SLionel Sambuc sub recognise 1141ebfedea0SLionel Sambuc { 1142ebfedea0SLionel Sambuc my ($keyword,$platforms) = @_; 1143ebfedea0SLionel Sambuc 1144ebfedea0SLionel Sambuc if ($platforms) { 1145ebfedea0SLionel Sambuc # platforms 1146ebfedea0SLionel Sambuc if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } 1147ebfedea0SLionel Sambuc if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } 1148ebfedea0SLionel Sambuc if ($keyword eq "VMS" && $VMS) { return 1; } 1149ebfedea0SLionel Sambuc if ($keyword eq "WIN32" && $W32) { return 1; } 1150ebfedea0SLionel Sambuc if ($keyword eq "WIN16" && $W16) { return 1; } 1151ebfedea0SLionel Sambuc if ($keyword eq "WINNT" && $NT) { return 1; } 1152ebfedea0SLionel Sambuc if ($keyword eq "OS2" && $OS2) { return 1; } 1153ebfedea0SLionel Sambuc # Special platforms: 1154ebfedea0SLionel Sambuc # EXPORT_VAR_AS_FUNCTION means that global variables 1155ebfedea0SLionel Sambuc # will be represented as functions. This currently 1156ebfedea0SLionel Sambuc # only happens on VMS-VAX. 1157ebfedea0SLionel Sambuc if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { 1158ebfedea0SLionel Sambuc return 1; 1159ebfedea0SLionel Sambuc } 1160ebfedea0SLionel Sambuc if ($keyword eq "OPENSSL_FIPS" && $fips) { 1161ebfedea0SLionel Sambuc return 1; 1162ebfedea0SLionel Sambuc } 1163ebfedea0SLionel Sambuc if ($keyword eq "ZLIB" && $zlib) { return 1; } 1164ebfedea0SLionel Sambuc return 0; 1165ebfedea0SLionel Sambuc } else { 1166ebfedea0SLionel Sambuc # algorithms 1167ebfedea0SLionel Sambuc if ($keyword eq "RC2" && $no_rc2) { return 0; } 1168ebfedea0SLionel Sambuc if ($keyword eq "RC4" && $no_rc4) { return 0; } 1169ebfedea0SLionel Sambuc if ($keyword eq "RC5" && $no_rc5) { return 0; } 1170ebfedea0SLionel Sambuc if ($keyword eq "IDEA" && $no_idea) { return 0; } 1171ebfedea0SLionel Sambuc if ($keyword eq "DES" && $no_des) { return 0; } 1172ebfedea0SLionel Sambuc if ($keyword eq "BF" && $no_bf) { return 0; } 1173ebfedea0SLionel Sambuc if ($keyword eq "CAST" && $no_cast) { return 0; } 1174ebfedea0SLionel Sambuc if ($keyword eq "MD2" && $no_md2) { return 0; } 1175ebfedea0SLionel Sambuc if ($keyword eq "MD4" && $no_md4) { return 0; } 1176ebfedea0SLionel Sambuc if ($keyword eq "MD5" && $no_md5) { return 0; } 1177ebfedea0SLionel Sambuc if ($keyword eq "SHA" && $no_sha) { return 0; } 1178ebfedea0SLionel Sambuc if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } 1179ebfedea0SLionel Sambuc if ($keyword eq "MDC2" && $no_mdc2) { return 0; } 1180ebfedea0SLionel Sambuc if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } 1181ebfedea0SLionel Sambuc if ($keyword eq "RSA" && $no_rsa) { return 0; } 1182ebfedea0SLionel Sambuc if ($keyword eq "DSA" && $no_dsa) { return 0; } 1183ebfedea0SLionel Sambuc if ($keyword eq "DH" && $no_dh) { return 0; } 1184ebfedea0SLionel Sambuc if ($keyword eq "EC" && $no_ec) { return 0; } 1185ebfedea0SLionel Sambuc if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } 1186ebfedea0SLionel Sambuc if ($keyword eq "ECDH" && $no_ecdh) { return 0; } 1187ebfedea0SLionel Sambuc if ($keyword eq "HMAC" && $no_hmac) { return 0; } 1188ebfedea0SLionel Sambuc if ($keyword eq "AES" && $no_aes) { return 0; } 1189ebfedea0SLionel Sambuc if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } 1190ebfedea0SLionel Sambuc if ($keyword eq "SEED" && $no_seed) { return 0; } 1191ebfedea0SLionel Sambuc if ($keyword eq "EVP" && $no_evp) { return 0; } 1192ebfedea0SLionel Sambuc if ($keyword eq "LHASH" && $no_lhash) { return 0; } 1193ebfedea0SLionel Sambuc if ($keyword eq "STACK" && $no_stack) { return 0; } 1194ebfedea0SLionel Sambuc if ($keyword eq "ERR" && $no_err) { return 0; } 1195ebfedea0SLionel Sambuc if ($keyword eq "BUFFER" && $no_buffer) { return 0; } 1196ebfedea0SLionel Sambuc if ($keyword eq "BIO" && $no_bio) { return 0; } 1197ebfedea0SLionel Sambuc if ($keyword eq "COMP" && $no_comp) { return 0; } 1198ebfedea0SLionel Sambuc if ($keyword eq "DSO" && $no_dso) { return 0; } 1199ebfedea0SLionel Sambuc if ($keyword eq "KRB5" && $no_krb5) { return 0; } 1200ebfedea0SLionel Sambuc if ($keyword eq "ENGINE" && $no_engine) { return 0; } 1201ebfedea0SLionel Sambuc if ($keyword eq "HW" && $no_hw) { return 0; } 1202ebfedea0SLionel Sambuc if ($keyword eq "FP_API" && $no_fp_api) { return 0; } 1203ebfedea0SLionel Sambuc if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } 1204ebfedea0SLionel Sambuc if ($keyword eq "GMP" && $no_gmp) { return 0; } 1205ebfedea0SLionel Sambuc if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } 1206ebfedea0SLionel Sambuc if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } 1207ebfedea0SLionel Sambuc if ($keyword eq "PSK" && $no_psk) { return 0; } 1208ebfedea0SLionel Sambuc if ($keyword eq "CMS" && $no_cms) { return 0; } 1209ebfedea0SLionel Sambuc if ($keyword eq "EC2M" && $no_ec2m) { return 0; } 1210ebfedea0SLionel Sambuc if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; } 1211ebfedea0SLionel Sambuc if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc) 1212ebfedea0SLionel Sambuc { return 0; } 1213ebfedea0SLionel Sambuc if ($keyword eq "SSL2" && $no_ssl2) { return 0; } 1214*0a6a1f1dSLionel Sambuc if ($keyword eq "SSL3_METHOD" && $no_ssl3_method) { return 0; } 1215ebfedea0SLionel Sambuc if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } 1216ebfedea0SLionel Sambuc if ($keyword eq "JPAKE" && $no_jpake) { return 0; } 1217ebfedea0SLionel Sambuc if ($keyword eq "SRP" && $no_srp) { return 0; } 1218ebfedea0SLionel Sambuc if ($keyword eq "SCTP" && $no_sctp) { return 0; } 1219*0a6a1f1dSLionel Sambuc if ($keyword eq "SRTP" && $no_srtp) { return 0; } 1220*0a6a1f1dSLionel Sambuc if ($keyword eq "UNIT_TEST" && $no_unit_test) { return 0; } 1221ebfedea0SLionel Sambuc if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } 1222ebfedea0SLionel Sambuc 1223ebfedea0SLionel Sambuc # Nothing recognise as true 1224ebfedea0SLionel Sambuc return 1; 1225ebfedea0SLionel Sambuc } 1226ebfedea0SLionel Sambuc } 1227ebfedea0SLionel Sambuc 1228ebfedea0SLionel Sambuc foreach $k (@keywords) { 1229ebfedea0SLionel Sambuc if ($k =~ /^!(.*)$/) { 1230ebfedea0SLionel Sambuc $falsesum += &recognise($1,$platforms); 1231ebfedea0SLionel Sambuc } else { 1232ebfedea0SLionel Sambuc $truesum *= &recognise($k,$platforms); 1233ebfedea0SLionel Sambuc } 1234ebfedea0SLionel Sambuc } 1235ebfedea0SLionel Sambuc print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; 1236ebfedea0SLionel Sambuc return (!$falsesum) && $truesum; 1237ebfedea0SLionel Sambuc} 1238ebfedea0SLionel Sambuc 1239ebfedea0SLionel Sambucsub print_test_file 1240ebfedea0SLionel Sambuc{ 1241ebfedea0SLionel Sambuc (*OUT,my $name,*nums,my $testall,my @symbols)=@_; 1242ebfedea0SLionel Sambuc my $n = 1; my @e; my @r; 1243ebfedea0SLionel Sambuc my $sym; my $prev = ""; my $prefSSLeay; 1244ebfedea0SLionel Sambuc 1245ebfedea0SLionel Sambuc (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); 1246ebfedea0SLionel Sambuc (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); 1247ebfedea0SLionel Sambuc @symbols=((sort @e),(sort @r)); 1248ebfedea0SLionel Sambuc 1249ebfedea0SLionel Sambuc foreach $sym (@symbols) { 1250ebfedea0SLionel Sambuc (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; 1251ebfedea0SLionel Sambuc my $v = 0; 1252ebfedea0SLionel Sambuc $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; 1253ebfedea0SLionel Sambuc my $p = ($i =~ /^[^:]*:([^:]*):/,$1); 1254ebfedea0SLionel Sambuc my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); 1255ebfedea0SLionel Sambuc if (!defined($nums{$s})) { 1256ebfedea0SLionel Sambuc print STDERR "Warning: $s does not have a number assigned\n" 1257ebfedea0SLionel Sambuc if(!$do_update); 1258ebfedea0SLionel Sambuc } elsif (is_valid($p,1) && is_valid($a,0)) { 1259ebfedea0SLionel Sambuc my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); 1260ebfedea0SLionel Sambuc if ($prev eq $s2) { 1261ebfedea0SLionel Sambuc print OUT "\t/* The following has already appeared previously */\n"; 1262ebfedea0SLionel Sambuc print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; 1263ebfedea0SLionel Sambuc } 1264ebfedea0SLionel Sambuc $prev = $s2; # To warn about duplicates... 1265ebfedea0SLionel Sambuc 1266ebfedea0SLionel Sambuc ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); 1267ebfedea0SLionel Sambuc if ($v) { 1268ebfedea0SLionel Sambuc print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; 1269ebfedea0SLionel Sambuc } else { 1270ebfedea0SLionel Sambuc print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; 1271ebfedea0SLionel Sambuc } 1272ebfedea0SLionel Sambuc } 1273ebfedea0SLionel Sambuc } 1274ebfedea0SLionel Sambuc} 1275ebfedea0SLionel Sambuc 1276ebfedea0SLionel Sambucsub get_version { 1277ebfedea0SLionel Sambuc local *MF; 1278ebfedea0SLionel Sambuc my $v = '?'; 1279ebfedea0SLionel Sambuc open MF, 'Makefile' or return $v; 1280ebfedea0SLionel Sambuc while (<MF>) { 1281ebfedea0SLionel Sambuc $v = $1, last if /^VERSION=(.*?)\s*$/; 1282ebfedea0SLionel Sambuc } 1283ebfedea0SLionel Sambuc close MF; 1284ebfedea0SLionel Sambuc return $v; 1285ebfedea0SLionel Sambuc} 1286ebfedea0SLionel Sambuc 1287ebfedea0SLionel Sambucsub print_def_file 1288ebfedea0SLionel Sambuc{ 1289ebfedea0SLionel Sambuc (*OUT,my $name,*nums,my @symbols)=@_; 1290ebfedea0SLionel Sambuc my $n = 1; my @e; my @r; my @v; my $prev=""; 1291ebfedea0SLionel Sambuc my $liboptions=""; 1292ebfedea0SLionel Sambuc my $libname = $name; 1293ebfedea0SLionel Sambuc my $http_vendor = 'www.openssl.org/'; 1294ebfedea0SLionel Sambuc my $version = get_version(); 1295ebfedea0SLionel Sambuc my $what = "OpenSSL: implementation of Secure Socket Layer"; 1296ebfedea0SLionel Sambuc my $description = "$what $version, $name - http://$http_vendor"; 1297ebfedea0SLionel Sambuc 1298ebfedea0SLionel Sambuc if ($W32) 1299ebfedea0SLionel Sambuc { $libname.="32"; } 1300ebfedea0SLionel Sambuc elsif ($W16) 1301ebfedea0SLionel Sambuc { $libname.="16"; } 1302ebfedea0SLionel Sambuc elsif ($OS2) 1303ebfedea0SLionel Sambuc { # DLL names should not clash on the whole system. 1304ebfedea0SLionel Sambuc # However, they should not have any particular relationship 1305ebfedea0SLionel Sambuc # to the name of the static library. Chose descriptive names 1306ebfedea0SLionel Sambuc # (must be at most 8 chars). 1307ebfedea0SLionel Sambuc my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); 1308ebfedea0SLionel Sambuc $libname = $translate{$name} || $name; 1309ebfedea0SLionel Sambuc $liboptions = <<EOO; 1310ebfedea0SLionel SambucINITINSTANCE 1311ebfedea0SLionel SambucDATA MULTIPLE NONSHARED 1312ebfedea0SLionel SambucEOO 1313ebfedea0SLionel Sambuc # Vendor field can't contain colon, drat; so we omit http:// 1314ebfedea0SLionel Sambuc $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; 1315ebfedea0SLionel Sambuc } 1316ebfedea0SLionel Sambuc 1317ebfedea0SLionel Sambuc print OUT <<"EOF"; 1318ebfedea0SLionel Sambuc; 1319ebfedea0SLionel Sambuc; Definition file for the DLL version of the $name library from OpenSSL 1320ebfedea0SLionel Sambuc; 1321ebfedea0SLionel Sambuc 1322ebfedea0SLionel SambucLIBRARY $libname $liboptions 1323ebfedea0SLionel Sambuc 1324ebfedea0SLionel SambucEOF 1325ebfedea0SLionel Sambuc 1326ebfedea0SLionel Sambuc if ($W16) { 1327ebfedea0SLionel Sambuc print <<"EOF"; 1328ebfedea0SLionel SambucCODE PRELOAD MOVEABLE 1329ebfedea0SLionel SambucDATA PRELOAD MOVEABLE SINGLE 1330ebfedea0SLionel Sambuc 1331ebfedea0SLionel SambucEXETYPE WINDOWS 1332ebfedea0SLionel Sambuc 1333ebfedea0SLionel SambucHEAPSIZE 4096 1334ebfedea0SLionel SambucSTACKSIZE 8192 1335ebfedea0SLionel Sambuc 1336ebfedea0SLionel SambucEOF 1337ebfedea0SLionel Sambuc } 1338ebfedea0SLionel Sambuc 1339ebfedea0SLionel Sambuc print "EXPORTS\n"; 1340ebfedea0SLionel Sambuc 1341ebfedea0SLionel Sambuc (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); 1342ebfedea0SLionel Sambuc (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); 1343ebfedea0SLionel Sambuc (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols); 1344ebfedea0SLionel Sambuc @symbols=((sort @e),(sort @r), (sort @v)); 1345ebfedea0SLionel Sambuc 1346ebfedea0SLionel Sambuc 1347ebfedea0SLionel Sambuc foreach $sym (@symbols) { 1348ebfedea0SLionel Sambuc (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; 1349ebfedea0SLionel Sambuc my $v = 0; 1350ebfedea0SLionel Sambuc $v = 1 if $i =~ /^.*?:.*?:VARIABLE/; 1351ebfedea0SLionel Sambuc if (!defined($nums{$s})) { 1352ebfedea0SLionel Sambuc printf STDERR "Warning: $s does not have a number assigned\n" 1353ebfedea0SLionel Sambuc if(!$do_update); 1354ebfedea0SLionel Sambuc } else { 1355ebfedea0SLionel Sambuc (my $n, my $dummy) = split /\\/, $nums{$s}; 1356ebfedea0SLionel Sambuc my %pf = (); 1357ebfedea0SLionel Sambuc my $p = ($i =~ /^[^:]*:([^:]*):/,$1); 1358ebfedea0SLionel Sambuc my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); 1359ebfedea0SLionel Sambuc if (is_valid($p,1) && is_valid($a,0)) { 1360ebfedea0SLionel Sambuc my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); 1361ebfedea0SLionel Sambuc if ($prev eq $s2) { 1362ebfedea0SLionel Sambuc print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; 1363ebfedea0SLionel Sambuc } 1364ebfedea0SLionel Sambuc $prev = $s2; # To warn about duplicates... 1365ebfedea0SLionel Sambuc if($v && !$OS2) { 1366ebfedea0SLionel Sambuc printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n; 1367ebfedea0SLionel Sambuc } else { 1368ebfedea0SLionel Sambuc printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n; 1369ebfedea0SLionel Sambuc } 1370ebfedea0SLionel Sambuc } 1371ebfedea0SLionel Sambuc } 1372ebfedea0SLionel Sambuc } 1373ebfedea0SLionel Sambuc printf OUT "\n"; 1374ebfedea0SLionel Sambuc} 1375ebfedea0SLionel Sambuc 1376ebfedea0SLionel Sambucsub load_numbers 1377ebfedea0SLionel Sambuc{ 1378ebfedea0SLionel Sambuc my($name)=@_; 1379ebfedea0SLionel Sambuc my(@a,%ret); 1380ebfedea0SLionel Sambuc 1381ebfedea0SLionel Sambuc $max_num = 0; 1382ebfedea0SLionel Sambuc $num_noinfo = 0; 1383ebfedea0SLionel Sambuc $prev = ""; 1384ebfedea0SLionel Sambuc $prev_cnt = 0; 1385ebfedea0SLionel Sambuc 1386ebfedea0SLionel Sambuc open(IN,"<$name") || die "unable to open $name:$!\n"; 1387ebfedea0SLionel Sambuc while (<IN>) { 1388ebfedea0SLionel Sambuc chop; 1389ebfedea0SLionel Sambuc s/#.*$//; 1390ebfedea0SLionel Sambuc next if /^\s*$/; 1391ebfedea0SLionel Sambuc @a=split; 1392ebfedea0SLionel Sambuc if (defined $ret{$a[0]}) { 1393ebfedea0SLionel Sambuc # This is actually perfectly OK 1394ebfedea0SLionel Sambuc #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; 1395ebfedea0SLionel Sambuc } 1396ebfedea0SLionel Sambuc if ($max_num > $a[1]) { 1397ebfedea0SLionel Sambuc print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; 1398ebfedea0SLionel Sambuc } 1399ebfedea0SLionel Sambuc elsif ($max_num == $a[1]) { 1400ebfedea0SLionel Sambuc # This is actually perfectly OK 1401ebfedea0SLionel Sambuc #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; 1402ebfedea0SLionel Sambuc if ($a[0] eq $prev) { 1403ebfedea0SLionel Sambuc $prev_cnt++; 1404ebfedea0SLionel Sambuc $a[0] .= "{$prev_cnt}"; 1405ebfedea0SLionel Sambuc } 1406ebfedea0SLionel Sambuc } 1407ebfedea0SLionel Sambuc else { 1408ebfedea0SLionel Sambuc $prev_cnt = 0; 1409ebfedea0SLionel Sambuc } 1410ebfedea0SLionel Sambuc if ($#a < 2) { 1411ebfedea0SLionel Sambuc # Existence will be proven later, in do_defs 1412ebfedea0SLionel Sambuc $ret{$a[0]}=$a[1]; 1413ebfedea0SLionel Sambuc $num_noinfo++; 1414ebfedea0SLionel Sambuc } else { 1415ebfedea0SLionel Sambuc $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker 1416ebfedea0SLionel Sambuc } 1417ebfedea0SLionel Sambuc $max_num = $a[1] if $a[1] > $max_num; 1418ebfedea0SLionel Sambuc $prev=$a[0]; 1419ebfedea0SLionel Sambuc } 1420ebfedea0SLionel Sambuc if ($num_noinfo) { 1421ebfedea0SLionel Sambuc print STDERR "Warning: $num_noinfo symbols were without info."; 1422ebfedea0SLionel Sambuc if ($do_rewrite) { 1423ebfedea0SLionel Sambuc printf STDERR " The rewrite will fix this.\n"; 1424ebfedea0SLionel Sambuc } else { 1425ebfedea0SLionel Sambuc printf STDERR " You should do a rewrite to fix this.\n"; 1426ebfedea0SLionel Sambuc } 1427ebfedea0SLionel Sambuc } 1428ebfedea0SLionel Sambuc close(IN); 1429ebfedea0SLionel Sambuc return(%ret); 1430ebfedea0SLionel Sambuc} 1431ebfedea0SLionel Sambuc 1432ebfedea0SLionel Sambucsub parse_number 1433ebfedea0SLionel Sambuc{ 1434ebfedea0SLionel Sambuc (my $str, my $what) = @_; 1435ebfedea0SLionel Sambuc (my $n, my $i) = split(/\\/,$str); 1436ebfedea0SLionel Sambuc if ($what eq "n") { 1437ebfedea0SLionel Sambuc return $n; 1438ebfedea0SLionel Sambuc } else { 1439ebfedea0SLionel Sambuc return $i; 1440ebfedea0SLionel Sambuc } 1441ebfedea0SLionel Sambuc} 1442ebfedea0SLionel Sambuc 1443ebfedea0SLionel Sambucsub rewrite_numbers 1444ebfedea0SLionel Sambuc{ 1445ebfedea0SLionel Sambuc (*OUT,$name,*nums,@symbols)=@_; 1446ebfedea0SLionel Sambuc my $thing; 1447ebfedea0SLionel Sambuc 1448ebfedea0SLionel Sambuc print STDERR "Rewriting $name\n"; 1449ebfedea0SLionel Sambuc 1450ebfedea0SLionel Sambuc my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); 1451ebfedea0SLionel Sambuc my $r; my %r; my %rsyms; 1452ebfedea0SLionel Sambuc foreach $r (@r) { 1453ebfedea0SLionel Sambuc (my $s, my $i) = split /\\/, $r; 1454ebfedea0SLionel Sambuc my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; 1455ebfedea0SLionel Sambuc $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; 1456ebfedea0SLionel Sambuc $r{$a} = $s."\\".$i; 1457ebfedea0SLionel Sambuc $rsyms{$s} = 1; 1458ebfedea0SLionel Sambuc } 1459ebfedea0SLionel Sambuc 1460ebfedea0SLionel Sambuc my %syms = (); 1461ebfedea0SLionel Sambuc foreach $_ (@symbols) { 1462ebfedea0SLionel Sambuc (my $n, my $i) = split /\\/; 1463ebfedea0SLionel Sambuc $syms{$n} = 1; 1464ebfedea0SLionel Sambuc } 1465ebfedea0SLionel Sambuc 1466ebfedea0SLionel Sambuc my @s=sort { 1467ebfedea0SLionel Sambuc &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") 1468ebfedea0SLionel Sambuc || $a cmp $b 1469ebfedea0SLionel Sambuc } keys %nums; 1470ebfedea0SLionel Sambuc foreach $sym (@s) { 1471ebfedea0SLionel Sambuc (my $n, my $i) = split /\\/, $nums{$sym}; 1472ebfedea0SLionel Sambuc next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; 1473ebfedea0SLionel Sambuc next if defined($rsyms{$sym}); 1474ebfedea0SLionel Sambuc print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; 1475ebfedea0SLionel Sambuc $i="NOEXIST::FUNCTION:" 1476ebfedea0SLionel Sambuc if !defined($i) || $i eq "" || !defined($syms{$sym}); 1477ebfedea0SLionel Sambuc my $s2 = $sym; 1478ebfedea0SLionel Sambuc $s2 =~ s/\{[0-9]+\}$//; 1479ebfedea0SLionel Sambuc printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; 1480ebfedea0SLionel Sambuc if (exists $r{$sym}) { 1481ebfedea0SLionel Sambuc (my $s, $i) = split /\\/,$r{$sym}; 1482ebfedea0SLionel Sambuc my $s2 = $s; 1483ebfedea0SLionel Sambuc $s2 =~ s/\{[0-9]+\}$//; 1484ebfedea0SLionel Sambuc printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; 1485ebfedea0SLionel Sambuc } 1486ebfedea0SLionel Sambuc } 1487ebfedea0SLionel Sambuc} 1488ebfedea0SLionel Sambuc 1489ebfedea0SLionel Sambucsub update_numbers 1490ebfedea0SLionel Sambuc{ 1491ebfedea0SLionel Sambuc (*OUT,$name,*nums,my $start_num, my @symbols)=@_; 1492ebfedea0SLionel Sambuc my $new_syms = 0; 1493ebfedea0SLionel Sambuc 1494ebfedea0SLionel Sambuc print STDERR "Updating $name numbers\n"; 1495ebfedea0SLionel Sambuc 1496ebfedea0SLionel Sambuc my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); 1497ebfedea0SLionel Sambuc my $r; my %r; my %rsyms; 1498ebfedea0SLionel Sambuc foreach $r (@r) { 1499ebfedea0SLionel Sambuc (my $s, my $i) = split /\\/, $r; 1500ebfedea0SLionel Sambuc my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; 1501ebfedea0SLionel Sambuc $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; 1502ebfedea0SLionel Sambuc $r{$a} = $s."\\".$i; 1503ebfedea0SLionel Sambuc $rsyms{$s} = 1; 1504ebfedea0SLionel Sambuc } 1505ebfedea0SLionel Sambuc 1506ebfedea0SLionel Sambuc foreach $sym (@symbols) { 1507ebfedea0SLionel Sambuc (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; 1508ebfedea0SLionel Sambuc next if $i =~ /^.*?:.*?:\w+\(\w+\)/; 1509ebfedea0SLionel Sambuc next if defined($rsyms{$sym}); 1510ebfedea0SLionel Sambuc die "ERROR: Symbol $sym had no info attached to it." 1511ebfedea0SLionel Sambuc if $i eq ""; 1512ebfedea0SLionel Sambuc if (!exists $nums{$s}) { 1513ebfedea0SLionel Sambuc $new_syms++; 1514ebfedea0SLionel Sambuc my $s2 = $s; 1515ebfedea0SLionel Sambuc $s2 =~ s/\{[0-9]+\}$//; 1516ebfedea0SLionel Sambuc printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; 1517ebfedea0SLionel Sambuc if (exists $r{$s}) { 1518ebfedea0SLionel Sambuc ($s, $i) = split /\\/,$r{$s}; 1519ebfedea0SLionel Sambuc $s =~ s/\{[0-9]+\}$//; 1520ebfedea0SLionel Sambuc printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; 1521ebfedea0SLionel Sambuc } 1522ebfedea0SLionel Sambuc } 1523ebfedea0SLionel Sambuc } 1524ebfedea0SLionel Sambuc if($new_syms) { 1525ebfedea0SLionel Sambuc print STDERR "$new_syms New symbols added\n"; 1526ebfedea0SLionel Sambuc } else { 1527ebfedea0SLionel Sambuc print STDERR "No New symbols Added\n"; 1528ebfedea0SLionel Sambuc } 1529ebfedea0SLionel Sambuc} 1530ebfedea0SLionel Sambuc 1531ebfedea0SLionel Sambucsub check_existing 1532ebfedea0SLionel Sambuc{ 1533ebfedea0SLionel Sambuc (*nums, my @symbols)=@_; 1534ebfedea0SLionel Sambuc my %existing; my @remaining; 1535ebfedea0SLionel Sambuc @remaining=(); 1536ebfedea0SLionel Sambuc foreach $sym (@symbols) { 1537ebfedea0SLionel Sambuc (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; 1538ebfedea0SLionel Sambuc $existing{$s}=1; 1539ebfedea0SLionel Sambuc } 1540ebfedea0SLionel Sambuc foreach $sym (keys %nums) { 1541ebfedea0SLionel Sambuc if (!exists $existing{$sym}) { 1542ebfedea0SLionel Sambuc push @remaining, $sym; 1543ebfedea0SLionel Sambuc } 1544ebfedea0SLionel Sambuc } 1545ebfedea0SLionel Sambuc if(@remaining) { 1546ebfedea0SLionel Sambuc print STDERR "The following symbols do not seem to exist:\n"; 1547ebfedea0SLionel Sambuc foreach $sym (@remaining) { 1548ebfedea0SLionel Sambuc print STDERR "\t",$sym,"\n"; 1549ebfedea0SLionel Sambuc } 1550ebfedea0SLionel Sambuc } 1551ebfedea0SLionel Sambuc} 1552ebfedea0SLionel Sambuc 1553