Initial perl script to filter out unneeded files for a fips tarball.
[openssl.git] / util / fipsobj.pl
1
2 # Filter script. Take all FIPS object files from the environment
3 # and print out only those in the given directory.
4
5 my $dir = $ARGV[0];
6
7 my $asmobjs = "";
8
9 # Add any needed assembly language files.
10
11 $asmobjs = $ENV{AES_ENC} if $dir eq "aes";
12 $asmobjs = $ENV{BN_ASM} if $dir eq "bn";
13 $asmobjs = $ENV{DES_ENC} if $dir eq "des";
14 $asmobjs = $ENV{SHA1_ASM_OBJ} if $dir eq "sha";
15 $asmobjs = $ENV{MODES_ASM_OBJ} if $dir eq "modes";
16
17 # Get all other FIPS object files, filtered by directory.
18
19 my @objlist = grep {/crypto\/$dir\//} split / /, $ENV{FIPS_EX_OBJ};
20
21 push @objlist, split / /, $asmobjs;
22
23 # Fatal error if no matches
24 die "No objects in $dir!" if (scalar @objlist == 0);
25
26 # Output all matches removing pathname.
27 foreach (@objlist)
28         {
29         s|../crypto/$dir/||;
30         print "$_\n";
31         }