diff options
Diffstat (limited to 'src/lib/libcrypto/util')
| -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/mkerr.pl | 630 | ||||
| -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/mkstack.pl | 125 | ||||
| -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.pl | 99 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/pod2man.pl | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/util/selftest.pl | 26 |
12 files changed, 856 insertions, 454 deletions
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 4222bef6d6..56fb7446e0 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 NOEXIST::FUNCTION: | 2814 | FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS: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 NOEXIST::FUNCTION: | 2840 | FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS: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,41 +2867,3 @@ 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 05a6086164..957264c6b5 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
| @@ -10,20 +10,6 @@ $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 | |||
| 27 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 13 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
| 28 | while(<IN>) { | 14 | while(<IN>) { |
| 29 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 15 | $ssl_version=$1 if (/^VERSION=(.*)$/); |
| @@ -38,7 +24,6 @@ $infile="MINFO"; | |||
| 38 | 24 | ||
| 39 | %ops=( | 25 | %ops=( |
| 40 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | 26 | "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", | ||
| 42 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | 27 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", |
| 43 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | 28 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", |
| 44 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | 29 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", |
| @@ -58,7 +43,6 @@ $infile="MINFO"; | |||
| 58 | ); | 43 | ); |
| 59 | 44 | ||
| 60 | $platform=""; | 45 | $platform=""; |
| 61 | my $xcflags=""; | ||
| 62 | foreach (@ARGV) | 46 | foreach (@ARGV) |
| 63 | { | 47 | { |
| 64 | if (!&read_options && !defined($ops{$_})) | 48 | if (!&read_options && !defined($ops{$_})) |
| @@ -120,12 +104,8 @@ $inc_def="outinc"; | |||
| 120 | $tmp_def="tmp"; | 104 | $tmp_def="tmp"; |
| 121 | 105 | ||
| 122 | $mkdir="-mkdir"; | 106 | $mkdir="-mkdir"; |
| 123 | $mkcanister="ld -r -o"; | ||
| 124 | |||
| 125 | $ex_build_targets = ""; | ||
| 126 | 107 | ||
| 127 | ($ssl,$crypto)=("ssl","crypto"); | 108 | ($ssl,$crypto)=("ssl","crypto"); |
| 128 | $cryptocompat = ""; | ||
| 129 | $ranlib="echo ranlib"; | 109 | $ranlib="echo ranlib"; |
| 130 | 110 | ||
| 131 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | 111 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; |
| @@ -160,10 +140,6 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) | |||
| 160 | $NT = 1 if $platform eq "VC-NT"; | 140 | $NT = 1 if $platform eq "VC-NT"; |
| 161 | require 'VC-32.pl'; | 141 | require 'VC-32.pl'; |
| 162 | } | 142 | } |
| 163 | elsif ($platform eq "VC-WIN32-GMAKE") | ||
| 164 | { | ||
| 165 | require 'VC-32-GMAKE.pl'; | ||
| 166 | } | ||
| 167 | elsif ($platform eq "VC-CE") | 143 | elsif ($platform eq "VC-CE") |
| 168 | { | 144 | { |
| 169 | require 'VC-CE.pl'; | 145 | require 'VC-CE.pl'; |
| @@ -234,8 +210,6 @@ $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | |||
| 234 | 210 | ||
| 235 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | 211 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); |
| 236 | 212 | ||
| 237 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
| 238 | |||
| 239 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | 213 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; |
| 240 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | 214 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; |
| 241 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | 215 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; |
| @@ -265,9 +239,6 @@ $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | |||
| 265 | $cflags.=" -DOPENSSL_FIPS" if $fips; | 239 | $cflags.=" -DOPENSSL_FIPS" if $fips; |
| 266 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 240 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
| 267 | 241 | ||
| 268 | $cflags.= " -DZLIB" if $zlib_opt; | ||
| 269 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
| 270 | |||
| 271 | ## if ($unix) | 242 | ## if ($unix) |
| 272 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | 243 | ## { $cflags="$c_flags" if ($c_flags ne ""); } |
| 273 | ##else | 244 | ##else |
| @@ -275,7 +246,6 @@ $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | |||
| 275 | 246 | ||
| 276 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 247 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
| 277 | 248 | ||
| 278 | |||
| 279 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | 249 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", |
| 280 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | 250 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); |
| 281 | 251 | ||
| @@ -292,135 +262,6 @@ $link="$bin_dir$link" if ($link !~ /^\$/); | |||
| 292 | 262 | ||
| 293 | $INSTALLTOP =~ s|/|$o|g; | 263 | $INSTALLTOP =~ s|/|$o|g; |
| 294 | 264 | ||
| 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 | |||
| 424 | $defs= <<"EOF"; | 265 | $defs= <<"EOF"; |
| 425 | # This makefile has been automatically generated from the OpenSSL distribution. | 266 | # This makefile has been automatically generated from the OpenSSL distribution. |
| 426 | # This single makefile will build the complete OpenSSL distribution and | 267 | # This single makefile will build the complete OpenSSL distribution and |
| @@ -445,7 +286,6 @@ if ($platform eq "VC-CE") | |||
| 445 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> | 286 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> |
| 446 | 287 | ||
| 447 | EOF | 288 | EOF |
| 448 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
| 449 | } | 289 | } |
| 450 | 290 | ||
| 451 | $defs.= <<"EOF"; | 291 | $defs.= <<"EOF"; |
| @@ -468,8 +308,6 @@ EX_LIBS=$ex_libs | |||
| 468 | SRC_D=$src_dir | 308 | SRC_D=$src_dir |
| 469 | 309 | ||
| 470 | LINK=$link | 310 | LINK=$link |
| 471 | PERL=perl | ||
| 472 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
| 473 | LFLAGS=$lflags | 311 | LFLAGS=$lflags |
| 474 | 312 | ||
| 475 | BN_ASM_OBJ=$bn_asm_obj | 313 | BN_ASM_OBJ=$bn_asm_obj |
| @@ -501,9 +339,6 @@ TMP_D=$tmp_dir | |||
| 501 | INC_D=$inc_dir | 339 | INC_D=$inc_dir |
| 502 | INCO_D=$inc_dir${o}openssl | 340 | INCO_D=$inc_dir${o}openssl |
| 503 | 341 | ||
| 504 | # Directory containing FIPS module | ||
| 505 | |||
| 506 | |||
| 507 | CP=$cp | 342 | CP=$cp |
| 508 | RM=$rm | 343 | RM=$rm |
| 509 | RANLIB=$ranlib | 344 | RANLIB=$ranlib |
| @@ -511,18 +346,6 @@ MKDIR=$mkdir | |||
| 511 | MKLIB=$bin_dir$mklib | 346 | MKLIB=$bin_dir$mklib |
| 512 | MLFLAGS=$mlflags | 347 | MLFLAGS=$mlflags |
| 513 | ASM=$bin_dir$asm | 348 | 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 | ||
| 526 | 349 | ||
| 527 | ###################################################### | 350 | ###################################################### |
| 528 | # You should not need to touch anything below this point | 351 | # You should not need to touch anything below this point |
| @@ -554,7 +377,7 @@ SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | |||
| 554 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 377 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
| 555 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 378 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
| 556 | 379 | ||
| 557 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | 380 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) |
| 558 | 381 | ||
| 559 | ###################################################### | 382 | ###################################################### |
| 560 | # Don't touch anything below this point | 383 | # Don't touch anything below this point |
| @@ -564,13 +387,13 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
| 564 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 387 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
| 565 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 388 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
| 566 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 389 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
| 567 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep | 390 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) |
| 568 | 391 | ||
| 569 | ############################################# | 392 | ############################################# |
| 570 | EOF | 393 | EOF |
| 571 | 394 | ||
| 572 | $rules=<<"EOF"; | 395 | $rules=<<"EOF"; |
| 573 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets | 396 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe |
| 574 | 397 | ||
| 575 | banner: | 398 | banner: |
| 576 | $banner | 399 | $banner |
| @@ -656,6 +479,57 @@ printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | |||
| 656 | printf OUT "#endif\n"; | 479 | printf OUT "#endif\n"; |
| 657 | close(OUT); | 480 | close(OUT); |
| 658 | 481 | ||
| 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 | |||
| 659 | # Strip of trailing ' ' | 533 | # Strip of trailing ' ' |
| 660 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | 534 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } |
| 661 | $test=&clean_up_ws($test); | 535 | $test=&clean_up_ws($test); |
| @@ -680,29 +554,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
| 680 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 554 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
| 681 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 555 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
| 682 | 556 | ||
| 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 | |||
| 706 | foreach (values %lib_nam) | 557 | foreach (values %lib_nam) |
| 707 | { | 558 | { |
| 708 | $lib_obj=$lib_obj{$_}; | 559 | $lib_obj=$lib_obj{$_}; |
| @@ -779,42 +630,16 @@ foreach (split(/\s+/,$test)) | |||
| 779 | } | 630 | } |
| 780 | 631 | ||
| 781 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 632 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
| 782 | 633 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | |
| 783 | 634 | ||
| 784 | if ($fips) | 635 | if ($fips) |
| 785 | { | 636 | { |
| 786 | if ($shlib) | 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"); |
| 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 | } | ||
| 800 | } | 638 | } |
| 801 | else | 639 | else |
| 802 | { | ||
| 803 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | ||
| 804 | "\$(SO_CRYPTO)"); | ||
| 805 | } | ||
| 806 | |||
| 807 | |||
| 808 | if ($fips) | ||
| 809 | { | 640 | { |
| 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; | 641 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
| 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 | } | 642 | } |
| 815 | |||
| 816 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)",0); | ||
| 817 | |||
| 818 | print $defs; | 643 | print $defs; |
| 819 | 644 | ||
| 820 | if ($platform eq "linux-elf") { | 645 | if ($platform eq "linux-elf") { |
| @@ -1110,24 +935,6 @@ sub read_options | |||
| 1110 | elsif (/^shlib$/) { $shlib=1; } | 935 | elsif (/^shlib$/) { $shlib=1; } |
| 1111 | elsif (/^dll$/) { $shlib=1; } | 936 | elsif (/^dll$/) { $shlib=1; } |
| 1112 | elsif (/^shared$/) { } # We just need to ignore it for now... | 937 | 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 | } | ||
| 1131 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | 938 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } |
| 1132 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | 939 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } |
| 1133 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | 940 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) |
| @@ -1135,31 +942,3 @@ sub read_options | |||
| 1135 | else { return(0); } | 942 | else { return(0); } |
| 1136 | return(1); | 943 | return(1); |
| 1137 | } | 944 | } |
| 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 6c1e53bb14..9918c3d549 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 | "SHA256", "SHA512", "RIPEMD", | 86 | "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-1.0/fips.h fips-1.0/rand/fips_rand.h fips-1.0/sha/fips_sha.h"; | 270 | $crypto.=" fips/fips.h fips/rand/fips_rand.h"; |
| 271 | 271 | ||
| 272 | my $symhacks="crypto/symhacks.h"; | 272 | my $symhacks="crypto/symhacks.h"; |
| 273 | 273 | ||
| @@ -864,9 +864,6 @@ 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]/); | ||
| 870 | 867 | ||
| 871 | $platform{$s} = | 868 | $platform{$s} = |
| 872 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | 869 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); |
| @@ -1014,7 +1011,7 @@ sub is_valid | |||
| 1014 | { | 1011 | { |
| 1015 | my ($keywords_txt,$platforms) = @_; | 1012 | my ($keywords_txt,$platforms) = @_; |
| 1016 | my (@keywords) = split /,/,$keywords_txt; | 1013 | my (@keywords) = split /,/,$keywords_txt; |
| 1017 | my ($falsesum, $truesum) = (0, 1); | 1014 | my ($falsesum, $truesum) = (0, !grep(/^[^!]/,@keywords)); |
| 1018 | 1015 | ||
| 1019 | # Param: one keyword | 1016 | # Param: one keyword |
| 1020 | sub recognise | 1017 | sub recognise |
| @@ -1082,7 +1079,7 @@ sub is_valid | |||
| 1082 | if ($k =~ /^!(.*)$/) { | 1079 | if ($k =~ /^!(.*)$/) { |
| 1083 | $falsesum += &recognise($1,$platforms); | 1080 | $falsesum += &recognise($1,$platforms); |
| 1084 | } else { | 1081 | } else { |
| 1085 | $truesum *= &recognise($k,$platforms); | 1082 | $truesum += &recognise($k,$platforms); |
| 1086 | } | 1083 | } |
| 1087 | } | 1084 | } |
| 1088 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; | 1085 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; |
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl new file mode 100644 index 0000000000..60e534807e --- /dev/null +++ b/src/lib/libcrypto/util/mkerr.pl | |||
| @@ -0,0 +1,630 @@ | |||
| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | my $config = "crypto/err/openssl.ec"; | ||
| 4 | my $debug = 0; | ||
| 5 | my $rebuild = 0; | ||
| 6 | my $static = 1; | ||
| 7 | my $recurse = 0; | ||
| 8 | my $reindex = 0; | ||
| 9 | my $dowrite = 0; | ||
| 10 | my $staticloader = ""; | ||
| 11 | |||
| 12 | while (@ARGV) { | ||
| 13 | my $arg = $ARGV[0]; | ||
| 14 | if($arg eq "-conf") { | ||
| 15 | shift @ARGV; | ||
| 16 | $config = shift @ARGV; | ||
| 17 | } elsif($arg eq "-debug") { | ||
| 18 | $debug = 1; | ||
| 19 | shift @ARGV; | ||
| 20 | } elsif($arg eq "-rebuild") { | ||
| 21 | $rebuild = 1; | ||
| 22 | shift @ARGV; | ||
| 23 | } elsif($arg eq "-recurse") { | ||
| 24 | $recurse = 1; | ||
| 25 | shift @ARGV; | ||
| 26 | } elsif($arg eq "-reindex") { | ||
| 27 | $reindex = 1; | ||
| 28 | shift @ARGV; | ||
| 29 | } elsif($arg eq "-nostatic") { | ||
| 30 | $static = 0; | ||
| 31 | shift @ARGV; | ||
| 32 | } elsif($arg eq "-staticloader") { | ||
| 33 | $staticloader = "static "; | ||
| 34 | shift @ARGV; | ||
| 35 | } elsif($arg eq "-write") { | ||
| 36 | $dowrite = 1; | ||
| 37 | shift @ARGV; | ||
| 38 | } else { | ||
| 39 | last; | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | if($recurse) { | ||
| 44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips/*.c>, | ||
| 45 | <fips/*/*.c>); | ||
| 46 | } else { | ||
| 47 | @source = @ARGV; | ||
| 48 | } | ||
| 49 | |||
| 50 | # Read in the config file | ||
| 51 | |||
| 52 | open(IN, "<$config") || die "Can't open config file $config"; | ||
| 53 | |||
| 54 | # Parse config file | ||
| 55 | |||
| 56 | while(<IN>) | ||
| 57 | { | ||
| 58 | if(/^L\s+(\S+)\s+(\S+)\s+(\S+)/) { | ||
| 59 | $hinc{$1} = $2; | ||
| 60 | $libinc{$2} = $1; | ||
| 61 | $cskip{$3} = $1; | ||
| 62 | if($3 ne "NONE") { | ||
| 63 | $csrc{$1} = $3; | ||
| 64 | $fmax{$1} = 99; | ||
| 65 | $rmax{$1} = 99; | ||
| 66 | $fnew{$1} = 0; | ||
| 67 | $rnew{$1} = 0; | ||
| 68 | } | ||
| 69 | } elsif (/^F\s+(\S+)/) { | ||
| 70 | # Add extra function with $1 | ||
| 71 | } elsif (/^R\s+(\S+)\s+(\S+)/) { | ||
| 72 | $rextra{$1} = $2; | ||
| 73 | $rcodes{$1} = $2; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | close IN; | ||
| 78 | |||
| 79 | # Scan each header file in turn and make a list of error codes | ||
| 80 | # and function names | ||
| 81 | |||
| 82 | while (($hdr, $lib) = each %libinc) | ||
| 83 | { | ||
| 84 | next if($hdr eq "NONE"); | ||
| 85 | print STDERR "Scanning header file $hdr\n" if $debug; | ||
| 86 | my $line = "", $def= "", $linenr = 0, $gotfile = 0; | ||
| 87 | if (open(IN, "<$hdr")) { | ||
| 88 | $gotfile = 1; | ||
| 89 | while(<IN>) { | ||
| 90 | $linenr++; | ||
| 91 | print STDERR "line: $linenr\r" if $debug; | ||
| 92 | |||
| 93 | last if(/BEGIN\s+ERROR\s+CODES/); | ||
| 94 | if ($line ne '') { | ||
| 95 | $_ = $line . $_; | ||
| 96 | $line = ''; | ||
| 97 | } | ||
| 98 | |||
| 99 | if (/\\$/) { | ||
| 100 | $line = $_; | ||
| 101 | next; | ||
| 102 | } | ||
| 103 | |||
| 104 | $cpp = 1 if /^#.*ifdef.*cplusplus/; # skip "C" declaration | ||
| 105 | if ($cpp) { | ||
| 106 | $cpp = 0 if /^#.*endif/; | ||
| 107 | next; | ||
| 108 | } | ||
| 109 | |||
| 110 | next if (/^\#/); # skip preprocessor directives | ||
| 111 | |||
| 112 | s/\/\*.*?\*\///gs; # ignore comments | ||
| 113 | s/{[^{}]*}//gs; # ignore {} blocks | ||
| 114 | |||
| 115 | if (/\{|\/\*/) { # Add a } so editor works... | ||
| 116 | $line = $_; | ||
| 117 | } else { | ||
| 118 | $def .= $_; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | print STDERR " \r" if $debug; | ||
| 124 | $defnr = 0; | ||
| 125 | foreach (split /;/, $def) { | ||
| 126 | $defnr++; | ||
| 127 | print STDERR "def: $defnr\r" if $debug; | ||
| 128 | |||
| 129 | s/^[\n\s]*//g; | ||
| 130 | s/[\n\s]*$//g; | ||
| 131 | next if(/typedef\W/); | ||
| 132 | if (/\(\*(\w*)\([^\)]+/) { | ||
| 133 | my $name = $1; | ||
| 134 | $name =~ tr/[a-z]/[A-Z]/; | ||
| 135 | $ftrans{$name} = $1; | ||
| 136 | } elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s){ | ||
| 137 | # K&R C | ||
| 138 | next ; | ||
| 139 | } elsif (/\w+\W+\w+\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) { | ||
| 140 | while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) { | ||
| 141 | s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s; | ||
| 142 | s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s; | ||
| 143 | } | ||
| 144 | s/\(void\)//; | ||
| 145 | /(\w+(\{[0-9]+\})?)\W*\(\)/s; | ||
| 146 | my $name = $1; | ||
| 147 | $name =~ tr/[a-z]/[A-Z]/; | ||
| 148 | $ftrans{$name} = $1; | ||
| 149 | } elsif (/\(/ and not (/=/ or /DECLARE_STACK/)) { | ||
| 150 | print STDERR "Header $hdr: cannot parse: $_;\n"; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | print STDERR " \r" if $debug; | ||
| 155 | |||
| 156 | next if $reindex; | ||
| 157 | |||
| 158 | # Scan function and reason codes and store them: keep a note of the | ||
| 159 | # maximum code used. | ||
| 160 | |||
| 161 | if ($gotfile) { | ||
| 162 | while(<IN>) { | ||
| 163 | if(/^\#define\s+(\S+)\s+(\S+)/) { | ||
| 164 | $name = $1; | ||
| 165 | $code = $2; | ||
| 166 | next if $name =~ /^${lib}err/; | ||
| 167 | unless($name =~ /^${lib}_([RF])_(\w+)$/) { | ||
| 168 | print STDERR "Invalid error code $name\n"; | ||
| 169 | next; | ||
| 170 | } | ||
| 171 | if($1 eq "R") { | ||
| 172 | $rcodes{$name} = $code; | ||
| 173 | if(!(exists $rextra{$name}) && | ||
| 174 | ($code > $rmax{$lib}) ) { | ||
| 175 | $rmax{$lib} = $code; | ||
| 176 | } | ||
| 177 | } else { | ||
| 178 | if($code > $fmax{$lib}) { | ||
| 179 | $fmax{$lib} = $code; | ||
| 180 | } | ||
| 181 | $fcodes{$name} = $code; | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | close IN; | ||
| 187 | } | ||
| 188 | |||
| 189 | # Scan each C source file and look for function and reason codes | ||
| 190 | # This is done by looking for strings that "look like" function or | ||
| 191 | # reason codes: basically anything consisting of all upper case and | ||
| 192 | # numerics which has _F_ or _R_ in it and which has the name of an | ||
| 193 | # error library at the start. This seems to work fine except for the | ||
| 194 | # oddly named structure BIO_F_CTX which needs to be ignored. | ||
| 195 | # If a code doesn't exist in list compiled from headers then mark it | ||
| 196 | # with the value "X" as a place holder to give it a value later. | ||
| 197 | # Store all function and reason codes found in %ufcodes and %urcodes | ||
| 198 | # so all those unreferenced can be printed out. | ||
| 199 | |||
| 200 | |||
| 201 | print STDERR "Files loaded: " if $debug; | ||
| 202 | foreach $file (@source) { | ||
| 203 | # Don't parse the error source file. | ||
| 204 | next if exists $cskip{$file}; | ||
| 205 | print STDERR $file if $debug; | ||
| 206 | open(IN, "<$file") || die "Can't open source file $file\n"; | ||
| 207 | while(<IN>) { | ||
| 208 | if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { | ||
| 209 | next unless exists $csrc{$2}; | ||
| 210 | next if($1 eq "BIO_F_BUFFER_CTX"); | ||
| 211 | $ufcodes{$1} = 1; | ||
| 212 | if(!exists $fcodes{$1}) { | ||
| 213 | $fcodes{$1} = "X"; | ||
| 214 | $fnew{$2}++; | ||
| 215 | } | ||
| 216 | $notrans{$1} = 1 unless exists $ftrans{$3}; | ||
| 217 | } | ||
| 218 | if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { | ||
| 219 | next unless exists $csrc{$2}; | ||
| 220 | $urcodes{$1} = 1; | ||
| 221 | if(!exists $rcodes{$1}) { | ||
| 222 | $rcodes{$1} = "X"; | ||
| 223 | $rnew{$2}++; | ||
| 224 | } | ||
| 225 | } | ||
| 226 | } | ||
| 227 | close IN; | ||
| 228 | } | ||
| 229 | print STDERR "\n" if $debug; | ||
| 230 | |||
| 231 | # Now process each library in turn. | ||
| 232 | |||
| 233 | foreach $lib (keys %csrc) | ||
| 234 | { | ||
| 235 | my $hfile = $hinc{$lib}; | ||
| 236 | my $cfile = $csrc{$lib}; | ||
| 237 | if(!$fnew{$lib} && !$rnew{$lib}) { | ||
| 238 | print STDERR "$lib:\t\tNo new error codes\n"; | ||
| 239 | next unless $rebuild; | ||
| 240 | } else { | ||
| 241 | print STDERR "$lib:\t\t$fnew{$lib} New Functions,"; | ||
| 242 | print STDERR " $rnew{$lib} New Reasons.\n"; | ||
| 243 | next unless $dowrite; | ||
| 244 | } | ||
| 245 | |||
| 246 | # If we get here then we have some new error codes so we | ||
| 247 | # need to rebuild the header file and C file. | ||
| 248 | |||
| 249 | # Make a sorted list of error and reason codes for later use. | ||
| 250 | |||
| 251 | my @function = sort grep(/^${lib}_/,keys %fcodes); | ||
| 252 | my @reasons = sort grep(/^${lib}_/,keys %rcodes); | ||
| 253 | |||
| 254 | # Rewrite the header file | ||
| 255 | |||
| 256 | if (open(IN, "<$hfile")) { | ||
| 257 | # Copy across the old file | ||
| 258 | while(<IN>) { | ||
| 259 | push @out, $_; | ||
| 260 | last if (/BEGIN ERROR CODES/); | ||
| 261 | } | ||
| 262 | close IN; | ||
| 263 | } else { | ||
| 264 | push @out, | ||
| 265 | "/* ====================================================================\n", | ||
| 266 | " * Copyright (c) 2001-2005 The OpenSSL Project. All rights reserved.\n", | ||
| 267 | " *\n", | ||
| 268 | " * Redistribution and use in source and binary forms, with or without\n", | ||
| 269 | " * modification, are permitted provided that the following conditions\n", | ||
| 270 | " * are met:\n", | ||
| 271 | " *\n", | ||
| 272 | " * 1. Redistributions of source code must retain the above copyright\n", | ||
| 273 | " * notice, this list of conditions and the following disclaimer. \n", | ||
| 274 | " *\n", | ||
| 275 | " * 2. Redistributions in binary form must reproduce the above copyright\n", | ||
| 276 | " * notice, this list of conditions and the following disclaimer in\n", | ||
| 277 | " * the documentation and/or other materials provided with the\n", | ||
| 278 | " * distribution.\n", | ||
| 279 | " *\n", | ||
| 280 | " * 3. All advertising materials mentioning features or use of this\n", | ||
| 281 | " * software must display the following acknowledgment:\n", | ||
| 282 | " * \"This product includes software developed by the OpenSSL Project\n", | ||
| 283 | " * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n", | ||
| 284 | " *\n", | ||
| 285 | " * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n", | ||
| 286 | " * endorse or promote products derived from this software without\n", | ||
| 287 | " * prior written permission. For written permission, please contact\n", | ||
| 288 | " * openssl-core\@openssl.org.\n", | ||
| 289 | " *\n", | ||
| 290 | " * 5. Products derived from this software may not be called \"OpenSSL\"\n", | ||
| 291 | " * nor may \"OpenSSL\" appear in their names without prior written\n", | ||
| 292 | " * permission of the OpenSSL Project.\n", | ||
| 293 | " *\n", | ||
| 294 | " * 6. Redistributions of any form whatsoever must retain the following\n", | ||
| 295 | " * acknowledgment:\n", | ||
| 296 | " * \"This product includes software developed by the OpenSSL Project\n", | ||
| 297 | " * for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n", | ||
| 298 | " *\n", | ||
| 299 | " * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n", | ||
| 300 | " * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n", | ||
| 301 | " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n", | ||
| 302 | " * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n", | ||
| 303 | " * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n", | ||
| 304 | " * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n", | ||
| 305 | " * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n", | ||
| 306 | " * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n", | ||
| 307 | " * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n", | ||
| 308 | " * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n", | ||
| 309 | " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n", | ||
| 310 | " * OF THE POSSIBILITY OF SUCH DAMAGE.\n", | ||
| 311 | " * ====================================================================\n", | ||
| 312 | " *\n", | ||
| 313 | " * This product includes cryptographic software written by Eric Young\n", | ||
| 314 | " * (eay\@cryptsoft.com). This product includes software written by Tim\n", | ||
| 315 | " * Hudson (tjh\@cryptsoft.com).\n", | ||
| 316 | " *\n", | ||
| 317 | " */\n", | ||
| 318 | "\n", | ||
| 319 | "#ifndef HEADER_${lib}_ERR_H\n", | ||
| 320 | "#define HEADER_${lib}_ERR_H\n", | ||
| 321 | "\n", | ||
| 322 | "/* BEGIN ERROR CODES */\n"; | ||
| 323 | } | ||
| 324 | open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n"; | ||
| 325 | |||
| 326 | print OUT @out; | ||
| 327 | undef @out; | ||
| 328 | print OUT <<"EOF"; | ||
| 329 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 330 | * made after this point may be overwritten when the script is next run. | ||
| 331 | */ | ||
| 332 | EOF | ||
| 333 | if($static) { | ||
| 334 | print OUT <<"EOF"; | ||
| 335 | ${staticloader}void ERR_load_${lib}_strings(void); | ||
| 336 | |||
| 337 | EOF | ||
| 338 | } else { | ||
| 339 | print OUT <<"EOF"; | ||
| 340 | ${staticloader}void ERR_load_${lib}_strings(void); | ||
| 341 | ${staticloader}void ERR_unload_${lib}_strings(void); | ||
| 342 | ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line); | ||
| 343 | #define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__) | ||
| 344 | |||
| 345 | EOF | ||
| 346 | } | ||
| 347 | print OUT <<"EOF"; | ||
| 348 | /* Error codes for the $lib functions. */ | ||
| 349 | |||
| 350 | /* Function codes. */ | ||
| 351 | EOF | ||
| 352 | |||
| 353 | foreach $i (@function) { | ||
| 354 | $z=6-int(length($i)/8); | ||
| 355 | if($fcodes{$i} eq "X") { | ||
| 356 | $fcodes{$i} = ++$fmax{$lib}; | ||
| 357 | print STDERR "New Function code $i\n" if $debug; | ||
| 358 | } | ||
| 359 | printf OUT "#define $i%s $fcodes{$i}\n","\t" x $z; | ||
| 360 | } | ||
| 361 | |||
| 362 | print OUT "\n/* Reason codes. */\n"; | ||
| 363 | |||
| 364 | foreach $i (@reasons) { | ||
| 365 | $z=6-int(length($i)/8); | ||
| 366 | if($rcodes{$i} eq "X") { | ||
| 367 | $rcodes{$i} = ++$rmax{$lib}; | ||
| 368 | print STDERR "New Reason code $i\n" if $debug; | ||
| 369 | } | ||
| 370 | printf OUT "#define $i%s $rcodes{$i}\n","\t" x $z; | ||
| 371 | } | ||
| 372 | print OUT <<"EOF"; | ||
| 373 | |||
| 374 | #ifdef __cplusplus | ||
| 375 | } | ||
| 376 | #endif | ||
| 377 | #endif | ||
| 378 | EOF | ||
| 379 | close OUT; | ||
| 380 | |||
| 381 | # Rewrite the C source file containing the error details. | ||
| 382 | |||
| 383 | # First, read any existing reason string definitions: | ||
| 384 | my %err_reason_strings; | ||
| 385 | if (open(IN,"<$cfile")) { | ||
| 386 | while (<IN>) { | ||
| 387 | if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) { | ||
| 388 | $err_reason_strings{$1} = $2; | ||
| 389 | } | ||
| 390 | } | ||
| 391 | close(IN); | ||
| 392 | } | ||
| 393 | |||
| 394 | my $hincf; | ||
| 395 | if($static) { | ||
| 396 | $hfile =~ /([^\/]+)$/; | ||
| 397 | $hincf = "<openssl/$1>"; | ||
| 398 | } else { | ||
| 399 | $hincf = "\"$hfile\""; | ||
| 400 | } | ||
| 401 | |||
| 402 | |||
| 403 | open (OUT,">$cfile") || die "Can't open $cfile for writing"; | ||
| 404 | |||
| 405 | print OUT <<"EOF"; | ||
| 406 | /* $cfile */ | ||
| 407 | /* ==================================================================== | ||
| 408 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
| 409 | * | ||
| 410 | * Redistribution and use in source and binary forms, with or without | ||
| 411 | * modification, are permitted provided that the following conditions | ||
| 412 | * are met: | ||
| 413 | * | ||
| 414 | * 1. Redistributions of source code must retain the above copyright | ||
| 415 | * notice, this list of conditions and the following disclaimer. | ||
| 416 | * | ||
| 417 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 418 | * notice, this list of conditions and the following disclaimer in | ||
| 419 | * the documentation and/or other materials provided with the | ||
| 420 | * distribution. | ||
| 421 | * | ||
| 422 | * 3. All advertising materials mentioning features or use of this | ||
| 423 | * software must display the following acknowledgment: | ||
| 424 | * "This product includes software developed by the OpenSSL Project | ||
| 425 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 426 | * | ||
| 427 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 428 | * endorse or promote products derived from this software without | ||
| 429 | * prior written permission. For written permission, please contact | ||
| 430 | * openssl-core\@OpenSSL.org. | ||
| 431 | * | ||
| 432 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 433 | * nor may "OpenSSL" appear in their names without prior written | ||
| 434 | * permission of the OpenSSL Project. | ||
| 435 | * | ||
| 436 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 437 | * acknowledgment: | ||
| 438 | * "This product includes software developed by the OpenSSL Project | ||
| 439 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 440 | * | ||
| 441 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 442 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 443 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 444 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 445 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 446 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 447 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 448 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 449 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 450 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 451 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 452 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 453 | * ==================================================================== | ||
| 454 | * | ||
| 455 | * This product includes cryptographic software written by Eric Young | ||
| 456 | * (eay\@cryptsoft.com). This product includes software written by Tim | ||
| 457 | * Hudson (tjh\@cryptsoft.com). | ||
| 458 | * | ||
| 459 | */ | ||
| 460 | |||
| 461 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
| 462 | * made to it will be overwritten when the script next updates this file, | ||
| 463 | * only reason strings will be preserved. | ||
| 464 | */ | ||
| 465 | |||
| 466 | #include <stdio.h> | ||
| 467 | #include <openssl/err.h> | ||
| 468 | #include $hincf | ||
| 469 | |||
| 470 | /* BEGIN ERROR CODES */ | ||
| 471 | #ifndef OPENSSL_NO_ERR | ||
| 472 | static ERR_STRING_DATA ${lib}_str_functs[]= | ||
| 473 | { | ||
| 474 | EOF | ||
| 475 | # Add each function code: if a function name is found then use it. | ||
| 476 | foreach $i (@function) { | ||
| 477 | my $fn; | ||
| 478 | $i =~ /^${lib}_F_(\S+)$/; | ||
| 479 | $fn = $1; | ||
| 480 | if(exists $ftrans{$fn}) { | ||
| 481 | $fn = $ftrans{$fn}; | ||
| 482 | } | ||
| 483 | print OUT "{ERR_PACK(0,$i,0),\t\"$fn\"},\n"; | ||
| 484 | } | ||
| 485 | print OUT <<"EOF"; | ||
| 486 | {0,NULL} | ||
| 487 | }; | ||
| 488 | |||
| 489 | static ERR_STRING_DATA ${lib}_str_reasons[]= | ||
| 490 | { | ||
| 491 | EOF | ||
| 492 | # Add each reason code. | ||
| 493 | foreach $i (@reasons) { | ||
| 494 | my $rn; | ||
| 495 | my $nspc = 0; | ||
| 496 | if (exists $err_reason_strings{$i}) { | ||
| 497 | $rn = $err_reason_strings{$i}; | ||
| 498 | } else { | ||
| 499 | $i =~ /^${lib}_R_(\S+)$/; | ||
| 500 | $rn = $1; | ||
| 501 | $rn =~ tr/_[A-Z]/ [a-z]/; | ||
| 502 | } | ||
| 503 | $nspc = 40 - length($i) unless length($i) > 40; | ||
| 504 | $nspc = " " x $nspc; | ||
| 505 | print OUT "{${i}${nspc},\"$rn\"},\n"; | ||
| 506 | } | ||
| 507 | if($static) { | ||
| 508 | print OUT <<"EOF"; | ||
| 509 | {0,NULL} | ||
| 510 | }; | ||
| 511 | |||
| 512 | #endif | ||
| 513 | |||
| 514 | ${staticloader}void ERR_load_${lib}_strings(void) | ||
| 515 | { | ||
| 516 | static int init=1; | ||
| 517 | |||
| 518 | if (init) | ||
| 519 | { | ||
| 520 | init=0; | ||
| 521 | #ifndef OPENSSL_NO_ERR | ||
| 522 | ERR_load_strings(ERR_LIB_${lib},${lib}_str_functs); | ||
| 523 | ERR_load_strings(ERR_LIB_${lib},${lib}_str_reasons); | ||
| 524 | #endif | ||
| 525 | |||
| 526 | } | ||
| 527 | } | ||
| 528 | EOF | ||
| 529 | } else { | ||
| 530 | print OUT <<"EOF"; | ||
| 531 | {0,NULL} | ||
| 532 | }; | ||
| 533 | |||
| 534 | #endif | ||
| 535 | |||
| 536 | #ifdef ${lib}_LIB_NAME | ||
| 537 | static ERR_STRING_DATA ${lib}_lib_name[]= | ||
| 538 | { | ||
| 539 | {0 ,${lib}_LIB_NAME}, | ||
| 540 | {0,NULL} | ||
| 541 | }; | ||
| 542 | #endif | ||
| 543 | |||
| 544 | |||
| 545 | static int ${lib}_lib_error_code=0; | ||
| 546 | static int ${lib}_error_init=1; | ||
| 547 | |||
| 548 | ${staticloader}void ERR_load_${lib}_strings(void) | ||
| 549 | { | ||
| 550 | if (${lib}_lib_error_code == 0) | ||
| 551 | ${lib}_lib_error_code=ERR_get_next_error_library(); | ||
| 552 | |||
| 553 | if (${lib}_error_init) | ||
| 554 | { | ||
| 555 | ${lib}_error_init=0; | ||
| 556 | #ifndef OPENSSL_NO_ERR | ||
| 557 | ERR_load_strings(${lib}_lib_error_code,${lib}_str_functs); | ||
| 558 | ERR_load_strings(${lib}_lib_error_code,${lib}_str_reasons); | ||
| 559 | #endif | ||
| 560 | |||
| 561 | #ifdef ${lib}_LIB_NAME | ||
| 562 | ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0); | ||
| 563 | ERR_load_strings(0,${lib}_lib_name); | ||
| 564 | #endif | ||
| 565 | } | ||
| 566 | } | ||
| 567 | |||
| 568 | ${staticloader}void ERR_unload_${lib}_strings(void) | ||
| 569 | { | ||
| 570 | if (${lib}_error_init == 0) | ||
| 571 | { | ||
| 572 | #ifndef OPENSSL_NO_ERR | ||
| 573 | ERR_unload_strings(${lib}_lib_error_code,${lib}_str_functs); | ||
| 574 | ERR_unload_strings(${lib}_lib_error_code,${lib}_str_reasons); | ||
| 575 | #endif | ||
| 576 | |||
| 577 | #ifdef ${lib}_LIB_NAME | ||
| 578 | ERR_unload_strings(0,${lib}_lib_name); | ||
| 579 | #endif | ||
| 580 | ${lib}_error_init=1; | ||
| 581 | } | ||
| 582 | } | ||
| 583 | |||
| 584 | ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line) | ||
| 585 | { | ||
| 586 | if (${lib}_lib_error_code == 0) | ||
| 587 | ${lib}_lib_error_code=ERR_get_next_error_library(); | ||
| 588 | ERR_PUT_error(${lib}_lib_error_code,function,reason,file,line); | ||
| 589 | } | ||
| 590 | EOF | ||
| 591 | |||
| 592 | } | ||
| 593 | |||
| 594 | close OUT; | ||
| 595 | undef %err_reason_strings; | ||
| 596 | } | ||
| 597 | |||
| 598 | if($debug && defined(%notrans)) { | ||
| 599 | print STDERR "The following function codes were not translated:\n"; | ||
| 600 | foreach(sort keys %notrans) | ||
| 601 | { | ||
| 602 | print STDERR "$_\n"; | ||
| 603 | } | ||
| 604 | } | ||
| 605 | |||
| 606 | # Make a list of unreferenced function and reason codes | ||
| 607 | |||
| 608 | foreach (keys %fcodes) { | ||
| 609 | push (@funref, $_) unless exists $ufcodes{$_}; | ||
| 610 | } | ||
| 611 | |||
| 612 | foreach (keys %rcodes) { | ||
| 613 | push (@runref, $_) unless exists $urcodes{$_}; | ||
| 614 | } | ||
| 615 | |||
| 616 | if($debug && defined(@funref) ) { | ||
| 617 | print STDERR "The following function codes were not referenced:\n"; | ||
| 618 | foreach(sort @funref) | ||
| 619 | { | ||
| 620 | print STDERR "$_\n"; | ||
| 621 | } | ||
| 622 | } | ||
| 623 | |||
| 624 | if($debug && defined(@runref) ) { | ||
| 625 | print STDERR "The following reason codes were not referenced:\n"; | ||
| 626 | foreach(sort @runref) | ||
| 627 | { | ||
| 628 | print STDERR "$_\n"; | ||
| 629 | } | ||
| 630 | } | ||
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl index bc78510f56..928a274303 100644 --- a/src/lib/libcrypto/util/mkfiles.pl +++ b/src/lib/libcrypto/util/mkfiles.pl | |||
| @@ -51,15 +51,14 @@ my @dirs = ( | |||
| 51 | "crypto/ocsp", | 51 | "crypto/ocsp", |
| 52 | "crypto/ui", | 52 | "crypto/ui", |
| 53 | "crypto/krb5", | 53 | "crypto/krb5", |
| 54 | "fips-1.0", | 54 | "fips", |
| 55 | "fips-1.0/aes", | 55 | "fips/aes", |
| 56 | "fips-1.0/des", | 56 | "fips/des", |
| 57 | "fips-1.0/dsa", | 57 | "fips/dsa", |
| 58 | "fips-1.0/dh", | 58 | "fips/dh", |
| 59 | "fips-1.0/hmac", | 59 | "fips/rand", |
| 60 | "fips-1.0/rand", | 60 | "fips/rsa", |
| 61 | "fips-1.0/rsa", | 61 | "fips/sha1", |
| 62 | "fips-1.0/sha", | ||
| 63 | "ssl", | 62 | "ssl", |
| 64 | "apps", | 63 | "apps", |
| 65 | "test", | 64 | "test", |
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl index 182732d959..c8653cecc3 100644 --- a/src/lib/libcrypto/util/mklink.pl +++ b/src/lib/libcrypto/util/mklink.pl | |||
| @@ -14,16 +14,13 @@ | |||
| 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; | ||
| 20 | 17 | ||
| 21 | my $from = shift; | 18 | my $from = shift; |
| 22 | my @files = @ARGV; | 19 | my @files = @ARGV; |
| 23 | 20 | ||
| 24 | my @from_path = split(/[\\\/]/, $from); | 21 | my @from_path = split(/[\\\/]/, $from); |
| 25 | my $pwd = getcwd(); | 22 | my $pwd = `pwd`; |
| 26 | chomp($pwd); | 23 | chop($pwd); |
| 27 | my @pwd_path = split(/[\\\/]/, $pwd); | 24 | my @pwd_path = split(/[\\\/]/, $pwd); |
| 28 | 25 | ||
| 29 | my @to_path = (); | 26 | my @to_path = (); |
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl new file mode 100644 index 0000000000..0ca9eb6a76 --- /dev/null +++ b/src/lib/libcrypto/util/mkstack.pl | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | # This is a utility that searches out "DECLARE_STACK_OF()" | ||
| 4 | # declarations in .h and .c files, and updates/creates/replaces | ||
| 5 | # the corresponding macro declarations in crypto/stack/safestack.h. | ||
| 6 | # As it's not generally possible to have macros that generate macros, | ||
| 7 | # we need to control this from the "outside", here in this script. | ||
| 8 | # | ||
| 9 | # Geoff Thorpe, June, 2000 (with massive Perl-hacking | ||
| 10 | # help from Steve Robb) | ||
| 11 | |||
| 12 | my $safestack = "crypto/stack/safestack"; | ||
| 13 | |||
| 14 | my $do_write; | ||
| 15 | while (@ARGV) { | ||
| 16 | my $arg = $ARGV[0]; | ||
| 17 | if($arg eq "-write") { | ||
| 18 | $do_write = 1; | ||
| 19 | } | ||
| 20 | shift @ARGV; | ||
| 21 | } | ||
| 22 | |||
| 23 | |||
| 24 | @source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>); | ||
| 25 | foreach $file (@source) { | ||
| 26 | next if -l $file; | ||
| 27 | |||
| 28 | # Open the .c/.h file for reading | ||
| 29 | open(IN, "< $file") || die "Can't open $file for reading: $!"; | ||
| 30 | |||
| 31 | while(<IN>) { | ||
| 32 | if (/^DECLARE_STACK_OF\(([^)]+)\)/) { | ||
| 33 | push @stacklst, $1; | ||
| 34 | } if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) { | ||
| 35 | push @asn1setlst, $1; | ||
| 36 | } if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) { | ||
| 37 | push @p12stklst, $1; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | close(IN); | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | my $old_stackfile = ""; | ||
| 46 | my $new_stackfile = ""; | ||
| 47 | my $inside_block = 0; | ||
| 48 | my $type_thing; | ||
| 49 | |||
| 50 | open(IN, "< $safestack.h") || die "Can't open input file: $!"; | ||
| 51 | while(<IN>) { | ||
| 52 | $old_stackfile .= $_; | ||
| 53 | |||
| 54 | if (m|^/\* This block of defines is updated by util/mkstack.pl, please do not touch! \*/|) { | ||
| 55 | $inside_block = 1; | ||
| 56 | } | ||
| 57 | if (m|^/\* End of util/mkstack.pl block, you may now edit :-\) \*/|) { | ||
| 58 | $inside_block = 0; | ||
| 59 | } elsif ($inside_block == 0) { | ||
| 60 | $new_stackfile .= $_; | ||
| 61 | } | ||
| 62 | next if($inside_block != 1); | ||
| 63 | $new_stackfile .= "/* This block of defines is updated by util/mkstack.pl, please do not touch! */"; | ||
| 64 | |||
| 65 | foreach $type_thing (sort @stacklst) { | ||
| 66 | $new_stackfile .= <<EOF; | ||
| 67 | |||
| 68 | #define sk_${type_thing}_new(st) SKM_sk_new($type_thing, (st)) | ||
| 69 | #define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) | ||
| 70 | #define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) | ||
| 71 | #define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) | ||
| 72 | #define sk_${type_thing}_value(st, i) SKM_sk_value($type_thing, (st), (i)) | ||
| 73 | #define sk_${type_thing}_set(st, i, val) SKM_sk_set($type_thing, (st), (i), (val)) | ||
| 74 | #define sk_${type_thing}_zero(st) SKM_sk_zero($type_thing, (st)) | ||
| 75 | #define sk_${type_thing}_push(st, val) SKM_sk_push($type_thing, (st), (val)) | ||
| 76 | #define sk_${type_thing}_unshift(st, val) SKM_sk_unshift($type_thing, (st), (val)) | ||
| 77 | #define sk_${type_thing}_find(st, val) SKM_sk_find($type_thing, (st), (val)) | ||
| 78 | #define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i)) | ||
| 79 | #define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr)) | ||
| 80 | #define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i)) | ||
| 81 | #define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) | ||
| 82 | #define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) | ||
| 83 | #define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) | ||
| 84 | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | ||
| 85 | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | ||
| 86 | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | ||
| 87 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) | ||
| 88 | EOF | ||
| 89 | } | ||
| 90 | foreach $type_thing (sort @asn1setlst) { | ||
| 91 | $new_stackfile .= <<EOF; | ||
| 92 | |||
| 93 | #define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\ | ||
| 94 | SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | ||
| 95 | #define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\ | ||
| 96 | SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) | ||
| 97 | #define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\ | ||
| 98 | SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len)) | ||
| 99 | #define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\ | ||
| 100 | SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func)) | ||
| 101 | EOF | ||
| 102 | } | ||
| 103 | foreach $type_thing (sort @p12stklst) { | ||
| 104 | $new_stackfile .= <<EOF; | ||
| 105 | |||
| 106 | #define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\ | ||
| 107 | SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) | ||
| 108 | EOF | ||
| 109 | } | ||
| 110 | $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; | ||
| 111 | $inside_block = 2; | ||
| 112 | } | ||
| 113 | |||
| 114 | |||
| 115 | if ($new_stackfile eq $old_stackfile) { | ||
| 116 | print "No changes to $safestack.h.\n"; | ||
| 117 | exit 0; # avoid unnecessary rebuild | ||
| 118 | } | ||
| 119 | |||
| 120 | if ($do_write) { | ||
| 121 | print "Writing new $safestack.h.\n"; | ||
| 122 | open OUT, ">$safestack.h" || die "Can't open output file"; | ||
| 123 | print OUT $new_stackfile; | ||
| 124 | close OUT; | ||
| 125 | } | ||
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index 28869c868d..897ae9d824 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-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 "; | 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 "; |
| 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 -d__omf__'; | 54 | $asm='nasmw -f obj'; |
| 55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" /Zi" if $debug; |
| 56 | $afile='-o'; | 56 | $afile='-o'; |
| 57 | 57 | ||
| @@ -106,13 +106,9 @@ sub do_lib_rule | |||
| 106 | $ret.="$target: $objs\n"; | 106 | $ret.="$target: $objs\n"; |
| 107 | if (!$shlib) | 107 | if (!$shlib) |
| 108 | { | 108 | { |
| 109 | $ret.=<<___; | 109 | # $ret.="\t\$(RM) \$(O_$Name)\n"; |
| 110 | -\$(RM) $lfile$target | 110 | $ret.="\techo LIB $<\n"; |
| 111 | \$(MKLIB) $lfile$target \@&&! | 111 | $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n"; |
| 112 | +\$(**: = &^ | ||
| 113 | +) | ||
| 114 | ! | ||
| 115 | ___ | ||
| 116 | } | 112 | } |
| 117 | else | 113 | else |
| 118 | { | 114 | { |
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl index 8dbeaa7a08..75d72ebbcb 100644 --- a/src/lib/libcrypto/util/pl/OS2-EMX.pl +++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl | |||
| @@ -68,7 +68,6 @@ 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"; | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | if ($shlib) | 73 | if ($shlib) |
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index 4e97dfa9af..cf689b9feb 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
| @@ -3,28 +3,15 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | $ssl= "ssleay32"; | 5 | $ssl= "ssleay32"; |
| 6 | 6 | $crypto="libeay32"; | |
| 7 | if ($fips && !$shlib) | ||
| 8 | { | ||
| 9 | $crypto="libeayfips32"; | ||
| 10 | $crypto_compat = "libeaycompat32.lib"; | ||
| 11 | } | ||
| 12 | else | ||
| 13 | { | ||
| 14 | $crypto="libeay32"; | ||
| 15 | } | ||
| 16 | 7 | ||
| 17 | $o='\\'; | 8 | $o='\\'; |
| 18 | $cp='copy nul+'; # Timestamps get stuffed otherwise | 9 | $cp='copy nul+'; # Timestamps get stuffed otherwise |
| 19 | $rm='del'; | 10 | $rm='del'; |
| 20 | 11 | ||
| 21 | $zlib_lib="zlib1.lib"; | ||
| 22 | |||
| 23 | # C compiler stuff | 12 | # C compiler stuff |
| 24 | $cc='cl'; | 13 | $cc='cl'; |
| 25 | $cflags=' /MD /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | 14 | $cflags=' /MD /W3 /WX /G5 /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 | ||
| 28 | $lflags="/nologo /subsystem:console /machine:I386 /opt:ref"; | 15 | $lflags="/nologo /subsystem:console /machine:I386 /opt:ref"; |
| 29 | $mlflags=''; | 16 | $mlflags=''; |
| 30 | 17 | ||
| @@ -113,56 +100,25 @@ $cflags.=" /Fd$out_def"; | |||
| 113 | 100 | ||
| 114 | sub do_lib_rule | 101 | sub do_lib_rule |
| 115 | { | 102 | { |
| 116 | local($objs,$target,$name,$shlib,$ign,$base_addr) = @_; | 103 | local($objs,$target,$name,$shlib)=@_; |
| 117 | local($ret,$Name); | 104 | local($ret,$Name); |
| 118 | 105 | ||
| 119 | $taget =~ s/\//$o/g if $o ne '/'; | 106 | $taget =~ s/\//$o/g if $o ne '/'; |
| 120 | ($Name=$name) =~ tr/a-z/A-Z/; | 107 | ($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 | |||
| 131 | 108 | ||
| 132 | # $target="\$(LIB_D)$o$target"; | 109 | # $target="\$(LIB_D)$o$target"; |
| 110 | $ret.="$target: $objs\n"; | ||
| 133 | if (!$shlib) | 111 | if (!$shlib) |
| 134 | { | 112 | { |
| 135 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | 113 | # $ret.="\t\$(RM) \$(O_$Name)\n"; |
| 136 | $ret.="$target: $objs\n"; | ||
| 137 | $ex =' advapi32.lib'; | 114 | $ex =' advapi32.lib'; |
| 138 | $ex.=" \$(FIPSLIB_D)${o}_chkstk.o" if $fips && $target =~ /O_CRYPTO/; | ||
| 139 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | 115 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; |
| 140 | } | 116 | } |
| 141 | else | 117 | else |
| 142 | { | 118 | { |
| 143 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | 119 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; |
| 144 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; | 120 | $ex.=' wsock32.lib gdi32.lib advapi32.lib'; |
| 145 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | 121 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; |
| 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 | } | ||
| 166 | } | 122 | } |
| 167 | $ret.="\n"; | 123 | $ret.="\n"; |
| 168 | return($ret); | 124 | return($ret); |
| @@ -170,51 +126,20 @@ sub do_lib_rule | |||
| 170 | 126 | ||
| 171 | sub do_link_rule | 127 | sub do_link_rule |
| 172 | { | 128 | { |
| 173 | local($target,$files,$dep_libs,$libs,$standalone)=@_; | 129 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; |
| 174 | local($ret,$_); | 130 | local($ret,$_); |
| 131 | |||
| 175 | $file =~ s/\//$o/g if $o ne '/'; | 132 | $file =~ s/\//$o/g if $o ne '/'; |
| 176 | $n=&bname($targer); | 133 | $n=&bname($targer); |
| 177 | $ret.="$target: $files $dep_libs\n"; | 134 | $ret.="$target: $files $dep_libs\n"; |
| 178 | if ($standalone) | 135 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; |
| 179 | { | 136 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; |
| 180 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; | 137 | if (defined $sha1file) |
| 181 | $ret.="\$(FIPSLIB_D)${o}_chkstk.o " if ($files =~ /O_FIPSCANISTER/); | ||
| 182 | $ret.="$files $libs\n<<\n"; | ||
| 183 | } | ||
| 184 | elsif ($fips && !$shlib) | ||
| 185 | { | 138 | { |
| 186 | $ret.="\tSET FIPS_LINK=\$(LINK)\n"; | 139 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; |
| 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"; | ||
| 195 | } | 140 | } |
| 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"; | ||
| 215 | $ret.="\n"; | 141 | $ret.="\n"; |
| 216 | return($ret); | 142 | return($ret); |
| 217 | } | 143 | } |
| 218 | 144 | ||
| 219 | |||
| 220 | 1; | 145 | 1; |
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl index 546d1ec186..657e4e264e 100644 --- a/src/lib/libcrypto/util/pod2man.pl +++ b/src/lib/libcrypto/util/pod2man.pl | |||
| @@ -425,7 +425,6 @@ 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 | ||
| 429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; | 428 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; |
| 430 | } | 429 | } |
| 431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | 430 | 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 4778c5ab01..e9d5aa8938 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 =~ "[Uu]sage"; | 52 | $cversion=`$cc -V 2>&1` if $cversion =~ "usage"; |
| 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,21 +130,15 @@ if (system("make 2>&1 | tee make.log") > 255) { | |||
| 130 | goto err; | 130 | goto err; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | # Not sure why this is here. The tests themselves can detect if their | 133 | $_=$options; |
| 134 | # particular feature isn't included, and should therefore skip themselves. | 134 | s/no-asm//; |
| 135 | # To skip *all* tests just because one algorithm isn't included is like | 135 | s/no-shared//; |
| 136 | # shooting mosquito with an elephant gun... | 136 | s/no-krb5//; |
| 137 | # -- Richard Levitte, inspired by problem report 1089 | 137 | if (/no-/) |
| 138 | # | 138 | { |
| 139 | #$_=$options; | 139 | print OUT "Test skipped.\n"; |
| 140 | #s/no-asm//; | 140 | goto err; |
| 141 | #s/no-shared//; | 141 | } |
| 142 | #s/no-krb5//; | ||
| 143 | #if (/no-/) | ||
| 144 | #{ | ||
| 145 | # print OUT "Test skipped.\n"; | ||
| 146 | # goto err; | ||
| 147 | #} | ||
| 148 | 142 | ||
| 149 | print "Running make test...\n"; | 143 | print "Running make test...\n"; |
| 150 | if (system("make test 2>&1 | tee maketest.log") > 255) | 144 | if (system("make test 2>&1 | tee maketest.log") > 255) |
