typo
[openssl.git] / util / fipsdist.pl
1
2 # FIPS distribution filter. 
3 # Takes tarball listing and removes unnecessary files and directories.
4 #
5
6
7 my $objs = "";
8 foreach (split / /, "FIPS_EX_OBJ AES_ENC BN_ASM DES_ENC SHA1_ASM_OBJ MODES_ASM_OBJ")
9         {
10         $objs .= " $ENV{$_}";
11         }
12
13
14 my @objlist = split / /, $objs;
15
16 foreach (@objlist) { $tarobjs{"$1.c"} = 1 if /([^\/]+).o$/};
17
18 $tarobjs{"ncbc_enc.c"} = 1;
19
20 foreach (split / /, $ENV{LINKDIRS} ) { $cdirs{$_} = 1 };
21
22 $cdirs{perlasm} = 1;
23
24 foreach (keys %cdirs) { print STDERR "CDIR: $_\n";}
25
26 while (<STDIN>)
27         {
28         chomp;
29         # Skip directories but leave top level files.
30         next unless (/^(fips\/|crypto|util|test|include)/ || (!/\// && -f $_));
31         if (/^crypto\/([^\/]+)/)
32                 {
33                 # Skip unused directories under crypto/
34                 next if -d "crypto/$1" && !exists $cdirs{$1};
35                 # Keep assembly language dir, Makefile or certain extensions
36                 if (!/\/asm\// && !/\/Makefile$/ && !/\.(in|pl|h)$/)
37                         {
38                         # If C source file must be on list.
39                         next if !/(\w+\.c)$/ || !exists $tarobjs{$1};
40                         }
41                 }
42         print "$_\n";
43         }
44 exit 1;