]>
git.ipfire.org Git - thirdparty/openssl.git/blob - util/mkdef.pl
4eafcc4fd58a31ccbcf183d06059b5948084f6d2
5 # It does this by parsing the header files and looking for the
6 # non-prototyped functions.
9 $crypto_num="util/libeay.num";
10 $ssl_num= "util/ssleay.num";
14 # Set this to make typesafe STACK definitions appear in DEF
24 $do_ssl=1 if $_ eq "ssleay";
25 $do_ssl=1 if $_ eq "ssl";
26 $do_crypto=1 if $_ eq "libeay";
27 $do_crypto=1 if $_ eq "crypto";
28 $do_update=1 if $_ eq "update";
31 if (!$do_ssl && !$do_crypto)
33 print STDERR
"usage: $0 ( ssl | crypto ) [ 16 | 32 ]\n";
37 %ssl_list=&load_numbers
($ssl_num);
39 %crypto_list=&load_numbers
($crypto_num);
40 $max_crypto = $max_num;
44 $crypto ="crypto/crypto.h";
45 $crypto.=" crypto/des/des.h";
46 $crypto.=" crypto/idea/idea.h";
47 $crypto.=" crypto/rc4/rc4.h";
48 $crypto.=" crypto/rc5/rc5.h";
49 $crypto.=" crypto/rc2/rc2.h";
50 $crypto.=" crypto/bf/blowfish.h";
51 $crypto.=" crypto/cast/cast.h";
52 $crypto.=" crypto/md2/md2.h";
53 $crypto.=" crypto/md5/md5.h";
54 $crypto.=" crypto/mdc2/mdc2.h";
55 $crypto.=" crypto/sha/sha.h";
56 $crypto.=" crypto/ripemd/ripemd.h";
58 $crypto.=" crypto/bn/bn.h";
59 $crypto.=" crypto/rsa/rsa.h";
60 $crypto.=" crypto/dsa/dsa.h";
61 $crypto.=" crypto/dh/dh.h";
63 $crypto.=" crypto/stack/stack.h";
64 $crypto.=" crypto/buffer/buffer.h";
65 $crypto.=" crypto/bio/bio.h";
66 $crypto.=" crypto/lhash/lhash.h";
67 $crypto.=" crypto/conf/conf.h";
68 $crypto.=" crypto/txt_db/txt_db.h";
70 $crypto.=" crypto/evp/evp.h";
71 $crypto.=" crypto/objects/objects.h";
72 $crypto.=" crypto/pem/pem.h";
73 #$crypto.=" crypto/meth/meth.h";
74 $crypto.=" crypto/asn1/asn1.h";
75 $crypto.=" crypto/asn1/asn1_mac.h";
76 $crypto.=" crypto/err/err.h";
77 $crypto.=" crypto/pkcs7/pkcs7.h";
78 $crypto.=" crypto/pkcs12/pkcs12.h";
79 $crypto.=" crypto/x509/x509.h";
80 $crypto.=" crypto/x509/x509_vfy.h";
81 $crypto.=" crypto/x509v3/x509v3.h";
82 $crypto.=" crypto/rand/rand.h";
83 $crypto.=" crypto/hmac/hmac.h";
84 $crypto.=" crypto/comp/comp.h";
85 $crypto.=" crypto/tmdiff.h";
90 @ssl_func = &do_defs
("SSLEAY", $ssl);
91 @crypto_func = &do_defs
("LIBEAY", $crypto);
96 open(OUT
, ">>$ssl_num");
97 &update_numbers
(*OUT
,"SSLEAY",*ssl_list
,$max_ssl, @ssl_func);
101 if($do_crypto == 1) {
102 open(OUT
, ">>$crypto_num");
103 &update_numbers
(*OUT
,"LIBEAY",*crypto_list
,$max_crypto, @crypto_func);
109 &print_def_file
(*STDOUT
,"SSLEAY",*ssl_list
,@ssl_func)
112 &print_def_file
(*STDOUT
,"LIBEAY",*crypto_list
,@crypto_func)
120 local($name,$files)=@_;
124 foreach $file (split(/\s+/,$files))
126 # print STDERR "reading $file\n";
127 open(IN
,"<$file") || die "unable to open $file:$!\n";
133 while (($i=index($a,"/*")) >= 0)
136 last unless ($j >= 0);
137 $a=substr($a,0,$i).substr($a,$j+2);
140 foreach (split("\n",$a))
142 if (/^\#\s*ifndef (.*)/)
148 elsif (/^\#\s*if !defined\(([^\)]+)\)/)
154 elsif (/^\#\s*ifdef (.*)/)
160 elsif (/^\#\s*if defined(.*)/)
166 elsif (/^\#\s*endif/)
178 #printf STDERR "$_\n%2d %2d %2d %2d %2d $W32\n",
179 #$tag{'NOPROTO'},$tag{'FreeBSD'},$tag{'WIN16'},$tag{'PERL5'},$tag{'NO_FP_API'};
183 { $t=&do_extern
($name,$_); }
184 elsif ($safe_stack_def &&
185 /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/)
187 push(@ret,"sk_${1}_new");
188 push(@ret,"sk_${1}_new_null");
189 push(@ret,"sk_${1}_free");
190 push(@ret,"sk_${1}_num");
191 push(@ret,"sk_${1}_value");
192 push(@ret,"sk_${1}_set");
193 push(@ret,"sk_${1}_zero");
194 push(@ret,"sk_${1}_push");
195 # push(@ret,"sk_${1}_pop");
196 push(@ret,"sk_${1}_find");
197 push(@ret,"sk_${1}_delete");
198 push(@ret,"sk_${1}_delete_ptr");
199 push(@ret,"sk_${1}_set_cmp_func");
200 push(@ret,"sk_${1}_dup");
201 push(@ret,"sk_${1}_pop_free");
202 push(@ret,"sk_${1}_shift");
204 elsif ($safe_stack_def &&
205 /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/)
207 push(@ret,"d2i_ASN1_SET_OF_${1}");
208 push(@ret,"i2d_ASN1_SET_OF_${1}");
210 elsif (($tag{'NOPROTO'} == 1) &&
211 ($tag{'FreeBSD'} != 1) &&
212 (($W32 && ($tag{'WIN16'} != 1)) ||
213 (!$W32 && ($tag{'WIN16'} != -1))) &&
214 ($tag{'PERL5'} != 1) &&
215 # ($tag{'_WINDLL'} != -1) &&
216 ((!$W32 && $tag{'_WINDLL'} != -1) ||
217 ($W32 && $tag{'_WINDLL'} != 1)) &&
218 ((($tag{'NO_FP_API'} != 1) && $W32) ||
219 (($tag{'NO_FP_API'} != -1) && !$W32)))
220 { $t=&do_line
($name,$_); }
223 if (($t ne undef) && (!$done{$name,$t}))
227 #printf STDERR "one:$t\n" if $t =~ /BIO_/;
240 return(undef) if /^$/;
241 return(undef) if /^\s/;
242 #printf STDERR "two:$_\n" if $_ =~ /BIO_/;
243 if (/(CRYPTO_get_locking_callback)/)
245 elsif (/(CRYPTO_get_id_callback)/)
247 elsif (/(CRYPTO_get_add_lock_callback)/)
249 elsif (/(SSL_CTX_get_verify_callback)/)
251 elsif (/(SSL_get_info_callback)/)
253 elsif ((!$W32) && /(ERR_load_CRYPTO_strings)/)
254 { return("ERR_load_CRYPTOlib_strings"); }
255 elsif (!$W32 && /BIO_s_file/)
257 elsif (!$W32 && /BIO_new_file/)
259 elsif (!$W32 && /BIO_new_fp/)
261 elsif ($W32 && /BIO_s_file_internal/)
263 elsif ($W32 && /BIO_new_file_internal/)
265 elsif ($W32 && /BIO_new_fp_internal/)
267 elsif (/SSL_add_dir_cert_subjects_to_stack/)
269 elsif (!$NT && /BIO_s_log/)
276 #print STDERR "$1 : $_\n";
292 local(*OUT
,$name,*nums
,@functions)=@_;
302 ; Definition file for the DLL version of the $name library from OpenSSL
307 DESCRIPTION 'OpenSSL $name - http://www.openssl.org/'
314 CODE PRELOAD MOVEABLE
315 DATA PRELOAD MOVEABLE SINGLE
328 (@e)=grep(/^SSLeay/,@functions);
329 (@r)=grep(!/^SSLeay/,@functions);
330 @functions=((sort @e),(sort @r));
332 foreach $func (@functions)
334 if (!defined($nums{$func}))
336 printf STDERR
"$func does not have a number assigned\n"
342 printf OUT
" %s%-40s@%d\n",($W32)?
"":"_",$func,$n;
355 open(IN
,"<$name") || die "unable to open $name:$!\n";
363 $max_num = $a[1] if $a[1] > $max_num;
371 local(*OUT
,$name,*nums
,$start_num, @functions)=@_;
373 print STDERR
"Updating $name\n";
374 foreach $func (@functions)
376 if (!defined($nums{$func}))
379 printf OUT
"%s%-40s%d\n","",$func, ++$start_num;
383 print STDERR
"$new_funcs New Functions added\n";
385 print STDERR
"No New Functions Added\n";