diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/util/checkhash.pl | 222 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/fipslink.pl | 78 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/libeay.num | 42 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 337 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/mkdef.pl | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/mkfiles.pl | 17 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/mklink.pl | 7 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pl/BC-32.pl | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pl/OS2-EMX.pl | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pl/VC-32-GMAKE.pl | 222 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pl/VC-32.pl | 99 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pod2man.pl | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/selftest.pl | 26 |
13 files changed, 976 insertions, 101 deletions
diff --git a/src/lib/libcrypto/util/checkhash.pl b/src/lib/libcrypto/util/checkhash.pl new file mode 100644 index 0000000000..c61fa72178 --- /dev/null +++ b/src/lib/libcrypto/util/checkhash.pl | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | #!/usr/bin/env perl -w | ||
| 2 | |||
| 3 | my $package = caller; | ||
| 4 | |||
| 5 | if (!(defined $package)) | ||
| 6 | { | ||
| 7 | my $retval = check_hashes(@ARGV); | ||
| 8 | exit $retval; | ||
| 9 | } | ||
| 10 | |||
| 11 | 1; | ||
| 12 | |||
| 13 | sub check_hashes | ||
| 14 | { | ||
| 15 | |||
| 16 | my @args = @_; | ||
| 17 | |||
| 18 | my $change_dir = ""; | ||
| 19 | my $check_program = "sha/fips_standalone_sha1"; | ||
| 20 | |||
| 21 | my $verbose = 0; | ||
| 22 | my $badfiles = 0; | ||
| 23 | my $rebuild = 0; | ||
| 24 | my $force_rewrite = 0; | ||
| 25 | my $hash_file = "fipshashes.c"; | ||
| 26 | my $recurse = 0; | ||
| 27 | |||
| 28 | my @fingerprint_files; | ||
| 29 | |||
| 30 | while (@args) | ||
| 31 | { | ||
| 32 | my $arg = $args[0]; | ||
| 33 | if ($arg eq "-chdir") | ||
| 34 | { | ||
| 35 | shift @args; | ||
| 36 | $change_dir = shift @args; | ||
| 37 | } | ||
| 38 | elsif ($arg eq "-rebuild") | ||
| 39 | { | ||
| 40 | shift @args; | ||
| 41 | $rebuild = 1; | ||
| 42 | } | ||
| 43 | elsif ($arg eq "-verbose") | ||
| 44 | { | ||
| 45 | shift @args; | ||
| 46 | $verbose = 1; | ||
| 47 | } | ||
| 48 | elsif ($arg eq "-force-rewrite") | ||
| 49 | { | ||
| 50 | shift @args; | ||
| 51 | $force_rewrite = 1; | ||
| 52 | } | ||
| 53 | elsif ($arg eq "-hash_file") | ||
| 54 | { | ||
| 55 | shift @args; | ||
| 56 | $hash_file = shift @args; | ||
| 57 | } | ||
| 58 | elsif ($arg eq "-recurse") | ||
| 59 | { | ||
| 60 | shift @args; | ||
| 61 | $recurse = 1; | ||
| 62 | } | ||
| 63 | elsif ($arg eq "-program_path") | ||
| 64 | { | ||
| 65 | shift @args; | ||
| 66 | $check_program = shift @args; | ||
| 67 | } | ||
| 68 | else | ||
| 69 | { | ||
| 70 | print STDERR "Unknown Option $arg"; | ||
| 71 | return 1; | ||
| 72 | } | ||
| 73 | |||
| 74 | } | ||
| 75 | |||
| 76 | chdir $change_dir if $change_dir ne ""; | ||
| 77 | |||
| 78 | if ($recurse) | ||
| 79 | { | ||
| 80 | @fingerprint_files = ("fingerprint.sha1", | ||
| 81 | <*/fingerprint.sha1>); | ||
| 82 | } | ||
| 83 | else | ||
| 84 | { | ||
| 85 | push @fingerprint_files, $hash_file; | ||
| 86 | } | ||
| 87 | |||
| 88 | foreach $fp (@fingerprint_files) | ||
| 89 | { | ||
| 90 | if (!open(IN, "$fp")) | ||
| 91 | { | ||
| 92 | print STDERR "Can't open file $fp"; | ||
| 93 | return 1; | ||
| 94 | } | ||
| 95 | print STDERR "Opening Fingerprint file $fp\n" if $verbose; | ||
| 96 | my $dir = $fp; | ||
| 97 | $dir =~ s/[^\/]*$//; | ||
| 98 | while (<IN>) | ||
| 99 | { | ||
| 100 | chomp; | ||
| 101 | if (!(($file, $hash) = /^\"HMAC-SHA1\((.*)\)\s*=\s*(\w*)\",$/)) | ||
| 102 | { | ||
| 103 | /^\"/ || next; | ||
| 104 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
| 105 | print STDERR "Line:\n$_\n"; | ||
| 106 | fatal_error(); | ||
| 107 | return 1; | ||
| 108 | } | ||
| 109 | if (!$rebuild && length($hash) != 40) | ||
| 110 | { | ||
| 111 | print STDERR "FATAL: Invalid hash length in $fp for file $file\n"; | ||
| 112 | fatal_error(); | ||
| 113 | return 1; | ||
| 114 | } | ||
| 115 | push @hashed_files, "$dir$file"; | ||
| 116 | if (exists $hashes{"$dir$file"}) | ||
| 117 | { | ||
| 118 | print STDERR "FATAL: Duplicate Hash file $dir$file\n"; | ||
| 119 | fatal_error(); | ||
| 120 | return 1; | ||
| 121 | } | ||
| 122 | if (! -r "$dir$file") | ||
| 123 | { | ||
| 124 | print STDERR "FATAL: Can't access $dir$file\n"; | ||
| 125 | fatal_error(); | ||
| 126 | return 1; | ||
| 127 | } | ||
| 128 | $hashes{"$dir$file"} = $hash; | ||
| 129 | } | ||
| 130 | close IN; | ||
| 131 | } | ||
| 132 | |||
| 133 | @checked_hashes = `$check_program @hashed_files`; | ||
| 134 | |||
| 135 | if ($? != 0) | ||
| 136 | { | ||
| 137 | print STDERR "Error running hash program $check_program\n"; | ||
| 138 | fatal_error(); | ||
| 139 | return 1; | ||
| 140 | } | ||
| 141 | |||
| 142 | if (@checked_hashes != @hashed_files) | ||
| 143 | { | ||
| 144 | print STDERR "FATAL: hash count incorrect\n"; | ||
| 145 | fatal_error(); | ||
| 146 | return 1; | ||
| 147 | } | ||
| 148 | |||
| 149 | foreach (@checked_hashes) | ||
| 150 | { | ||
| 151 | chomp; | ||
| 152 | if (!(($file, $hash) = /^HMAC-SHA1\((.*)\)\s*=\s*(\w*)$/)) | ||
| 153 | { | ||
| 154 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
| 155 | print STDERR "Line:\n$_\n"; | ||
| 156 | fatal_error(); | ||
| 157 | return 1; | ||
| 158 | } | ||
| 159 | if (length($hash) != 40) | ||
| 160 | { | ||
| 161 | print STDERR "FATAL: Invalid hash length for file $file\n"; | ||
| 162 | fatal_error(); | ||
| 163 | return 1; | ||
| 164 | } | ||
| 165 | if ($hash ne $hashes{$file}) | ||
| 166 | { | ||
| 167 | if ($rebuild) | ||
| 168 | { | ||
| 169 | print STDERR "Updating hash on file $file\n"; | ||
| 170 | $hashes{$file} = $hash; | ||
| 171 | } | ||
| 172 | else | ||
| 173 | { | ||
| 174 | print STDERR "Hash check failed for file $file\n"; | ||
| 175 | } | ||
| 176 | $badfiles++; | ||
| 177 | } | ||
| 178 | elsif ($verbose) | ||
| 179 | { print "Hash Check OK for $file\n";} | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | if ($badfiles && !$rebuild) | ||
| 184 | { | ||
| 185 | print STDERR "FATAL: hash mismatch on $badfiles files\n"; | ||
| 186 | fatal_error(); | ||
| 187 | return 1; | ||
| 188 | } | ||
| 189 | |||
| 190 | if ($badfiles || $force_rewrite) | ||
| 191 | { | ||
| 192 | print "Updating Hash file $hash_file\n"; | ||
| 193 | if (!open(OUT, ">$hash_file")) | ||
| 194 | { | ||
| 195 | print STDERR "Error rewriting $hash_file"; | ||
| 196 | return 1; | ||
| 197 | } | ||
| 198 | print OUT "const char * const FIPS_source_hashes[] = {\n"; | ||
| 199 | foreach (@hashed_files) | ||
| 200 | { | ||
| 201 | print OUT "\"HMAC-SHA1($_)= $hashes{$_}\",\n"; | ||
| 202 | } | ||
| 203 | print OUT "};\n"; | ||
| 204 | close OUT; | ||
| 205 | } | ||
| 206 | |||
| 207 | if (!$badfiles) | ||
| 208 | { | ||
| 209 | print "FIPS hash check successful\n"; | ||
| 210 | } | ||
| 211 | |||
| 212 | return 0; | ||
| 213 | |||
| 214 | } | ||
| 215 | |||
| 216 | |||
| 217 | sub fatal_error | ||
| 218 | { | ||
| 219 | print STDERR "*** Your source code does not match the FIPS validated source ***\n"; | ||
| 220 | } | ||
| 221 | |||
| 222 | |||
diff --git a/src/lib/libcrypto/util/fipslink.pl b/src/lib/libcrypto/util/fipslink.pl new file mode 100644 index 0000000000..a893833c5c --- /dev/null +++ b/src/lib/libcrypto/util/fipslink.pl | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | sub check_env | ||
| 4 | { | ||
| 5 | my @ret; | ||
| 6 | foreach (@_) | ||
| 7 | { | ||
| 8 | die "Environment variable $_ not defined!\n" unless exists $ENV{$_}; | ||
| 9 | push @ret, $ENV{$_}; | ||
| 10 | } | ||
| 11 | return @ret; | ||
| 12 | } | ||
| 13 | |||
| 14 | |||
| 15 | my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_exe) | ||
| 16 | = check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET", | ||
| 17 | "FIPSLIB_D", "FIPS_SHA1_EXE"); | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | if (exists $ENV{"PREMAIN_DSO_EXE"}) | ||
| 22 | { | ||
| 23 | $fips_premain_dso = $ENV{"PREMAIN_DSO_EXE"}; | ||
| 24 | } | ||
| 25 | else | ||
| 26 | { | ||
| 27 | $fips_premain_dso = ""; | ||
| 28 | } | ||
| 29 | |||
| 30 | check_hash($sha1_exe, "fips_premain.c"); | ||
| 31 | check_hash($sha1_exe, "fipscanister.o"); | ||
| 32 | |||
| 33 | |||
| 34 | print "Integrity check OK\n"; | ||
| 35 | |||
| 36 | print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
| 37 | system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c"; | ||
| 38 | die "First stage Compile failure" if $? != 0; | ||
| 39 | |||
| 40 | print "$fips_link @ARGV\n"; | ||
| 41 | system "$fips_link @ARGV"; | ||
| 42 | die "First stage Link failure" if $? != 0; | ||
| 43 | |||
| 44 | |||
| 45 | print "$fips_premain_dso $fips_target\n"; | ||
| 46 | $fips_hash=`$fips_premain_dso $fips_target`; | ||
| 47 | chomp $fips_hash; | ||
| 48 | die "Get hash failure" if $? != 0; | ||
| 49 | |||
| 50 | |||
| 51 | print "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
| 52 | system "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c"; | ||
| 53 | die "Second stage Compile failure" if $? != 0; | ||
| 54 | |||
| 55 | |||
| 56 | print "$fips_link @ARGV\n"; | ||
| 57 | system "$fips_link @ARGV"; | ||
| 58 | die "Second stage Link failure" if $? != 0; | ||
| 59 | |||
| 60 | sub check_hash | ||
| 61 | { | ||
| 62 | my ($sha1_exe, $filename) = @_; | ||
| 63 | my ($hashfile, $hashval); | ||
| 64 | |||
| 65 | open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash file ${fips_libdir}/${filename}.sha1"; | ||
| 66 | $hashfile = <IN>; | ||
| 67 | close IN; | ||
| 68 | $hashval = `$sha1_exe ${fips_libdir}/$filename`; | ||
| 69 | chomp $hashfile; | ||
| 70 | chomp $hashval; | ||
| 71 | $hashfile =~ s/^.*=\s+//; | ||
| 72 | $hashval =~ s/^.*=\s+//; | ||
| 73 | die "Invalid hash syntax in file" if (length($hashfile) != 40); | ||
| 74 | die "Invalid hash received for file" if (length($hashval) != 40); | ||
| 75 | die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hashfile); | ||
| 76 | } | ||
| 77 | |||
| 78 | |||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 56fb7446e0..4222bef6d6 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
| @@ -2811,7 +2811,7 @@ EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES | |||
| 2811 | FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: | 2811 | FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: |
| 2812 | FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: | 2812 | FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: |
| 2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES | 2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES |
| 2814 | FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS:FUNCTION: | 2814 | FIPS_allow_md5 3256 NOEXIST::FUNCTION: |
| 2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES | 2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES |
| 2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES | 2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES |
| 2817 | FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION: | 2817 | FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION: |
| @@ -2837,7 +2837,7 @@ FIPS_dsa_check 3278 EXIST:OPENSSL_FIPS:FUNCTION: | |||
| 2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES | 2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES |
| 2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES | 2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES |
| 2839 | FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: | 2839 | FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: |
| 2840 | FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS:FUNCTION: | 2840 | FIPS_md5_allowed 3282 NOEXIST::FUNCTION: |
| 2841 | FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: | 2841 | FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: |
| 2842 | FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: | 2842 | FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: |
| 2843 | sk_is_sorted 3285 EXIST::FUNCTION: | 2843 | sk_is_sorted 3285 EXIST::FUNCTION: |
| @@ -2867,3 +2867,41 @@ PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
| 2867 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2867 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: | 2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: |
| 2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: | 2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: |
| 2870 | BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: | ||
| 2871 | FIPS_selftest_rng 3311 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2872 | EVP_sha384 3312 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2873 | EVP_sha512 3313 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2874 | EVP_sha224 3314 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2875 | EVP_sha256 3315 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2876 | FIPS_selftest_hmac 3316 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2877 | FIPS_corrupt_rng 3317 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2878 | BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: | ||
| 2879 | RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA | ||
| 2880 | RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA | ||
| 2881 | RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA | ||
| 2882 | RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA | ||
| 2883 | RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA | ||
| 2884 | PKCS1_MGF1 3324 EXIST::FUNCTION:RSA | ||
| 2885 | BN_X931_generate_Xpq 3325 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2886 | RSA_X931_generate_key 3326 EXIST:OPENSSL_FIPS:FUNCTION:RSA | ||
| 2887 | BN_X931_derive_prime 3327 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2888 | BN_X931_generate_prime 3328 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 2889 | RSA_X931_derive 3329 EXIST:OPENSSL_FIPS:FUNCTION:RSA | ||
| 2890 | SHA512_Update 3356 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2891 | SHA256_Init 3479 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2892 | SHA224 3510 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2893 | SHA384_Update 3551 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2894 | SHA224_Final 3560 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2895 | SHA224_Update 3562 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2896 | SHA512_Final 3581 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2897 | SHA224_Init 3631 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2898 | SHA512_Init 3633 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2899 | SHA256 3654 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2900 | SHA256_Transform 3664 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2901 | SHA512 3669 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2902 | SHA512_Transform 3675 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2903 | SHA256_Final 3712 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
| 2904 | SHA384_Init 3737 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2905 | SHA384_Final 3740 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2906 | SHA384 3745 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512 | ||
| 2907 | SHA256_Update 3765 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256 | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 957264c6b5..05a6086164 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
| @@ -10,6 +10,20 @@ $OPTIONS=""; | |||
| 10 | $ssl_version=""; | 10 | $ssl_version=""; |
| 11 | $banner="\t\@echo Building OpenSSL"; | 11 | $banner="\t\@echo Building OpenSSL"; |
| 12 | 12 | ||
| 13 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | ||
| 14 | local $zlib_lib = ""; | ||
| 15 | |||
| 16 | my $fips_canister_path = ""; | ||
| 17 | my $fips_premain_dso_exe_path = ""; | ||
| 18 | my $fips_premain_c_path = ""; | ||
| 19 | my $fips_sha1_exe_path = ""; | ||
| 20 | |||
| 21 | my $fipslibdir = ""; | ||
| 22 | my $baseaddr = ""; | ||
| 23 | |||
| 24 | my $ex_l_libs = ""; | ||
| 25 | |||
| 26 | |||
| 13 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 27 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
| 14 | while(<IN>) { | 28 | while(<IN>) { |
| 15 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 29 | $ssl_version=$1 if (/^VERSION=(.*)$/); |
| @@ -24,6 +38,7 @@ $infile="MINFO"; | |||
| 24 | 38 | ||
| 25 | %ops=( | 39 | %ops=( |
| 26 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | 40 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", |
| 41 | "VC-WIN32-GMAKE", "Microsoft Visual C++ [4-6] - Windows NT or 9X, GNU make", | ||
| 27 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | 42 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", |
| 28 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | 43 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", |
| 29 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | 44 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", |
| @@ -43,6 +58,7 @@ $infile="MINFO"; | |||
| 43 | ); | 58 | ); |
| 44 | 59 | ||
| 45 | $platform=""; | 60 | $platform=""; |
| 61 | my $xcflags=""; | ||
| 46 | foreach (@ARGV) | 62 | foreach (@ARGV) |
| 47 | { | 63 | { |
| 48 | if (!&read_options && !defined($ops{$_})) | 64 | if (!&read_options && !defined($ops{$_})) |
| @@ -104,8 +120,12 @@ $inc_def="outinc"; | |||
| 104 | $tmp_def="tmp"; | 120 | $tmp_def="tmp"; |
| 105 | 121 | ||
| 106 | $mkdir="-mkdir"; | 122 | $mkdir="-mkdir"; |
| 123 | $mkcanister="ld -r -o"; | ||
| 124 | |||
| 125 | $ex_build_targets = ""; | ||
| 107 | 126 | ||
| 108 | ($ssl,$crypto)=("ssl","crypto"); | 127 | ($ssl,$crypto)=("ssl","crypto"); |
| 128 | $cryptocompat = ""; | ||
| 109 | $ranlib="echo ranlib"; | 129 | $ranlib="echo ranlib"; |
| 110 | 130 | ||
| 111 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | 131 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; |
| @@ -140,6 +160,10 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) | |||
| 140 | $NT = 1 if $platform eq "VC-NT"; | 160 | $NT = 1 if $platform eq "VC-NT"; |
| 141 | require 'VC-32.pl'; | 161 | require 'VC-32.pl'; |
| 142 | } | 162 | } |
| 163 | elsif ($platform eq "VC-WIN32-GMAKE") | ||
| 164 | { | ||
| 165 | require 'VC-32-GMAKE.pl'; | ||
| 166 | } | ||
| 143 | elsif ($platform eq "VC-CE") | 167 | elsif ($platform eq "VC-CE") |
| 144 | { | 168 | { |
| 145 | require 'VC-CE.pl'; | 169 | require 'VC-CE.pl'; |
| @@ -210,6 +234,8 @@ $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | |||
| 210 | 234 | ||
| 211 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | 235 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); |
| 212 | 236 | ||
| 237 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
| 238 | |||
| 213 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | 239 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; |
| 214 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | 240 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; |
| 215 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | 241 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; |
| @@ -239,6 +265,9 @@ $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | |||
| 239 | $cflags.=" -DOPENSSL_FIPS" if $fips; | 265 | $cflags.=" -DOPENSSL_FIPS" if $fips; |
| 240 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 266 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
| 241 | 267 | ||
| 268 | $cflags.= " -DZLIB" if $zlib_opt; | ||
| 269 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
| 270 | |||
| 242 | ## if ($unix) | 271 | ## if ($unix) |
| 243 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | 272 | ## { $cflags="$c_flags" if ($c_flags ne ""); } |
| 244 | ##else | 273 | ##else |
| @@ -246,6 +275,7 @@ $cflags.=" -DOPENSSL_FIPS" if $fips; | |||
| 246 | 275 | ||
| 247 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 276 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
| 248 | 277 | ||
| 278 | |||
| 249 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | 279 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", |
| 250 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | 280 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); |
| 251 | 281 | ||
| @@ -262,6 +292,135 @@ $link="$bin_dir$link" if ($link !~ /^\$/); | |||
| 262 | 292 | ||
| 263 | $INSTALLTOP =~ s|/|$o|g; | 293 | $INSTALLTOP =~ s|/|$o|g; |
| 264 | 294 | ||
| 295 | ############################################# | ||
| 296 | # We parse in input file and 'store' info for later printing. | ||
| 297 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
| 298 | $_=<IN>; | ||
| 299 | for (;;) | ||
| 300 | { | ||
| 301 | chop; | ||
| 302 | |||
| 303 | ($key,$val)=/^([^=]+)=(.*)/; | ||
| 304 | if ($key eq "RELATIVE_DIRECTORY") | ||
| 305 | { | ||
| 306 | if ($lib ne "") | ||
| 307 | { | ||
| 308 | if ($fips && $dir =~ /^fips/) | ||
| 309 | { | ||
| 310 | $uc = "FIPS"; | ||
| 311 | } | ||
| 312 | else | ||
| 313 | { | ||
| 314 | $uc=$lib; | ||
| 315 | $uc =~ s/^lib(.*)\.a/$1/; | ||
| 316 | $uc =~ tr/a-z/A-Z/; | ||
| 317 | } | ||
| 318 | if (($uc ne "FIPS") || $fips_canister_build) | ||
| 319 | { | ||
| 320 | $lib_nam{$uc}=$uc; | ||
| 321 | $lib_obj{$uc}.=$libobj." "; | ||
| 322 | } | ||
| 323 | } | ||
| 324 | last if ($val eq "FINISHED"); | ||
| 325 | $lib=""; | ||
| 326 | $libobj=""; | ||
| 327 | $dir=$val; | ||
| 328 | } | ||
| 329 | |||
| 330 | if ($key eq "KRB5_INCLUDES") | ||
| 331 | { $cflags .= " $val";} | ||
| 332 | |||
| 333 | if ($key eq "ZLIB_INCLUDE") | ||
| 334 | { $cflags .= " $val" if $val ne "";} | ||
| 335 | |||
| 336 | if ($key eq "LIBZLIB") | ||
| 337 | { $zlib_lib = "$val" if $val ne "";} | ||
| 338 | |||
| 339 | if ($key eq "LIBKRB5") | ||
| 340 | { $ex_libs .= " $val" if $val ne "";} | ||
| 341 | |||
| 342 | if ($key eq "TEST") | ||
| 343 | { $test.=&var_add($dir,$val); } | ||
| 344 | |||
| 345 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
| 346 | { $e_exe.=&var_add($dir,$val); } | ||
| 347 | |||
| 348 | if ($key eq "LIB") | ||
| 349 | { | ||
| 350 | $lib=$val; | ||
| 351 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
| 352 | } | ||
| 353 | |||
| 354 | if ($key eq "EXHEADER") | ||
| 355 | { $exheader.=&var_add($dir,$val); } | ||
| 356 | |||
| 357 | if ($key eq "HEADER") | ||
| 358 | { $header.=&var_add($dir,$val); } | ||
| 359 | |||
| 360 | if ($key eq "LIBOBJ") | ||
| 361 | { $libobj=&var_add($dir,$val); } | ||
| 362 | |||
| 363 | if ($key eq "FIPSLIBDIR") | ||
| 364 | { $fipslibdir=$val;} | ||
| 365 | |||
| 366 | if ($key eq "BASEADDR") | ||
| 367 | { $baseaddr=$val;} | ||
| 368 | |||
| 369 | if (!($_=<IN>)) | ||
| 370 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
| 371 | } | ||
| 372 | close(IN); | ||
| 373 | |||
| 374 | if ($fips_canister_path eq "") | ||
| 375 | { | ||
| 376 | $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.o"; | ||
| 377 | } | ||
| 378 | |||
| 379 | if ($fips_premain_c_path eq "") | ||
| 380 | { | ||
| 381 | $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; | ||
| 382 | } | ||
| 383 | |||
| 384 | if ($fips) | ||
| 385 | { | ||
| 386 | if ($fips_sha1_exe_path eq "") | ||
| 387 | { | ||
| 388 | $fips_sha1_exe_path = | ||
| 389 | "\$(BIN_D)${o}fips_standalone_sha1$exep"; | ||
| 390 | } | ||
| 391 | } | ||
| 392 | else | ||
| 393 | { | ||
| 394 | $fips_sha1_exe_path = ""; | ||
| 395 | } | ||
| 396 | |||
| 397 | if ($fips_premain_dso_exe_path eq "") | ||
| 398 | { | ||
| 399 | $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep"; | ||
| 400 | } | ||
| 401 | |||
| 402 | # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips); | ||
| 403 | |||
| 404 | if ($fips) | ||
| 405 | { | ||
| 406 | if (!$shlib) | ||
| 407 | { | ||
| 408 | $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
| 409 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
| 410 | } | ||
| 411 | if ($fipslibdir eq "") | ||
| 412 | { | ||
| 413 | open (IN, "util/fipslib_path.txt") || fipslib_error(); | ||
| 414 | $fipslibdir = <IN>; | ||
| 415 | chomp $fipslibdir; | ||
| 416 | close IN; | ||
| 417 | } | ||
| 418 | fips_check_files($fipslibdir, | ||
| 419 | "fipscanister.o", "fipscanister.o.sha1", | ||
| 420 | "fips_premain.c", "fips_premain.c.sha1"); | ||
| 421 | } | ||
| 422 | |||
| 423 | |||
| 265 | $defs= <<"EOF"; | 424 | $defs= <<"EOF"; |
| 266 | # This makefile has been automatically generated from the OpenSSL distribution. | 425 | # This makefile has been automatically generated from the OpenSSL distribution. |
| 267 | # This single makefile will build the complete OpenSSL distribution and | 426 | # This single makefile will build the complete OpenSSL distribution and |
| @@ -286,6 +445,7 @@ if ($platform eq "VC-CE") | |||
| 286 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> | 445 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> |
| 287 | 446 | ||
| 288 | EOF | 447 | EOF |
| 448 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
| 289 | } | 449 | } |
| 290 | 450 | ||
| 291 | $defs.= <<"EOF"; | 451 | $defs.= <<"EOF"; |
| @@ -308,6 +468,8 @@ EX_LIBS=$ex_libs | |||
| 308 | SRC_D=$src_dir | 468 | SRC_D=$src_dir |
| 309 | 469 | ||
| 310 | LINK=$link | 470 | LINK=$link |
| 471 | PERL=perl | ||
| 472 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
| 311 | LFLAGS=$lflags | 473 | LFLAGS=$lflags |
| 312 | 474 | ||
| 313 | BN_ASM_OBJ=$bn_asm_obj | 475 | BN_ASM_OBJ=$bn_asm_obj |
| @@ -339,6 +501,9 @@ TMP_D=$tmp_dir | |||
| 339 | INC_D=$inc_dir | 501 | INC_D=$inc_dir |
| 340 | INCO_D=$inc_dir${o}openssl | 502 | INCO_D=$inc_dir${o}openssl |
| 341 | 503 | ||
| 504 | # Directory containing FIPS module | ||
| 505 | |||
| 506 | |||
| 342 | CP=$cp | 507 | CP=$cp |
| 343 | RM=$rm | 508 | RM=$rm |
| 344 | RANLIB=$ranlib | 509 | RANLIB=$ranlib |
| @@ -346,6 +511,18 @@ MKDIR=$mkdir | |||
| 346 | MKLIB=$bin_dir$mklib | 511 | MKLIB=$bin_dir$mklib |
| 347 | MLFLAGS=$mlflags | 512 | MLFLAGS=$mlflags |
| 348 | ASM=$bin_dir$asm | 513 | ASM=$bin_dir$asm |
| 514 | MKCANISTER=$mkcanister | ||
| 515 | |||
| 516 | # FIPS validated module and support file locations | ||
| 517 | |||
| 518 | E_PREMAIN_DSO=fips_premain_dso | ||
| 519 | |||
| 520 | FIPSLIB_D=$fipslibdir | ||
| 521 | BASEADDR=$baseaddr | ||
| 522 | FIPS_PREMAIN_SRC=$fips_premain_c_path | ||
| 523 | O_FIPSCANISTER=$fips_canister_path | ||
| 524 | FIPS_SHA1_EXE=$fips_sha1_exe_path | ||
| 525 | PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | ||
| 349 | 526 | ||
| 350 | ###################################################### | 527 | ###################################################### |
| 351 | # You should not need to touch anything below this point | 528 | # You should not need to touch anything below this point |
| @@ -377,7 +554,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | |||
| 377 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 554 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
| 378 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 555 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
| 379 | 556 | ||
| 380 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) | 557 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs |
| 381 | 558 | ||
| 382 | ###################################################### | 559 | ###################################################### |
| 383 | # Don't touch anything below this point | 560 | # Don't touch anything below this point |
| @@ -387,13 +564,13 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
| 387 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 564 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
| 388 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 565 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
| 389 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 566 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
| 390 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) | 567 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep |
| 391 | 568 | ||
| 392 | ############################################# | 569 | ############################################# |
| 393 | EOF | 570 | EOF |
| 394 | 571 | ||
| 395 | $rules=<<"EOF"; | 572 | $rules=<<"EOF"; |
| 396 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe | 573 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets |
| 397 | 574 | ||
| 398 | banner: | 575 | banner: |
| 399 | $banner | 576 | $banner |
| @@ -479,57 +656,6 @@ printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | |||
| 479 | printf OUT "#endif\n"; | 656 | printf OUT "#endif\n"; |
| 480 | close(OUT); | 657 | close(OUT); |
| 481 | 658 | ||
| 482 | ############################################# | ||
| 483 | # We parse in input file and 'store' info for later printing. | ||
| 484 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
| 485 | $_=<IN>; | ||
| 486 | for (;;) | ||
| 487 | { | ||
| 488 | chop; | ||
| 489 | |||
| 490 | ($key,$val)=/^([^=]+)=(.*)/; | ||
| 491 | if ($key eq "RELATIVE_DIRECTORY") | ||
| 492 | { | ||
| 493 | if ($lib ne "") | ||
| 494 | { | ||
| 495 | $uc=$lib; | ||
| 496 | $uc =~ s/^lib(.*)\.a/$1/; | ||
| 497 | $uc =~ tr/a-z/A-Z/; | ||
| 498 | $lib_nam{$uc}=$uc; | ||
| 499 | $lib_obj{$uc}.=$libobj." "; | ||
| 500 | } | ||
| 501 | last if ($val eq "FINISHED"); | ||
| 502 | $lib=""; | ||
| 503 | $libobj=""; | ||
| 504 | $dir=$val; | ||
| 505 | } | ||
| 506 | |||
| 507 | if ($key eq "TEST") | ||
| 508 | { $test.=&var_add($dir,$val); } | ||
| 509 | |||
| 510 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
| 511 | { $e_exe.=&var_add($dir,$val); } | ||
| 512 | |||
| 513 | if ($key eq "LIB") | ||
| 514 | { | ||
| 515 | $lib=$val; | ||
| 516 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
| 517 | } | ||
| 518 | |||
| 519 | if ($key eq "EXHEADER") | ||
| 520 | { $exheader.=&var_add($dir,$val); } | ||
| 521 | |||
| 522 | if ($key eq "HEADER") | ||
| 523 | { $header.=&var_add($dir,$val); } | ||
| 524 | |||
| 525 | if ($key eq "LIBOBJ") | ||
| 526 | { $libobj=&var_add($dir,$val); } | ||
| 527 | |||
| 528 | if (!($_=<IN>)) | ||
| 529 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
| 530 | } | ||
| 531 | close(IN); | ||
| 532 | |||
| 533 | # Strip of trailing ' ' | 659 | # Strip of trailing ' ' |
| 534 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | 660 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } |
| 535 | $test=&clean_up_ws($test); | 661 | $test=&clean_up_ws($test); |
| @@ -554,6 +680,29 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
| 554 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 680 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
| 555 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 681 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
| 556 | 682 | ||
| 683 | # Special case rules for fips_start and fips_end fips_premain_dso | ||
| 684 | |||
| 685 | if ($fips) | ||
| 686 | { | ||
| 687 | if ($fips_canister_build) | ||
| 688 | { | ||
| 689 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", | ||
| 690 | "fips-1.0${o}fips_canister.c", | ||
| 691 | "-DFIPS_START \$(SHLIB_CFLAGS)"); | ||
| 692 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj", | ||
| 693 | "fips-1.0${o}fips_canister.c", "\$(SHLIB_CFLAGS)"); | ||
| 694 | } | ||
| 695 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj", | ||
| 696 | "fips-1.0${o}sha${o}fips_standalone_sha1.c", | ||
| 697 | "\$(SHLIB_CFLAGS)"); | ||
| 698 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_sha1dgst$obj", | ||
| 699 | "fips-1.0${o}sha${o}fips_sha1dgst.c", | ||
| 700 | "\$(SHLIB_CFLAGS)") unless $fips_canister_build; | ||
| 701 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
| 702 | "fips-1.0${o}fips_premain.c", | ||
| 703 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); | ||
| 704 | } | ||
| 705 | |||
| 557 | foreach (values %lib_nam) | 706 | foreach (values %lib_nam) |
| 558 | { | 707 | { |
| 559 | $lib_obj=$lib_obj{$_}; | 708 | $lib_obj=$lib_obj{$_}; |
| @@ -630,16 +779,42 @@ foreach (split(/\s+/,$test)) | |||
| 630 | } | 779 | } |
| 631 | 780 | ||
| 632 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 781 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
| 633 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | 782 | |
| 634 | 783 | ||
| 635 | if ($fips) | 784 | if ($fips) |
| 636 | { | 785 | { |
| 637 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep"); | 786 | if ($shlib) |
| 787 | { | ||
| 788 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
| 789 | "\$(O_CRYPTO)", | ||
| 790 | "$crypto", | ||
| 791 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
| 792 | } | ||
| 793 | else | ||
| 794 | { | ||
| 795 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
| 796 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
| 797 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
| 798 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
| 799 | } | ||
| 638 | } | 800 | } |
| 639 | else | 801 | else |
| 640 | { | 802 | { |
| 641 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | 803 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, |
| 804 | "\$(SO_CRYPTO)"); | ||
| 642 | } | 805 | } |
| 806 | |||
| 807 | |||
| 808 | if ($fips) | ||
| 809 | { | ||
| 810 | $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; | ||
| 811 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
| 812 | |||
| 813 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)","\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}fips_sha1dgst$obj","","", 1); | ||
| 814 | } | ||
| 815 | |||
| 816 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0); | ||
| 817 | |||
| 643 | print $defs; | 818 | print $defs; |
| 644 | 819 | ||
| 645 | if ($platform eq "linux-elf") { | 820 | if ($platform eq "linux-elf") { |
| @@ -935,6 +1110,24 @@ sub read_options | |||
| 935 | elsif (/^shlib$/) { $shlib=1; } | 1110 | elsif (/^shlib$/) { $shlib=1; } |
| 936 | elsif (/^dll$/) { $shlib=1; } | 1111 | elsif (/^dll$/) { $shlib=1; } |
| 937 | elsif (/^shared$/) { } # We just need to ignore it for now... | 1112 | elsif (/^shared$/) { } # We just need to ignore it for now... |
| 1113 | elsif (/^zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
| 1114 | elsif (/^zlib-dynamic$/){ $zlib_opt = 2; } | ||
| 1115 | elsif (/^--with-krb5-flavor=(.*)$/) | ||
| 1116 | { | ||
| 1117 | my $krb5_flavor = $1; | ||
| 1118 | if ($krb5_flavor =~ /^force-[Hh]eimdal$/) | ||
| 1119 | { | ||
| 1120 | $xcflags="-DKRB5_HEIMDAL $xcflags"; | ||
| 1121 | } | ||
| 1122 | elsif ($krb5_flavor =~ /^MIT/i) | ||
| 1123 | { | ||
| 1124 | $xcflags="-DKRB5_MIT $xcflags"; | ||
| 1125 | if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) | ||
| 1126 | { | ||
| 1127 | $xcflags="-DKRB5_MIT_OLD11 $xcflags" | ||
| 1128 | } | ||
| 1129 | } | ||
| 1130 | } | ||
| 938 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | 1131 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } |
| 939 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | 1132 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } |
| 940 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | 1133 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) |
| @@ -942,3 +1135,31 @@ sub read_options | |||
| 942 | else { return(0); } | 1135 | else { return(0); } |
| 943 | return(1); | 1136 | return(1); |
| 944 | } | 1137 | } |
| 1138 | |||
| 1139 | sub fipslib_error | ||
| 1140 | { | ||
| 1141 | print STDERR "***FIPS module directory sanity check failed***\n"; | ||
| 1142 | print STDERR "FIPS module build failed, or was deleted\n"; | ||
| 1143 | print STDERR "Please rebuild FIPS module.\n"; | ||
| 1144 | exit 1; | ||
| 1145 | } | ||
| 1146 | |||
| 1147 | sub fips_check_files | ||
| 1148 | { | ||
| 1149 | my $dir = shift @_; | ||
| 1150 | my $ret = 1; | ||
| 1151 | if (!-d $dir) | ||
| 1152 | { | ||
| 1153 | print STDERR "FIPS module directory $dir does not exist\n"; | ||
| 1154 | fipslib_error(); | ||
| 1155 | } | ||
| 1156 | foreach (@_) | ||
| 1157 | { | ||
| 1158 | if (!-f "$dir${o}$_") | ||
| 1159 | { | ||
| 1160 | print STDERR "FIPS module file $_ does not exist!\n"; | ||
| 1161 | $ret = 0; | ||
| 1162 | } | ||
| 1163 | } | ||
| 1164 | fipslib_error() if ($ret == 0); | ||
| 1165 | } | ||
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index 9918c3d549..6c1e53bb14 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
| @@ -83,7 +83,7 @@ my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | |||
| 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); |
| 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", |
| 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", |
| 86 | "RIPEMD", | 86 | "SHA256", "SHA512", "RIPEMD", |
| 87 | "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES", | 87 | "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES", |
| 88 | # Envelope "algorithms" | 88 | # Envelope "algorithms" |
| 89 | "EVP", "X509", "ASN1_TYPEDEFS", | 89 | "EVP", "X509", "ASN1_TYPEDEFS", |
| @@ -267,7 +267,7 @@ $crypto.=" crypto/ocsp/ocsp.h"; | |||
| 267 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | 267 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; |
| 268 | $crypto.=" crypto/krb5/krb5_asn.h"; | 268 | $crypto.=" crypto/krb5/krb5_asn.h"; |
| 269 | $crypto.=" crypto/tmdiff.h"; | 269 | $crypto.=" crypto/tmdiff.h"; |
| 270 | $crypto.=" fips/fips.h fips/rand/fips_rand.h"; | 270 | $crypto.=" fips-1.0/fips.h fips-1.0/rand/fips_rand.h fips-1.0/sha/fips_sha.h"; |
| 271 | 271 | ||
| 272 | my $symhacks="crypto/symhacks.h"; | 272 | my $symhacks="crypto/symhacks.h"; |
| 273 | 273 | ||
| @@ -864,6 +864,9 @@ sub do_defs | |||
| 864 | $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); | 864 | $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); |
| 865 | $a .= ",RSA" if($s =~ /RSAPrivateKey/); | 865 | $a .= ",RSA" if($s =~ /RSAPrivateKey/); |
| 866 | $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); | 866 | $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); |
| 867 | # SHA2 algorithms only defined in FIPS mode for | ||
| 868 | # OpenSSL 0.9.7 | ||
| 869 | $p .= "OPENSSL_FIPS" if($s =~ /SHA[235]/); | ||
| 867 | 870 | ||
| 868 | $platform{$s} = | 871 | $platform{$s} = |
| 869 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | 872 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); |
| @@ -1011,7 +1014,7 @@ sub is_valid | |||
| 1011 | { | 1014 | { |
| 1012 | my ($keywords_txt,$platforms) = @_; | 1015 | my ($keywords_txt,$platforms) = @_; |
| 1013 | my (@keywords) = split /,/,$keywords_txt; | 1016 | my (@keywords) = split /,/,$keywords_txt; |
| 1014 | my ($falsesum, $truesum) = (0, !grep(/^[^!]/,@keywords)); | 1017 | my ($falsesum, $truesum) = (0, 1); |
| 1015 | 1018 | ||
| 1016 | # Param: one keyword | 1019 | # Param: one keyword |
| 1017 | sub recognise | 1020 | sub recognise |
| @@ -1079,7 +1082,7 @@ sub is_valid | |||
| 1079 | if ($k =~ /^!(.*)$/) { | 1082 | if ($k =~ /^!(.*)$/) { |
| 1080 | $falsesum += &recognise($1,$platforms); | 1083 | $falsesum += &recognise($1,$platforms); |
| 1081 | } else { | 1084 | } else { |
| 1082 | $truesum += &recognise($k,$platforms); | 1085 | $truesum *= &recognise($k,$platforms); |
| 1083 | } | 1086 | } |
| 1084 | } | 1087 | } |
| 1085 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; | 1088 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; |
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl index 928a274303..bc78510f56 100644 --- a/src/lib/libcrypto/util/mkfiles.pl +++ b/src/lib/libcrypto/util/mkfiles.pl | |||
| @@ -51,14 +51,15 @@ my @dirs = ( | |||
| 51 | "crypto/ocsp", | 51 | "crypto/ocsp", |
| 52 | "crypto/ui", | 52 | "crypto/ui", |
| 53 | "crypto/krb5", | 53 | "crypto/krb5", |
| 54 | "fips", | 54 | "fips-1.0", |
| 55 | "fips/aes", | 55 | "fips-1.0/aes", |
| 56 | "fips/des", | 56 | "fips-1.0/des", |
| 57 | "fips/dsa", | 57 | "fips-1.0/dsa", |
| 58 | "fips/dh", | 58 | "fips-1.0/dh", |
| 59 | "fips/rand", | 59 | "fips-1.0/hmac", |
| 60 | "fips/rsa", | 60 | "fips-1.0/rand", |
| 61 | "fips/sha1", | 61 | "fips-1.0/rsa", |
| 62 | "fips-1.0/sha", | ||
| 62 | "ssl", | 63 | "ssl", |
| 63 | "apps", | 64 | "apps", |
| 64 | "test", | 65 | "test", |
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl index c8653cecc3..182732d959 100644 --- a/src/lib/libcrypto/util/mklink.pl +++ b/src/lib/libcrypto/util/mklink.pl | |||
| @@ -14,13 +14,16 @@ | |||
| 14 | # not contain symbolic links and that the parent of / is never referenced. | 14 | # not contain symbolic links and that the parent of / is never referenced. |
| 15 | # Apart from this, this script should be able to handle even the most | 15 | # Apart from this, this script should be able to handle even the most |
| 16 | # pathological cases. | 16 | # pathological cases. |
| 17 | # | ||
| 18 | |||
| 19 | use Cwd; | ||
| 17 | 20 | ||
| 18 | my $from = shift; | 21 | my $from = shift; |
| 19 | my @files = @ARGV; | 22 | my @files = @ARGV; |
| 20 | 23 | ||
| 21 | my @from_path = split(/[\\\/]/, $from); | 24 | my @from_path = split(/[\\\/]/, $from); |
| 22 | my $pwd = `pwd`; | 25 | my $pwd = getcwd(); |
| 23 | chop($pwd); | 26 | chomp($pwd); |
| 24 | my @pwd_path = split(/[\\\/]/, $pwd); | 27 | my @pwd_path = split(/[\\\/]/, $pwd); |
| 25 | 28 | ||
| 26 | my @to_path = (); | 29 | my @to_path = (); |
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index 897ae9d824..28869c868d 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
| @@ -18,7 +18,7 @@ $out_def="out32"; | |||
| 18 | $tmp_def="tmp32"; | 18 | $tmp_def="tmp32"; |
| 19 | $inc_def="inc32"; | 19 | $inc_def="inc32"; |
| 20 | #enable max error messages, disable most common warnings | 20 | #enable max error messages, disable most common warnings |
| 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp "; | 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp "; |
| 22 | if ($debug) | 22 | if ($debug) |
| 23 | { | 23 | { |
| 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; | 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; |
| @@ -51,7 +51,7 @@ $lfile=''; | |||
| 51 | $shlib_ex_obj=""; | 51 | $shlib_ex_obj=""; |
| 52 | $app_ex_obj="c0x32.obj"; | 52 | $app_ex_obj="c0x32.obj"; |
| 53 | 53 | ||
| 54 | $asm='nasmw -f obj'; | 54 | $asm='nasmw -f obj -d__omf__'; |
| 55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" /Zi" if $debug; |
| 56 | $afile='-o'; | 56 | $afile='-o'; |
| 57 | 57 | ||
| @@ -106,9 +106,13 @@ sub do_lib_rule | |||
| 106 | $ret.="$target: $objs\n"; | 106 | $ret.="$target: $objs\n"; |
| 107 | if (!$shlib) | 107 | if (!$shlib) |
| 108 | { | 108 | { |
| 109 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | 109 | $ret.=<<___; |
| 110 | $ret.="\techo LIB $<\n"; | 110 | -\$(RM) $lfile$target |
| 111 | $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n"; | 111 | \$(MKLIB) $lfile$target \@&&! |
| 112 | +\$(**: = &^ | ||
| 113 | +) | ||
| 114 | ! | ||
| 115 | ___ | ||
| 112 | } | 116 | } |
| 113 | else | 117 | else |
| 114 | { | 118 | { |
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl index 75d72ebbcb..8dbeaa7a08 100644 --- a/src/lib/libcrypto/util/pl/OS2-EMX.pl +++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl | |||
| @@ -68,6 +68,7 @@ if (!$no_asm && !$fips) | |||
| 68 | $sha1_asm_src="crypto/sha/asm/s1-os2.asm"; | 68 | $sha1_asm_src="crypto/sha/asm/s1-os2.asm"; |
| 69 | $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj"; | 69 | $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj"; |
| 70 | $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm"; | 70 | $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm"; |
| 71 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | if ($shlib) | 74 | if ($shlib) |
diff --git a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl new file mode 100644 index 0000000000..b5bbcac6c2 --- /dev/null +++ b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries | ||
| 3 | # | ||
| 4 | |||
| 5 | |||
| 6 | if ($fips && !$shlib) | ||
| 7 | { | ||
| 8 | $crypto="libeayfips32"; | ||
| 9 | $crypto_compat = "libeaycompat32.lib"; | ||
| 10 | } | ||
| 11 | else | ||
| 12 | { | ||
| 13 | $crypto="libeay32"; | ||
| 14 | } | ||
| 15 | $ssl= "ssleay32"; | ||
| 16 | |||
| 17 | $o='/'; | ||
| 18 | #$cp='copy nul+'; # Timestamps get stuffed otherwise | ||
| 19 | #$rm='del'; | ||
| 20 | |||
| 21 | $cp='cp'; | ||
| 22 | $rm='rm'; | ||
| 23 | |||
| 24 | $zlib_lib="zlib1.lib"; | ||
| 25 | |||
| 26 | # C compiler stuff | ||
| 27 | $cc='cl'; | ||
| 28 | $cflags=' -MD -W3 -WX -Ox -O2 -Ob2 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | ||
| 29 | $cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | ||
| 30 | $cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
| 31 | $lflags="-nologo -subsystem:console -machine:I386 -opt:ref"; | ||
| 32 | $mlflags=''; | ||
| 33 | |||
| 34 | $out_def="gmout32"; | ||
| 35 | $tmp_def="gmtmp32"; | ||
| 36 | $inc_def="gminc32"; | ||
| 37 | |||
| 38 | if ($debug) | ||
| 39 | { | ||
| 40 | $cflags=" -MDd -W3 -WX -Zi -Yd -Od -nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
| 41 | $lflags.=" -debug"; | ||
| 42 | $mlflags.=' -debug'; | ||
| 43 | } | ||
| 44 | $cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1; | ||
| 45 | |||
| 46 | $obj='.obj'; | ||
| 47 | $ofile="-Fo"; | ||
| 48 | |||
| 49 | # EXE linking stuff | ||
| 50 | $link="link"; | ||
| 51 | $efile="-out:"; | ||
| 52 | $exep='.exe'; | ||
| 53 | if ($no_sock) | ||
| 54 | { $ex_libs=""; } | ||
| 55 | else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; } | ||
| 56 | |||
| 57 | # static library stuff | ||
| 58 | $mklib='lib'; | ||
| 59 | $ranlib=''; | ||
| 60 | $plib=""; | ||
| 61 | $libp=".lib"; | ||
| 62 | $shlibp=($shlib)?".dll":".lib"; | ||
| 63 | $lfile='-out:'; | ||
| 64 | |||
| 65 | $shlib_ex_obj=""; | ||
| 66 | $app_ex_obj="setargv.obj"; | ||
| 67 | if ($nasm) { | ||
| 68 | $asm='nasmw -f win32'; | ||
| 69 | $afile='-o '; | ||
| 70 | } else { | ||
| 71 | $asm='ml -Cp -coff -c -Cx'; | ||
| 72 | $asm.=" -Zi" if $debug; | ||
| 73 | $afile='-Fo'; | ||
| 74 | } | ||
| 75 | |||
| 76 | $bn_asm_obj=''; | ||
| 77 | $bn_asm_src=''; | ||
| 78 | $des_enc_obj=''; | ||
| 79 | $des_enc_src=''; | ||
| 80 | $bf_enc_obj=''; | ||
| 81 | $bf_enc_src=''; | ||
| 82 | |||
| 83 | if (!$no_asm && !$fips) | ||
| 84 | { | ||
| 85 | $bn_asm_obj='crypto/bn/asm/bn_win32.obj'; | ||
| 86 | $bn_asm_src='crypto/bn/asm/bn_win32.asm'; | ||
| 87 | $des_enc_obj='crypto/des/asm/d_win32.obj crypto/des/asm/y_win32.obj'; | ||
| 88 | $des_enc_src='crypto/des/asm/d_win32.asm crypto/des/asm/y_win32.asm'; | ||
| 89 | $bf_enc_obj='crypto/bf/asm/b_win32.obj'; | ||
| 90 | $bf_enc_src='crypto/bf/asm/b_win32.asm'; | ||
| 91 | $cast_enc_obj='crypto/cast/asm/c_win32.obj'; | ||
| 92 | $cast_enc_src='crypto/cast/asm/c_win32.asm'; | ||
| 93 | $rc4_enc_obj='crypto/rc4/asm/r4_win32.obj'; | ||
| 94 | $rc4_enc_src='crypto/rc4/asm/r4_win32.asm'; | ||
| 95 | $rc5_enc_obj='crypto/rc5/asm/r5_win32.obj'; | ||
| 96 | $rc5_enc_src='crypto/rc5/asm/r5_win32.asm'; | ||
| 97 | $md5_asm_obj='crypto/md5/asm/m5_win32.obj'; | ||
| 98 | $md5_asm_src='crypto/md5/asm/m5_win32.asm'; | ||
| 99 | $sha1_asm_obj='crypto/sha/asm/s1_win32.obj'; | ||
| 100 | $sha1_asm_src='crypto/sha/asm/s1_win32.asm'; | ||
| 101 | $rmd160_asm_obj='crypto/ripemd/asm/rm_win32.obj'; | ||
| 102 | $rmd160_asm_src='crypto/ripemd/asm/rm_win32.asm'; | ||
| 103 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; | ||
| 104 | } | ||
| 105 | |||
| 106 | if ($shlib) | ||
| 107 | { | ||
| 108 | $mlflags.=" $lflags -dll"; | ||
| 109 | # $cflags =~ s| -MD| -MT|; | ||
| 110 | $lib_cflag=" -D_WINDLL"; | ||
| 111 | $out_def="gmout32dll"; | ||
| 112 | $tmp_def="gmtmp32dll"; | ||
| 113 | } | ||
| 114 | |||
| 115 | $cflags.=" -Fd$out_def"; | ||
| 116 | |||
| 117 | sub do_lib_rule | ||
| 118 | { | ||
| 119 | local($objs,$target,$name,$shlib,$ign,$base_addr, $fips_get_sig, $fips_premain_src)=@_; | ||
| 120 | local($ret,$Name); | ||
| 121 | |||
| 122 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 123 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 124 | my $base_arg; | ||
| 125 | if ($base_addr ne "") | ||
| 126 | { | ||
| 127 | $base_arg= " -base:$base_addr"; | ||
| 128 | } | ||
| 129 | else | ||
| 130 | { | ||
| 131 | $base_arg = ""; | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | # $target="\$(LIB_D)$o$target"; | ||
| 136 | if (!$shlib) | ||
| 137 | { | ||
| 138 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 139 | $ret.="$target: $objs\n"; | ||
| 140 | $ex =' advapi32.lib'; | ||
| 141 | $ret.="\t\$(MKLIB) $lfile$target $objs $ex\n\n"; | ||
| 142 | } | ||
| 143 | else | ||
| 144 | { | ||
| 145 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
| 146 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; | ||
| 147 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | ||
| 148 | if (defined $fips_get_sig) | ||
| 149 | { | ||
| 150 | $ret.="$target: \$(O_FIPSCANISTER) $objs $fips_get_sig\n"; | ||
| 151 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
| 152 | $ret.="FIPS_CC=\$(CC) "; | ||
| 153 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
| 154 | $ret.="FIPS_PREMAIN_DSO=$fips_get_sig "; | ||
| 155 | $ret.="FIPS_TARGET=$target "; | ||
| 156 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
| 157 | $ret.="\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target "; | ||
| 158 | $ret.="-def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs "; | ||
| 159 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n\n"; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | $ret.="$target: $objs\n"; | ||
| 164 | $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs $ex\n\n"; | ||
| 165 | } | ||
| 166 | } | ||
| 167 | $ret.="\n"; | ||
| 168 | return($ret); | ||
| 169 | } | ||
| 170 | |||
| 171 | sub do_link_rule | ||
| 172 | { | ||
| 173 | local($target,$files,$dep_libs,$libs,$standalone)=@_; | ||
| 174 | local($ret,$_); | ||
| 175 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 176 | $n=&bname($targer); | ||
| 177 | if ($standalone) | ||
| 178 | { | ||
| 179 | $ret.="$target: $files $dep_libs\n"; | ||
| 180 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
| 181 | $ret.="$files $libs\n\n"; | ||
| 182 | } | ||
| 183 | elsif ($fips && !$shlib) | ||
| 184 | { | ||
| 185 | $ret.="$target: \$(O_FIPSCANISTER) $files $dep_libs\n"; | ||
| 186 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
| 187 | $ret.="FIPS_CC=\$(CC) "; | ||
| 188 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
| 189 | $ret.="FIPS_PREMAIN_DSO= "; | ||
| 190 | $ret.="FIPS_TARGET=$target "; | ||
| 191 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
| 192 | $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target "; | ||
| 193 | $ret.="\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n\n"; | ||
| 194 | } | ||
| 195 | else | ||
| 196 | { | ||
| 197 | $ret.="$target: $files $dep_libs\n"; | ||
| 198 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
| 199 | $ret.="\$(APP_EX_OBJ) $files $libs\n\n"; | ||
| 200 | } | ||
| 201 | $ret.="\n"; | ||
| 202 | return($ret); | ||
| 203 | } | ||
| 204 | |||
| 205 | sub do_rlink_rule | ||
| 206 | { | ||
| 207 | local($target,$files,$check_hash, $deps)=@_; | ||
| 208 | local($ret,$_); | ||
| 209 | |||
| 210 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 211 | $n=&bname($targer); | ||
| 212 | $ret.="$target: $check_hash $files $deps\n"; | ||
| 213 | $ret.="\t\$(PERL) util${o}checkhash.pl -chdir fips-1.0 -program_path ..$o$check_hash\n"; | ||
| 214 | $ret.="\t\$(MKCANISTER) $target $files\n"; | ||
| 215 | $ret.="\t$check_hash $target > $target.sha1\n"; | ||
| 216 | $ret.="\t\$(CP) fips-1.0${o}fips_premain.c \$(FIPSLIB_D)\n"; | ||
| 217 | $ret.="\t$check_hash \$(FIPSLIB_D)${o}fips_premain.c > \$(FIPSLIB_D)${o}fips_premain.c.sha1\n\n"; | ||
| 218 | return($ret); | ||
| 219 | } | ||
| 220 | |||
| 221 | |||
| 222 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index cf689b9feb..4e97dfa9af 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
| @@ -3,15 +3,28 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | $ssl= "ssleay32"; | 5 | $ssl= "ssleay32"; |
| 6 | $crypto="libeay32"; | 6 | |
| 7 | if ($fips && !$shlib) | ||
| 8 | { | ||
| 9 | $crypto="libeayfips32"; | ||
| 10 | $crypto_compat = "libeaycompat32.lib"; | ||
| 11 | } | ||
| 12 | else | ||
| 13 | { | ||
| 14 | $crypto="libeay32"; | ||
| 15 | } | ||
| 7 | 16 | ||
| 8 | $o='\\'; | 17 | $o='\\'; |
| 9 | $cp='copy nul+'; # Timestamps get stuffed otherwise | 18 | $cp='copy nul+'; # Timestamps get stuffed otherwise |
| 10 | $rm='del'; | 19 | $rm='del'; |
| 11 | 20 | ||
| 21 | $zlib_lib="zlib1.lib"; | ||
| 22 | |||
| 12 | # C compiler stuff | 23 | # C compiler stuff |
| 13 | $cc='cl'; | 24 | $cc='cl'; |
| 14 | $cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | 25 | $cflags=' /MD /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; |
| 26 | $cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | ||
| 27 | $cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
| 15 | $lflags="/nologo /subsystem:console /machine:I386 /opt:ref"; | 28 | $lflags="/nologo /subsystem:console /machine:I386 /opt:ref"; |
| 16 | $mlflags=''; | 29 | $mlflags=''; |
| 17 | 30 | ||
| @@ -100,25 +113,56 @@ $cflags.=" /Fd$out_def"; | |||
| 100 | 113 | ||
| 101 | sub do_lib_rule | 114 | sub do_lib_rule |
| 102 | { | 115 | { |
| 103 | local($objs,$target,$name,$shlib)=@_; | 116 | local($objs,$target,$name,$shlib,$ign,$base_addr) = @_; |
| 104 | local($ret,$Name); | 117 | local($ret,$Name); |
| 105 | 118 | ||
| 106 | $taget =~ s/\//$o/g if $o ne '/'; | 119 | $taget =~ s/\//$o/g if $o ne '/'; |
| 107 | ($Name=$name) =~ tr/a-z/A-Z/; | 120 | ($Name=$name) =~ tr/a-z/A-Z/; |
| 121 | my $base_arg; | ||
| 122 | if ($base_addr ne "") | ||
| 123 | { | ||
| 124 | $base_arg= " /base:$base_addr"; | ||
| 125 | } | ||
| 126 | else | ||
| 127 | { | ||
| 128 | $base_arg = ""; | ||
| 129 | } | ||
| 130 | |||
| 108 | 131 | ||
| 109 | # $target="\$(LIB_D)$o$target"; | 132 | # $target="\$(LIB_D)$o$target"; |
| 110 | $ret.="$target: $objs\n"; | ||
| 111 | if (!$shlib) | 133 | if (!$shlib) |
| 112 | { | 134 | { |
| 113 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | 135 | # $ret.="\t\$(RM) \$(O_$Name)\n"; |
| 136 | $ret.="$target: $objs\n"; | ||
| 114 | $ex =' advapi32.lib'; | 137 | $ex =' advapi32.lib'; |
| 138 | $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && $target =~ /O_CRYPTO/; | ||
| 115 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | 139 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; |
| 116 | } | 140 | } |
| 117 | else | 141 | else |
| 118 | { | 142 | { |
| 119 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | 143 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; |
| 120 | $ex.=' wsock32.lib gdi32.lib advapi32.lib'; | 144 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; |
| 121 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | 145 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; |
| 146 | if ($fips && $target =~ /O_CRYPTO/) | ||
| 147 | { | ||
| 148 | $ex.=" \$(FIPSLIB_D)${o}_chkstk.o"; | ||
| 149 | $ret.="$target: $objs \$(PREMAIN_DSO_EXE)\n"; | ||
| 150 | $ret.="\tSET FIPS_LINK=\$(LINK)\n"; | ||
| 151 | $ret.="\tSET FIPS_CC=\$(CC)\n"; | ||
| 152 | $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; | ||
| 153 | $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n"; | ||
| 154 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | ||
| 155 | $ret.="\tSET FIPS_TARGET=$target\n"; | ||
| 156 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | ||
| 157 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target "; | ||
| 158 | $ret.="/def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs "; | ||
| 159 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | $ret.="$target: $objs\n"; | ||
| 164 | $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
| 165 | } | ||
| 122 | } | 166 | } |
| 123 | $ret.="\n"; | 167 | $ret.="\n"; |
| 124 | return($ret); | 168 | return($ret); |
| @@ -126,20 +170,51 @@ sub do_lib_rule | |||
| 126 | 170 | ||
| 127 | sub do_link_rule | 171 | sub do_link_rule |
| 128 | { | 172 | { |
| 129 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | 173 | local($target,$files,$dep_libs,$libs,$standalone)=@_; |
| 130 | local($ret,$_); | 174 | local($ret,$_); |
| 131 | |||
| 132 | $file =~ s/\//$o/g if $o ne '/'; | 175 | $file =~ s/\//$o/g if $o ne '/'; |
| 133 | $n=&bname($targer); | 176 | $n=&bname($targer); |
| 134 | $ret.="$target: $files $dep_libs\n"; | 177 | $ret.="$target: $files $dep_libs\n"; |
| 135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | 178 | if ($standalone) |
| 136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; | 179 | { |
| 137 | if (defined $sha1file) | 180 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; |
| 181 | $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/); | ||
| 182 | $ret.="$files $libs\n<<\n"; | ||
| 183 | } | ||
| 184 | elsif ($fips && !$shlib) | ||
| 138 | { | 185 | { |
| 139 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | 186 | $ret.="\tSET FIPS_LINK=\$(LINK)\n"; |
| 187 | $ret.="\tSET FIPS_CC=\$(CC)\n"; | ||
| 188 | $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; | ||
| 189 | $ret.="\tSET PREMAIN_DSO_EXE=\n"; | ||
| 190 | $ret.="\tSET FIPS_TARGET=$target\n"; | ||
| 191 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | ||
| 192 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | ||
| 193 | $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target @<<\n"; | ||
| 194 | $ret.=" \$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; | ||
| 140 | } | 195 | } |
| 196 | else | ||
| 197 | { | ||
| 198 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | ||
| 199 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; | ||
| 200 | } | ||
| 201 | $ret.="\n"; | ||
| 202 | return($ret); | ||
| 203 | } | ||
| 204 | |||
| 205 | sub do_rlink_rule | ||
| 206 | { | ||
| 207 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 208 | local($ret,$_); | ||
| 209 | |||
| 210 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 211 | $n=&bname($targer); | ||
| 212 | $ret.="$target: $files $dep_libs\n"; | ||
| 213 | $ret.=" \$(MKCANISTER) $target <<\n"; | ||
| 214 | $ret.="INPUT($files)\n<<\n"; | ||
| 141 | $ret.="\n"; | 215 | $ret.="\n"; |
| 142 | return($ret); | 216 | return($ret); |
| 143 | } | 217 | } |
| 144 | 218 | ||
| 219 | |||
| 145 | 1; | 220 | 1; |
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl index 657e4e264e..546d1ec186 100644 --- a/src/lib/libcrypto/util/pod2man.pl +++ b/src/lib/libcrypto/util/pod2man.pl | |||
| @@ -425,6 +425,7 @@ if ($name ne 'something') { | |||
| 425 | } | 425 | } |
| 426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME | 426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME |
| 427 | next if /^=pod\b/; # It is OK to have =pod before NAME | 427 | next if /^=pod\b/; # It is OK to have =pod before NAME |
| 428 | next if /^=for\s+comment\b/; # It is OK to have =for comment before NAME | ||
| 428 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; | 429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; |
| 429 | } | 430 | } |
| 430 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | 431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; |
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl index e9d5aa8938..4778c5ab01 100644 --- a/src/lib/libcrypto/util/selftest.pl +++ b/src/lib/libcrypto/util/selftest.pl | |||
| @@ -49,7 +49,7 @@ if (open(IN,"<Makefile")) { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | $cversion=`$cc -v 2>&1`; | 51 | $cversion=`$cc -v 2>&1`; |
| 52 | $cversion=`$cc -V 2>&1` if $cversion =~ "usage"; | 52 | $cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage"; |
| 53 | $cversion=`$cc -V |head -1` if $cversion =~ "Error"; | 53 | $cversion=`$cc -V |head -1` if $cversion =~ "Error"; |
| 54 | $cversion=`$cc --version` if $cversion eq ""; | 54 | $cversion=`$cc --version` if $cversion eq ""; |
| 55 | $cversion =~ s/Reading specs.*\n//; | 55 | $cversion =~ s/Reading specs.*\n//; |
| @@ -130,15 +130,21 @@ if (system("make 2>&1 | tee make.log") > 255) { | |||
| 130 | goto err; | 130 | goto err; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | $_=$options; | 133 | # Not sure why this is here. The tests themselves can detect if their |
| 134 | s/no-asm//; | 134 | # particular feature isn't included, and should therefore skip themselves. |
| 135 | s/no-shared//; | 135 | # To skip *all* tests just because one algorithm isn't included is like |
| 136 | s/no-krb5//; | 136 | # shooting mosquito with an elephant gun... |
| 137 | if (/no-/) | 137 | # -- Richard Levitte, inspired by problem report 1089 |
| 138 | { | 138 | # |
| 139 | print OUT "Test skipped.\n"; | 139 | #$_=$options; |
| 140 | goto err; | 140 | #s/no-asm//; |
| 141 | } | 141 | #s/no-shared//; |
| 142 | #s/no-krb5//; | ||
| 143 | #if (/no-/) | ||
| 144 | #{ | ||
| 145 | # print OUT "Test skipped.\n"; | ||
| 146 | # goto err; | ||
| 147 | #} | ||
| 142 | 148 | ||
| 143 | print "Running make test...\n"; | 149 | print "Running make test...\n"; |
| 144 | if (system("make test 2>&1 | tee maketest.log") > 255) | 150 | if (system("make test 2>&1 | tee maketest.log") > 255) |
