Before initalising a live DRBG (i.e. not in test mode) run a complete health
[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 while (<STDIN>)
25         {
26         chomp;
27         # Skip directories but leave top level files.
28         next unless (/^(fips\/|crypto|util|test|include|ms)/ || (!/\// && -f $_));
29         if (/^crypto\/([^\/]+)/)
30                 {
31                 # Skip unused directories under crypto/
32                 next if -d "crypto/$1" && !exists $cdirs{$1};
33                 # Keep assembly language dir, Makefile or certain extensions
34                 if (!/\/asm\// && !/\/Makefile$/ && !/\.(in|pl|h)$/)
35                         {
36                         # If C source file must be on list.
37                         next if !/(\w+\.c)$/ || !exists $tarobjs{$1};
38                         }
39                 }
40         print "$_\n";
41         }
42 exit 1;