]> git.ipfire.org Git - thirdparty/openssl.git/blob - util/bat.sh
Fix memory leak in DSA redo case.
[thirdparty/openssl.git] / util / bat.sh
1 #!/usr/local/bin/perl
2
3 $infile="/home/eay/ssl/SSLeay/MINFO";
4
5 open(IN,"<$infile") || die "unable to open $infile:$!\n";
6 $_=<IN>;
7 for (;;)
8 {
9 chop;
10
11 ($key,$val)=/^([^=]+)=(.*)/;
12 if ($key eq "RELATIVE_DIRECTORY")
13 {
14 if ($lib ne "")
15 {
16 $uc=$lib;
17 $uc =~ s/^lib(.*)\.a/$1/;
18 $uc =~ tr/a-z/A-Z/;
19 $lib_nam{$uc}=$uc;
20 $lib_obj{$uc}.=$libobj." ";
21 }
22 last if ($val eq "FINISHED");
23 $lib="";
24 $libobj="";
25 $dir=$val;
26 }
27
28 if ($key eq "TEST")
29 { $test.=&var_add($dir,$val); }
30
31 if (($key eq "PROGS") || ($key eq "E_OBJ"))
32 { $e_exe.=&var_add($dir,$val); }
33
34 if ($key eq "LIB")
35 {
36 $lib=$val;
37 $lib =~ s/^.*\/([^\/]+)$/$1/;
38 }
39
40 if ($key eq "HEADER")
41 { $header.=&var_add($dir,$val); }
42
43 if ($key eq "LIBSRC")
44 { $libsrc.=&var_add($dir,$val); }
45
46 if (!($_=<IN>))
47 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
48 }
49 close(IN);
50
51 @a=split(/\s+/,$libsrc);
52 foreach (@a)
53 {
54 print "${_}.c\n";
55 }
56
57 sub var_add
58 {
59 local($dir,$val)=@_;
60 local(@a,$_,$ret);
61
62 return("") if $no_engine && $dir =~ /\/engine/;
63 return("") if $no_idea && $dir =~ /\/idea/;
64 return("") if $no_rc2 && $dir =~ /\/rc2/;
65 return("") if $no_rc4 && $dir =~ /\/rc4/;
66 return("") if $no_rsa && $dir =~ /\/rsa/;
67 return("") if $no_rsa && $dir =~ /^rsaref/;
68 return("") if $no_dsa && $dir =~ /\/dsa/;
69 return("") if $no_dh && $dir =~ /\/dh/;
70 if ($no_des && $dir =~ /\/des/)
71 {
72 if ($val =~ /read_pwd/)
73 { return("$dir/read_pwd "); }
74 else
75 { return(""); }
76 }
77 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
78 return("") if $no_sock && $dir =~ /\/proxy/;
79 return("") if $no_bf && $dir =~ /\/bf/;
80 return("") if $no_cast && $dir =~ /\/cast/;
81
82 $val =~ s/^\s*(.*)\s*$/$1/;
83 @a=split(/\s+/,$val);
84 grep(s/\.[och]$//,@a);
85
86 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
87 @a=grep(!/^e_.*_d$/,@a) if $no_des;
88 @a=grep(!/^e_.*_i$/,@a) if $no_idea;
89 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
90 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
91 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
92 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
93
94 @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
95
96 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
97
98 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
99 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
100
101 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
102 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
103 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
104
105 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
106 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
107
108 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
109
110 @a=grep(!/_dhp$/,@a) if $no_dh;
111
112 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
113 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
114 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
115
116 @a=grep(!/^engine$/,@a) if $no_engine;
117 @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa;
118 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
119 @a=grep(!/^gendsa$/,@a) if $no_sha1;
120 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
121
122 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
123
124 grep($_="$dir/$_",@a);
125 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
126 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
127 $ret=join(' ',@a)." ";
128 return($ret);
129 }
130