Loading util/copy.pl 0 → 100644 +71 −0 Original line number Diff line number Diff line #!/usr/local/bin/perl use Fcntl; # copy.pl # Perl script 'copy' comment. On Windows the built in "copy" command also # copies timestamps: this messes up Makefile dependencies. # my $stripcr = 0; my $arg; foreach $arg (@ARGV) { if ($arg eq "-stripcr") { $stripcr = 1; next; } $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... foreach (glob $arg) { push @filelist, $_; } } $fnum = @filelist; if ($fnum <= 1) { die "Need at least two filenames"; } $dest = pop @filelist; if ($fnum > 2 && ! -d $dest) { die "Destination must be a directory"; } foreach (@filelist) { if (-d $dest) { $dfile = $_; $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; $dfile = "$dest/$dfile"; } else { $dfile = $dest; } sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) || die "Can't Open $dfile"; while (sysread IN, $buf, 10240) { if ($stripcr) { $buf =~ tr/\015//d; } syswrite(OUT, $buf, length($buf)); } close(IN); close(OUT); print "Copying: $_ to $dfile\n"; } util/mk1mf.pl +39 −17 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ my $fips_premain_dso_exe_path = ""; my $fips_premain_c_path = ""; my $fips_sha1_exe_path = ""; local $fipscanisterbuild = 0; my $fipslibdir = ""; my $baseaddr = ""; Loading Loading @@ -315,7 +317,7 @@ for (;;) $uc =~ s/^lib(.*)\.a/$1/; $uc =~ tr/a-z/A-Z/; } if (($uc ne "FIPS") || $fips_canister_build) if (($uc ne "FIPS") || $fipscanisterbuild) { $lib_nam{$uc}=$uc; $lib_obj{$uc}.=$libobj." "; Loading Loading @@ -371,6 +373,13 @@ for (;;) } close(IN); if ($fipscanisterbuild) { $fips_canister_path = "\$(LIB_D)${o}fipscanister.o"; $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c"; } else { if ($fips_canister_path eq "") { $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; Loading @@ -380,6 +389,7 @@ if ($fips_premain_c_path eq "") { $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; } } if ($fips) { Loading Loading @@ -408,6 +418,12 @@ if ($fips) $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; $ex_l_libs .= " \$(O_FIPSCANISTER)"; } if ($fipscanisterbuild) { $fipslibdir = "\$(LIB_D)"; } else { if ($fipslibdir eq "") { open (IN, "util/fipslib_path.txt") || fipslib_error(); Loading @@ -419,6 +435,7 @@ if ($fips) "fipscanister.o", "fipscanister.o.sha1", "fips_premain.c", "fips_premain.c.sha1"); } } $defs= <<"EOF"; Loading Loading @@ -684,7 +701,7 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); if ($fips) { if ($fips_canister_build) if ($fipscanisterbuild) { $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", "fips-1.0${o}fips_canister.c", Loading @@ -697,7 +714,7 @@ if ($fips) "\$(SHLIB_CFLAGS)"); $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_sha1dgst$obj", "fips-1.0${o}sha${o}fips_sha1dgst.c", "\$(SHLIB_CFLAGS)") unless $fips_canister_build; "\$(SHLIB_CFLAGS)") unless $fipscanisterbuild; $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", "fips-1.0${o}fips_premain.c", "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); Loading Loading @@ -807,7 +824,7 @@ if ($fips) if ($fips) { $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPSLIB_D)${o}fips_standalone_sha1$exep", "") if $fips_canister_build; $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPS_SHA1_EXE)", "") if $fipscanisterbuild; $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}fips_sha1dgst$obj","","", 1); Loading Loading @@ -1128,6 +1145,11 @@ sub read_options } } } elsif (/^--fipscanisterbuild$/) { print STDERR "FIPS CANISTER BUILD\n"; $fipscanisterbuild=1; } elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } elsif (/^-[lL].*$/) { $l_flags.="$_ "; } elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) Loading util/pl/VC-32.pl +9 −5 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ $des_enc_src=''; $bf_enc_obj=''; $bf_enc_src=''; if (!$no_asm && !$fips) { $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; Loading Loading @@ -135,7 +136,7 @@ sub do_lib_rule # $ret.="\t\$(RM) \$(O_$Name)\n"; $ret.="$target: $objs\n"; $ex =' advapi32.lib'; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && $target =~ /O_CRYPTO/; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && !$fipscanisterbuild && $target =~ /O_CRYPTO/; $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; } else Loading @@ -145,7 +146,7 @@ sub do_lib_rule $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; if ($fips && $target =~ /O_CRYPTO/) { $ex.=" \$(FIPSLIB_D)${o}_chkstk.o"; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" unless $fipscanisterbuild; $ret.="$target: $objs \$(PREMAIN_DSO_EXE)\n"; $ret.="\tSET FIPS_LINK=\$(LINK)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n"; Loading Loading @@ -178,7 +179,7 @@ sub do_link_rule if ($standalone) { $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/); $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild); $ret.="$files $libs\n<<\n"; } elsif ($fips && !$shlib) Loading Loading @@ -209,9 +210,12 @@ sub do_rlink_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($targer); $ret.="$target: $files $dep_libs\n"; $ret.=" \$(MKCANISTER) $target <<\n"; $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n"; $ret.="\t\$(MKCANISTER) $target <<\n"; $ret.="INPUT($files)\n<<\n"; $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n"; $ret.="\tperl util${o}copy.pl -stripcr fips-1.0${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n"; $ret.="\t\$(CP) fips-1.0${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n"; $ret.="\n"; return($ret); } Loading Loading
util/copy.pl 0 → 100644 +71 −0 Original line number Diff line number Diff line #!/usr/local/bin/perl use Fcntl; # copy.pl # Perl script 'copy' comment. On Windows the built in "copy" command also # copies timestamps: this messes up Makefile dependencies. # my $stripcr = 0; my $arg; foreach $arg (@ARGV) { if ($arg eq "-stripcr") { $stripcr = 1; next; } $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... foreach (glob $arg) { push @filelist, $_; } } $fnum = @filelist; if ($fnum <= 1) { die "Need at least two filenames"; } $dest = pop @filelist; if ($fnum > 2 && ! -d $dest) { die "Destination must be a directory"; } foreach (@filelist) { if (-d $dest) { $dfile = $_; $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; $dfile = "$dest/$dfile"; } else { $dfile = $dest; } sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) || die "Can't Open $dfile"; while (sysread IN, $buf, 10240) { if ($stripcr) { $buf =~ tr/\015//d; } syswrite(OUT, $buf, length($buf)); } close(IN); close(OUT); print "Copying: $_ to $dfile\n"; }
util/mk1mf.pl +39 −17 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ my $fips_premain_dso_exe_path = ""; my $fips_premain_c_path = ""; my $fips_sha1_exe_path = ""; local $fipscanisterbuild = 0; my $fipslibdir = ""; my $baseaddr = ""; Loading Loading @@ -315,7 +317,7 @@ for (;;) $uc =~ s/^lib(.*)\.a/$1/; $uc =~ tr/a-z/A-Z/; } if (($uc ne "FIPS") || $fips_canister_build) if (($uc ne "FIPS") || $fipscanisterbuild) { $lib_nam{$uc}=$uc; $lib_obj{$uc}.=$libobj." "; Loading Loading @@ -371,6 +373,13 @@ for (;;) } close(IN); if ($fipscanisterbuild) { $fips_canister_path = "\$(LIB_D)${o}fipscanister.o"; $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c"; } else { if ($fips_canister_path eq "") { $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; Loading @@ -380,6 +389,7 @@ if ($fips_premain_c_path eq "") { $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; } } if ($fips) { Loading Loading @@ -408,6 +418,12 @@ if ($fips) $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; $ex_l_libs .= " \$(O_FIPSCANISTER)"; } if ($fipscanisterbuild) { $fipslibdir = "\$(LIB_D)"; } else { if ($fipslibdir eq "") { open (IN, "util/fipslib_path.txt") || fipslib_error(); Loading @@ -419,6 +435,7 @@ if ($fips) "fipscanister.o", "fipscanister.o.sha1", "fips_premain.c", "fips_premain.c.sha1"); } } $defs= <<"EOF"; Loading Loading @@ -684,7 +701,7 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); if ($fips) { if ($fips_canister_build) if ($fipscanisterbuild) { $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", "fips-1.0${o}fips_canister.c", Loading @@ -697,7 +714,7 @@ if ($fips) "\$(SHLIB_CFLAGS)"); $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_sha1dgst$obj", "fips-1.0${o}sha${o}fips_sha1dgst.c", "\$(SHLIB_CFLAGS)") unless $fips_canister_build; "\$(SHLIB_CFLAGS)") unless $fipscanisterbuild; $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", "fips-1.0${o}fips_premain.c", "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); Loading Loading @@ -807,7 +824,7 @@ if ($fips) if ($fips) { $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPSLIB_D)${o}fips_standalone_sha1$exep", "") if $fips_canister_build; $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", "\$(OBJ_D)${o}fips_start$obj \$(FIPSOBJ) \$(OBJ_D)${o}fips_end$obj", "\$(FIPS_SHA1_EXE)", "") if $fipscanisterbuild; $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}fips_sha1dgst$obj","","", 1); Loading Loading @@ -1128,6 +1145,11 @@ sub read_options } } } elsif (/^--fipscanisterbuild$/) { print STDERR "FIPS CANISTER BUILD\n"; $fipscanisterbuild=1; } elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } elsif (/^-[lL].*$/) { $l_flags.="$_ "; } elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) Loading
util/pl/VC-32.pl +9 −5 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ $des_enc_src=''; $bf_enc_obj=''; $bf_enc_src=''; if (!$no_asm && !$fips) { $bn_asm_obj='crypto\bn\asm\bn_win32.obj'; Loading Loading @@ -135,7 +136,7 @@ sub do_lib_rule # $ret.="\t\$(RM) \$(O_$Name)\n"; $ret.="$target: $objs\n"; $ex =' advapi32.lib'; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && $target =~ /O_CRYPTO/; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && !$fipscanisterbuild && $target =~ /O_CRYPTO/; $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; } else Loading @@ -145,7 +146,7 @@ sub do_lib_rule $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; if ($fips && $target =~ /O_CRYPTO/) { $ex.=" \$(FIPSLIB_D)${o}_chkstk.o"; $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" unless $fipscanisterbuild; $ret.="$target: $objs \$(PREMAIN_DSO_EXE)\n"; $ret.="\tSET FIPS_LINK=\$(LINK)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n"; Loading Loading @@ -178,7 +179,7 @@ sub do_link_rule if ($standalone) { $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/); $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild); $ret.="$files $libs\n<<\n"; } elsif ($fips && !$shlib) Loading Loading @@ -209,9 +210,12 @@ sub do_rlink_rule $file =~ s/\//$o/g if $o ne '/'; $n=&bname($targer); $ret.="$target: $files $dep_libs\n"; $ret.=" \$(MKCANISTER) $target <<\n"; $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n"; $ret.="\t\$(MKCANISTER) $target <<\n"; $ret.="INPUT($files)\n<<\n"; $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n"; $ret.="\tperl util${o}copy.pl -stripcr fips-1.0${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n"; $ret.="\t\$(CP) fips-1.0${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n"; $ret.="\n"; return($ret); } Loading