summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/util')
-rw-r--r--src/lib/libcrypto/util/copy.pl70
-rw-r--r--src/lib/libcrypto/util/extract-section.pl12
-rw-r--r--src/lib/libcrypto/util/libeay.num180
-rw-r--r--src/lib/libcrypto/util/mk1mf.pl406
-rw-r--r--src/lib/libcrypto/util/mkdef.pl21
-rw-r--r--src/lib/libcrypto/util/mkerr.pl714
-rw-r--r--src/lib/libcrypto/util/mkfiles.pl10
-rw-r--r--src/lib/libcrypto/util/mklink.pl12
-rw-r--r--src/lib/libcrypto/util/mkstack.pl126
-rw-r--r--src/lib/libcrypto/util/pl/VC-32.pl180
-rw-r--r--src/lib/libcrypto/util/pl/netware.pl526
11 files changed, 1595 insertions, 662 deletions
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl
new file mode 100644
index 0000000000..eba6d5815e
--- /dev/null
+++ b/src/lib/libcrypto/util/copy.pl
@@ -0,0 +1,70 @@
1#!/usr/local/bin/perl
2
3use Fcntl;
4
5
6# copy.pl
7
8# Perl script 'copy' comment. On Windows the built in "copy" command also
9# copies timestamps: this messes up Makefile dependencies.
10
11my $stripcr = 0;
12
13my $arg;
14
15foreach $arg (@ARGV) {
16 if ($arg eq "-stripcr")
17 {
18 $stripcr = 1;
19 next;
20 }
21 $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
22 foreach (glob $arg)
23 {
24 push @filelist, $_;
25 }
26}
27
28$fnum = @filelist;
29
30if ($fnum <= 1)
31 {
32 die "Need at least two filenames";
33 }
34
35$dest = pop @filelist;
36
37if ($fnum > 2 && ! -d $dest)
38 {
39 die "Destination must be a directory";
40 }
41
42foreach (@filelist)
43 {
44 if (-d $dest)
45 {
46 $dfile = $_;
47 $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
48 $dfile = "$dest/$dfile";
49 }
50 else
51 {
52 $dfile = $dest;
53 }
54 sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
55 sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
56 || die "Can't Open $dfile";
57 while (sysread IN, $buf, 10240)
58 {
59 if ($stripcr)
60 {
61 $buf =~ tr/\015//d;
62 }
63 syswrite(OUT, $buf, length($buf));
64 }
65 close(IN);
66 close(OUT);
67 print "Copying: $_ to $dfile\n";
68 }
69
70
diff --git a/src/lib/libcrypto/util/extract-section.pl b/src/lib/libcrypto/util/extract-section.pl
new file mode 100644
index 0000000000..7a0ba4f69a
--- /dev/null
+++ b/src/lib/libcrypto/util/extract-section.pl
@@ -0,0 +1,12 @@
1#!/usr/bin/perl
2
3while(<STDIN>) {
4 if (/=for\s+comment\s+openssl_manual_section:(\S+)/)
5 {
6 print "$1\n";
7 exit 0;
8 }
9}
10
11print "$ARGV[0]\n";
12
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num
index 0eb54ddc89..62664f3c37 100644
--- a/src/lib/libcrypto/util/libeay.num
+++ b/src/lib/libcrypto/util/libeay.num
@@ -2804,12 +2804,12 @@ OPENSSL_cleanse 3245 EXIST::FUNCTION:
2804ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE 2804ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE
2805ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH 2805ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH
2806EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES 2806EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES
2807FIPS_corrupt_rsa 3249 EXIST:OPENSSL_FIPS:FUNCTION: 2807FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION:
2808FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION: 2808FIPS_selftest_des 3250 NOEXIST::FUNCTION:
2809EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES 2809EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES
2810EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES 2810EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES
2811FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: 2811FIPS_mode_set 3253 NOEXIST::FUNCTION:
2812FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: 2812FIPS_selftest_dsa 3254 NOEXIST::FUNCTION:
2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES 2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES
2814FIPS_allow_md5 3256 NOEXIST::FUNCTION: 2814FIPS_allow_md5 3256 NOEXIST::FUNCTION:
2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES 2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES
@@ -2817,44 +2817,44 @@ EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES
2817FIPS_rand_seeded 3259 NOEXIST::FUNCTION: 2817FIPS_rand_seeded 3259 NOEXIST::FUNCTION:
2818AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES 2818AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES
2819AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES 2819AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES
2820FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION: 2820FIPS_rand_seed 3262 NOEXIST::FUNCTION:
2821FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION: 2821FIPS_corrupt_des 3263 NOEXIST::FUNCTION:
2822EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES 2822EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES
2823FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION: 2823FIPS_selftest_aes 3265 NOEXIST::FUNCTION:
2824FIPS_set_prng_key 3266 NOEXIST::FUNCTION: 2824FIPS_set_prng_key 3266 NOEXIST::FUNCTION:
2825EVP_des_cfb8 3267 EXIST::FUNCTION:DES 2825EVP_des_cfb8 3267 EXIST::FUNCTION:DES
2826FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION: 2826FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION:
2827FIPS_test_mode 3269 NOEXIST::FUNCTION: 2827FIPS_test_mode 3269 NOEXIST::FUNCTION:
2828FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION: 2828FIPS_rand_method 3270 NOEXIST::FUNCTION:
2829EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES 2829EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES
2830ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION: 2830ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION:
2831FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION: 2831FIPS_corrupt_aes 3273 NOEXIST::FUNCTION:
2832FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION: 2832FIPS_selftest_sha1 3274 NOEXIST::FUNCTION:
2833FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION: 2833FIPS_selftest_rsa 3275 NOEXIST::FUNCTION:
2834FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION: 2834FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION:
2835EVP_des_cfb1 3277 EXIST::FUNCTION:DES 2835EVP_des_cfb1 3277 EXIST::FUNCTION:DES
2836FIPS_dsa_check 3278 NOEXIST::FUNCTION: 2836FIPS_dsa_check 3278 NOEXIST::FUNCTION:
2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES 2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES
2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES 2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES
2839FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: 2839FIPS_rand_check 3281 NOEXIST::FUNCTION:
2840FIPS_md5_allowed 3282 NOEXIST::FUNCTION: 2840FIPS_md5_allowed 3282 NOEXIST::FUNCTION:
2841FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: 2841FIPS_mode 3283 NOEXIST::FUNCTION:
2842FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: 2842FIPS_selftest_failed 3284 NOEXIST::FUNCTION:
2843sk_is_sorted 3285 EXIST::FUNCTION: 2843sk_is_sorted 3285 EXIST::FUNCTION:
2844X509_check_ca 3286 EXIST::FUNCTION: 2844X509_check_ca 3286 EXIST::FUNCTION:
2845private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA 2845private_idea_set_encrypt_key 3287 NOEXIST::FUNCTION:
2846HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC 2846HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC
2847private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0 2847private_SHA_Init 3289 NOEXIST::FUNCTION:
2848private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST 2848private_CAST_set_key 3290 NOEXIST::FUNCTION:
2849private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD 2849private_RIPEMD160_Init 3291 NOEXIST::FUNCTION:
2850private_RC5_32_set_key 3292 EXIST:OPENSSL_FIPS:FUNCTION:RC5 2850private_RC5_32_set_key 3292 NOEXIST::FUNCTION:
2851private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5 2851private_MD5_Init 3293 NOEXIST::FUNCTION:
2852private_RC4_set_key 3294 EXIST:OPENSSL_FIPS:FUNCTION:RC4 2852private_RC4_set_key 3294 NOEXIST::FUNCTION:
2853private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2 2853private_MDC2_Init 3295 NOEXIST::FUNCTION:
2854private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2 2854private_RC2_set_key 3296 NOEXIST::FUNCTION:
2855private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4 2855private_MD4_Init 3297 NOEXIST::FUNCTION:
2856private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF 2856private_BF_set_key 3298 NOEXIST::FUNCTION:
2857private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2 2857private_MD2_Init 3299 NOEXIST::FUNCTION:
2858d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: 2858d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION:
2859PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: 2859PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2860PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: 2860PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
@@ -2868,13 +2868,13 @@ PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI
2868PROXY_POLICY_free 3308 EXIST::FUNCTION: 2868PROXY_POLICY_free 3308 EXIST::FUNCTION:
2869PROXY_POLICY_new 3309 EXIST::FUNCTION: 2869PROXY_POLICY_new 3309 EXIST::FUNCTION:
2870BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: 2870BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION:
2871FIPS_selftest_rng 3311 EXIST:OPENSSL_FIPS:FUNCTION: 2871FIPS_selftest_rng 3311 NOEXIST::FUNCTION:
2872EVP_sha384 3312 EXIST::FUNCTION:SHA,SHA512 2872EVP_sha384 3312 EXIST::FUNCTION:SHA,SHA512
2873EVP_sha512 3313 EXIST::FUNCTION:SHA,SHA512 2873EVP_sha512 3313 EXIST::FUNCTION:SHA,SHA512
2874EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256 2874EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256
2875EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256 2875EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256
2876FIPS_selftest_hmac 3316 EXIST:OPENSSL_FIPS:FUNCTION: 2876FIPS_selftest_hmac 3316 NOEXIST::FUNCTION:
2877FIPS_corrupt_rng 3317 EXIST:OPENSSL_FIPS:FUNCTION: 2877FIPS_corrupt_rng 3317 NOEXIST::FUNCTION:
2878BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: 2878BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION:
2879RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA 2879RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA
2880RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA 2880RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA
@@ -2882,7 +2882,7 @@ RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA
2882RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA 2882RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA
2883RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA 2883RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA
2884PKCS1_MGF1 3324 EXIST::FUNCTION:RSA 2884PKCS1_MGF1 3324 EXIST::FUNCTION:RSA
2885BN_X931_generate_Xpq 3325 EXIST::FUNCTION: 2885BN_X931_generate_Xpq 3325 NOEXIST::FUNCTION:
2886RSA_X931_generate_key 3326 NOEXIST::FUNCTION: 2886RSA_X931_generate_key 3326 NOEXIST::FUNCTION:
2887BN_X931_derive_prime 3327 NOEXIST::FUNCTION: 2887BN_X931_derive_prime 3327 NOEXIST::FUNCTION:
2888BN_X931_generate_prime 3328 NOEXIST::FUNCTION: 2888BN_X931_generate_prime 3328 NOEXIST::FUNCTION:
@@ -3652,75 +3652,51 @@ CMS_set1_eContentType 4040 EXIST::FUNCTION:CMS
3652CMS_ReceiptRequest_create0 4041 EXIST::FUNCTION:CMS 3652CMS_ReceiptRequest_create0 4041 EXIST::FUNCTION:CMS
3653CMS_add1_signer 4042 EXIST::FUNCTION:CMS 3653CMS_add1_signer 4042 EXIST::FUNCTION:CMS
3654CMS_RecipientInfo_set0_pkey 4043 EXIST::FUNCTION:CMS 3654CMS_RecipientInfo_set0_pkey 4043 EXIST::FUNCTION:CMS
3655ENGINE_set_load_ssl_client_cert_function 4044 EXIST:!VMS:FUNCTION:ENGINE 3655ENGINE_set_load_ssl_client_cert_function 4044 EXIST::FUNCTION:ENGINE
3656ENGINE_set_ld_ssl_clnt_cert_fn 4044 EXIST:VMS:FUNCTION:ENGINE 3656ENGINE_get_ssl_client_cert_function 4045 EXIST::FUNCTION:ENGINE
3657ENGINE_get_ssl_client_cert_function 4045 EXIST:!VMS:FUNCTION:ENGINE
3658ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE
3659ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE 3657ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE
3660ENGINE_load_capi 4047 EXIST::FUNCTION:CAPIENG,ENGINE 3658ENGINE_load_capi 4047 EXIST::FUNCTION:CAPIENG,ENGINE
3661OPENSSL_isservice 4048 EXIST::FUNCTION: 3659OPENSSL_isservice 4048 EXIST::FUNCTION:
3662FIPS_dsa_sig_decode 4049 EXIST:OPENSSL_FIPS:FUNCTION:DSA 3660FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION:
3663EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION: 3661EVP_CIPHER_CTX_clear_flags 4050 NOEXIST::FUNCTION:
3664FIPS_rand_status 4051 EXIST:OPENSSL_FIPS:FUNCTION: 3662FIPS_rand_status 4051 NOEXIST::FUNCTION:
3665FIPS_rand_set_key 4052 EXIST:OPENSSL_FIPS:FUNCTION: 3663FIPS_rand_set_key 4052 NOEXIST::FUNCTION:
3666CRYPTO_set_mem_info_functions 4053 EXIST::FUNCTION: 3664CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION:
3667RSA_X931_generate_key_ex 4054 EXIST::FUNCTION:RSA 3665RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION:
3668int_ERR_set_state_func 4055 EXIST:OPENSSL_FIPS:FUNCTION: 3666int_ERR_set_state_func 4055 NOEXIST::FUNCTION:
3669int_EVP_MD_set_engine_callbacks 4056 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3667int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION:
3670int_CRYPTO_set_do_dynlock_callback 4057 EXIST::FUNCTION: 3668int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION:
3671FIPS_rng_stick 4058 EXIST:OPENSSL_FIPS:FUNCTION: 3669FIPS_rng_stick 4058 NOEXIST::FUNCTION:
3672EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION: 3670EVP_CIPHER_CTX_set_flags 4059 NOEXIST::FUNCTION:
3673BN_X931_generate_prime_ex 4060 EXIST::FUNCTION: 3671BN_X931_generate_prime_ex 4060 NOEXIST::FUNCTION:
3674FIPS_selftest_check 4061 EXIST:OPENSSL_FIPS:FUNCTION: 3672FIPS_selftest_check 4061 NOEXIST::FUNCTION:
3675FIPS_rand_set_dt 4062 EXIST:OPENSSL_FIPS:FUNCTION: 3673FIPS_rand_set_dt 4062 NOEXIST::FUNCTION:
3676CRYPTO_dbg_pop_info 4063 EXIST::FUNCTION: 3674CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION:
3677FIPS_dsa_free 4064 EXIST:OPENSSL_FIPS:FUNCTION:DSA 3675FIPS_dsa_free 4064 NOEXIST::FUNCTION:
3678RSA_X931_derive_ex 4065 EXIST::FUNCTION:RSA 3676RSA_X931_derive_ex 4065 NOEXIST::FUNCTION:
3679FIPS_rsa_new 4066 EXIST:OPENSSL_FIPS:FUNCTION:RSA 3677FIPS_rsa_new 4066 NOEXIST::FUNCTION:
3680FIPS_rand_bytes 4067 EXIST:OPENSSL_FIPS:FUNCTION: 3678FIPS_rand_bytes 4067 NOEXIST::FUNCTION:
3681fips_cipher_test 4068 EXIST:OPENSSL_FIPS:FUNCTION: 3679fips_cipher_test 4068 NOEXIST::FUNCTION:
3682EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION: 3680EVP_CIPHER_CTX_test_flags 4069 NOEXIST::FUNCTION:
3683CRYPTO_malloc_debug_init 4070 EXIST::FUNCTION: 3681CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION:
3684CRYPTO_dbg_push_info 4071 EXIST::FUNCTION: 3682CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION:
3685FIPS_corrupt_rsa_keygen 4072 EXIST:OPENSSL_FIPS:FUNCTION: 3683FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION:
3686FIPS_dh_new 4073 EXIST:OPENSSL_FIPS:FUNCTION:DH 3684FIPS_dh_new 4073 NOEXIST::FUNCTION:
3687FIPS_corrupt_dsa_keygen 4074 EXIST:OPENSSL_FIPS:FUNCTION: 3685FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION:
3688FIPS_dh_free 4075 EXIST:OPENSSL_FIPS:FUNCTION:DH 3686FIPS_dh_free 4075 NOEXIST::FUNCTION:
3689fips_pkey_signature_test 4076 EXIST:OPENSSL_FIPS:FUNCTION: 3687fips_pkey_signature_test 4076 NOEXIST::FUNCTION:
3690EVP_add_alg_module 4077 EXIST::FUNCTION: 3688EVP_add_alg_module 4077 NOEXIST::FUNCTION:
3691int_RAND_init_engine_callbacks 4078 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3689int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION:
3692int_EVP_CIPHER_set_engine_callbacks 4079 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3690int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION:
3693int_EVP_MD_init_engine_callbacks 4080 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3691int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION:
3694FIPS_rand_test_mode 4081 EXIST:OPENSSL_FIPS:FUNCTION: 3692FIPS_rand_test_mode 4081 NOEXIST::FUNCTION:
3695FIPS_rand_reset 4082 EXIST:OPENSSL_FIPS:FUNCTION: 3693FIPS_rand_reset 4082 NOEXIST::FUNCTION:
3696FIPS_dsa_new 4083 EXIST:OPENSSL_FIPS:FUNCTION:DSA 3694FIPS_dsa_new 4083 NOEXIST::FUNCTION:
3697int_RAND_set_callbacks 4084 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3695int_RAND_set_callbacks 4084 NOEXIST::FUNCTION:
3698BN_X931_derive_prime_ex 4085 EXIST::FUNCTION: 3696BN_X931_derive_prime_ex 4085 NOEXIST::FUNCTION:
3699int_ERR_lib_init 4086 EXIST:OPENSSL_FIPS:FUNCTION: 3697int_ERR_lib_init 4086 NOEXIST::FUNCTION:
3700int_EVP_CIPHER_init_engine_callbacks 4087 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE 3698int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION:
3701FIPS_rsa_free 4088 EXIST:OPENSSL_FIPS:FUNCTION:RSA 3699FIPS_rsa_free 4088 NOEXIST::FUNCTION:
3702FIPS_dsa_sig_encode 4089 EXIST:OPENSSL_FIPS:FUNCTION:DSA 3700FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION:
3703CRYPTO_dbg_remove_all_info 4090 EXIST::FUNCTION: 3701CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION:
3704OPENSSL_init 4091 EXIST::FUNCTION: 3702OPENSSL_init 4091 NOEXIST::FUNCTION:
3705private_Camellia_set_key 4092 EXIST:OPENSSL_FIPS:FUNCTION:CAMELLIA
3706CRYPTO_strdup 4093 EXIST::FUNCTION:
3707JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE
3708JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE
3709JPAKE_get_shared_key 4096 EXIST::FUNCTION:JPAKE
3710JPAKE_STEP3B_init 4097 EXIST::FUNCTION:JPAKE
3711JPAKE_STEP1_generate 4098 EXIST::FUNCTION:JPAKE
3712JPAKE_STEP1_init 4099 EXIST::FUNCTION:JPAKE
3713JPAKE_STEP3B_process 4100 EXIST::FUNCTION:JPAKE
3714JPAKE_STEP2_generate 4101 EXIST::FUNCTION:JPAKE
3715JPAKE_CTX_new 4102 EXIST::FUNCTION:JPAKE
3716JPAKE_CTX_free 4103 EXIST::FUNCTION:JPAKE
3717JPAKE_STEP3B_release 4104 EXIST::FUNCTION:JPAKE
3718JPAKE_STEP3A_release 4105 EXIST::FUNCTION:JPAKE
3719JPAKE_STEP2_process 4106 EXIST::FUNCTION:JPAKE
3720JPAKE_STEP3B_generate 4107 EXIST::FUNCTION:JPAKE
3721JPAKE_STEP1_process 4108 EXIST::FUNCTION:JPAKE
3722JPAKE_STEP3A_generate 4109 EXIST::FUNCTION:JPAKE
3723JPAKE_STEP2_release 4110 EXIST::FUNCTION:JPAKE
3724JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE
3725ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE
3726JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl
index f2b92b2b25..7ba804ce33 100644
--- a/src/lib/libcrypto/util/mk1mf.pl
+++ b/src/lib/libcrypto/util/mk1mf.pl
@@ -15,18 +15,6 @@ my $engines = "";
15local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic 15local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
16local $zlib_lib = ""; 16local $zlib_lib = "";
17 17
18local $fips_canister_path = "";
19my $fips_premain_dso_exe_path = "";
20my $fips_premain_c_path = "";
21my $fips_sha1_exe_path = "";
22
23local $fipscanisterbuild = 0;
24local $fipsdso = 0;
25
26my $fipslibdir = "";
27my $baseaddr = "";
28
29my $ex_l_libs = "";
30 18
31open(IN,"<Makefile") || die "unable to open Makefile!\n"; 19open(IN,"<Makefile") || die "unable to open Makefile!\n";
32while(<IN>) { 20while(<IN>) {
@@ -233,7 +221,6 @@ $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2;
233$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; 221$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
234$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; 222$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
235$cflags.=" -DOPENSSL_NO_CMS" if $no_cms; 223$cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
236$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake;
237$cflags.=" -DOPENSSL_NO_CAPIENG" if $no_capieng; 224$cflags.=" -DOPENSSL_NO_CAPIENG" if $no_capieng;
238$cflags.=" -DOPENSSL_NO_ERR" if $no_err; 225$cflags.=" -DOPENSSL_NO_ERR" if $no_err;
239$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; 226$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
@@ -242,7 +229,7 @@ $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa;
242$cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; 229$cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
243$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; 230$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
244$cflags.=" -DOPENSSL_NO_HW" if $no_hw; 231$cflags.=" -DOPENSSL_NO_HW" if $no_hw;
245$cflags.=" -DOPENSSL_FIPS" if $fips; 232
246$cflags.= " -DZLIB" if $zlib_opt; 233$cflags.= " -DZLIB" if $zlib_opt;
247$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; 234$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
248 235
@@ -264,9 +251,9 @@ else
264 251
265$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); 252$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
266 253
254
267%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", 255%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
268 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO", 256 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
269 "FIPS" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
270 257
271if ($msdos) 258if ($msdos)
272 { 259 {
@@ -294,21 +281,11 @@ for (;;)
294 { 281 {
295 if ($lib ne "") 282 if ($lib ne "")
296 { 283 {
297 if ($fips && $dir =~ /^fips/) 284 $uc=$lib;
298 { 285 $uc =~ s/^lib(.*)\.a/$1/;
299 $uc = "FIPS"; 286 $uc =~ tr/a-z/A-Z/;
300 } 287 $lib_nam{$uc}=$uc;
301 else 288 $lib_obj{$uc}.=$libobj." ";
302 {
303 $uc=$lib;
304 $uc =~ s/^lib(.*)\.a/$1/;
305 $uc =~ tr/a-z/A-Z/;
306 }
307 if (($uc ne "FIPS") || $fipscanisterbuild)
308 {
309 $lib_nam{$uc}=$uc;
310 $lib_obj{$uc}.=$libobj." ";
311 }
312 } 289 }
313 last if ($val eq "FINISHED"); 290 last if ($val eq "FINISHED");
314 $lib=""; 291 $lib="";
@@ -351,130 +328,11 @@ for (;;)
351 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) 328 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
352 { $engines.=$val } 329 { $engines.=$val }
353 330
354 if ($key eq "FIPS_EX_OBJ")
355 {
356 $fips_ex_obj=&var_add("crypto",$val,0);
357 }
358
359 if ($key eq "FIPSLIBDIR")
360 {
361 $fipslibdir=$val;
362 $fipslibdir =~ s/\/$//;
363 $fipslibdir =~ s/\//$o/g;
364 }
365
366 if ($key eq "BASEADDR")
367 { $baseaddr=$val;}
368
369 if (!($_=<IN>)) 331 if (!($_=<IN>))
370 { $_="RELATIVE_DIRECTORY=FINISHED\n"; } 332 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
371 } 333 }
372close(IN); 334close(IN);
373 335
374if ($fips)
375 {
376
377 foreach (split " ", $fips_ex_obj)
378 {
379 $fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/);
380 }
381
382 $fips_exclude_obj{"cpu_win32"} = 1;
383 $fips_exclude_obj{"bn_asm"} = 1;
384 $fips_exclude_obj{"des_enc"} = 1;
385 $fips_exclude_obj{"fcrypt_b"} = 1;
386 $fips_exclude_obj{"aes_core"} = 1;
387 $fips_exclude_obj{"aes_cbc"} = 1;
388
389 my @ltmp = split " ", $lib_obj{"CRYPTO"};
390
391
392 $lib_obj{"CRYPTO"} = "";
393
394 foreach(@ltmp)
395 {
396 if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1})
397 {
398 if ($fipscanisterbuild)
399 {
400 $lib_obj{"FIPS"} .= "$_ ";
401 }
402 }
403 else
404 {
405 $lib_obj{"CRYPTO"} .= "$_ ";
406 }
407 }
408
409 }
410
411if ($fipscanisterbuild)
412 {
413 $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq "";
414 $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c";
415 }
416else
417 {
418 if ($fips_canister_path eq "")
419 {
420 $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib";
421 }
422
423 if ($fips_premain_c_path eq "")
424 {
425 $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c";
426 }
427 }
428
429if ($fips)
430 {
431 if ($fips_sha1_exe_path eq "")
432 {
433 $fips_sha1_exe_path =
434 "\$(BIN_D)${o}fips_standalone_sha1$exep";
435 }
436 }
437 else
438 {
439 $fips_sha1_exe_path = "";
440 }
441
442if ($fips_premain_dso_exe_path eq "")
443 {
444 $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep";
445 }
446
447# $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips);
448
449#$ex_l_libs .= " \$(L_FIPS)" if $fipsdso;
450
451if ($fips)
452 {
453 if (!$shlib)
454 {
455 $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
456 $ex_l_libs .= " \$(O_FIPSCANISTER)";
457 $ex_libs_dep .= " \$(O_FIPSCANISTER)" if $fipscanisterbuild;
458 }
459 if ($fipscanisterbuild)
460 {
461 $fipslibdir = "\$(LIB_D)";
462 }
463 else
464 {
465 if ($fipslibdir eq "")
466 {
467 open (IN, "util/fipslib_path.txt") || fipslib_error();
468 $fipslibdir = <IN>;
469 chomp $fipslibdir;
470 close IN;
471 }
472 fips_check_files($fipslibdir,
473 "fipscanister.lib", "fipscanister.lib.sha1",
474 "fips_premain.c", "fips_premain.c.sha1");
475 }
476 }
477
478if ($shlib) 336if ($shlib)
479 { 337 {
480 $extra_install= <<"EOF"; 338 $extra_install= <<"EOF";
@@ -540,7 +398,6 @@ SRC_D=$src_dir
540LINK=$link 398LINK=$link
541LFLAGS=$lflags 399LFLAGS=$lflags
542RSC=$rsc 400RSC=$rsc
543FIPSLINK=\$(PERL) util${o}fipslink.pl
544 401
545AES_ASM_OBJ=$aes_asm_obj 402AES_ASM_OBJ=$aes_asm_obj
546AES_ASM_SRC=$aes_asm_src 403AES_ASM_SRC=$aes_asm_src
@@ -584,17 +441,6 @@ MKLIB=$bin_dir$mklib
584MLFLAGS=$mlflags 441MLFLAGS=$mlflags
585ASM=$bin_dir$asm 442ASM=$bin_dir$asm
586 443
587# FIPS validated module and support file locations
588
589E_PREMAIN_DSO=fips_premain_dso
590
591FIPSLIB_D=$fipslibdir
592BASEADDR=$baseaddr
593FIPS_PREMAIN_SRC=$fips_premain_c_path
594O_FIPSCANISTER=$fips_canister_path
595FIPS_SHA1_EXE=$fips_sha1_exe_path
596PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
597
598###################################################### 444######################################################
599# You should not need to touch anything below this point 445# You should not need to touch anything below this point
600###################################################### 446######################################################
@@ -602,7 +448,6 @@ PREMAIN_DSO_EXE=$fips_premain_dso_exe_path
602E_EXE=openssl 448E_EXE=openssl
603SSL=$ssl 449SSL=$ssl
604CRYPTO=$crypto 450CRYPTO=$crypto
605LIBFIPS=libosslfips
606 451
607# BIN_D - Binary output directory 452# BIN_D - Binary output directory
608# TEST_D - Binary test file output directory 453# TEST_D - Binary test file output directory
@@ -623,14 +468,12 @@ INCL_D=\$(TMP_D)
623 468
624O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp 469O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
625O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp 470O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
626O_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$shlibp
627SO_SSL= $plib\$(SSL)$so_shlibp 471SO_SSL= $plib\$(SSL)$so_shlibp
628SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp 472SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
629L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp 473L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
630L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp 474L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
631L_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$libp
632 475
633L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs 476L_LIBS= \$(L_SSL) \$(L_CRYPTO)
634 477
635###################################################### 478######################################################
636# Don't touch anything below this point 479# Don't touch anything below this point
@@ -640,13 +483,13 @@ INC=-I\$(INC_D) -I\$(INCL_D)
640APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) 483APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
641LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) 484LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
642SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) 485SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
643LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep 486LIBS_DEP=\$(O_CRYPTO) \$(O_SSL)
644 487
645############################################# 488#############################################
646EOF 489EOF
647 490
648$rules=<<"EOF"; 491$rules=<<"EOF";
649all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets 492all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe
650 493
651banner: 494banner:
652$banner 495$banner
@@ -761,26 +604,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
761$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); 604$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
762$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); 605$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
763 606
764# Special case rules for fips_start and fips_end fips_premain_dso
765
766if ($fips)
767 {
768 if ($fipscanisterbuild)
769 {
770 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj",
771 "fips${o}fips_canister.c",
772 "-DFIPS_START \$(SHLIB_CFLAGS)");
773 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj",
774 "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)");
775 }
776 $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
777 "fips${o}sha${o}fips_standalone_sha1.c",
778 "\$(SHLIB_CFLAGS)");
779 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
780 "fips${o}fips_premain.c",
781 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)");
782 }
783
784foreach (values %lib_nam) 607foreach (values %lib_nam)
785 { 608 {
786 $lib_obj=$lib_obj{$_}; 609 $lib_obj=$lib_obj{$_};
@@ -791,41 +614,27 @@ foreach (values %lib_nam)
791 $rules.="\$(O_SSL):\n\n"; 614 $rules.="\$(O_SSL):\n\n";
792 next; 615 next;
793 } 616 }
794 617 if (($aes_asm_obj ne "") && ($_ eq "CRYPTO"))
795 if ((!$fips && ($_ eq "CRYPTO")) || ($fips && ($_ eq "FIPS")))
796 { 618 {
797 if ($cpuid_asm_obj ne "") 619 $lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/;
798 { 620 $lib_obj =~ s/\s\S*\/aes_cbc\S*//;
799 $lib_obj =~ s/(\S*\/cryptlib\S*)/$1 \$(CPUID_ASM_OBJ)/; 621 $rules.=&do_asm_rule($aes_asm_obj,$aes_asm_src);
800 $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src); 622 }
801 } 623 if (($bn_asm_obj ne "") && ($_ eq "CRYPTO"))
802 if ($aes_asm_obj ne "") 624 {
803 { 625 $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/;
804 $lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/; 626 $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src);
805 $lib_obj =~ s/\s\S*\/aes_cbc\S*//; 627 }
806 $rules.=&do_asm_rule($aes_asm_obj,$aes_asm_src); 628 if (($bnco_asm_obj ne "") && ($_ eq "CRYPTO"))
807 } 629 {
808 if ($sha1_asm_obj ne "") 630 $lib_obj .= "\$(BNCO_ASM_OBJ)";
809 { 631 $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src);
810 $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/; 632 }
811 $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src); 633 if (($des_enc_obj ne "") && ($_ eq "CRYPTO"))
812 } 634 {
813 if ($bn_asm_obj ne "") 635 $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/;
814 { 636 $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /;
815 $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; 637 $rules.=&do_asm_rule($des_enc_obj,$des_enc_src);
816 $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src);
817 }
818 if ($bnco_asm_obj ne "")
819 {
820 $lib_obj .= "\$(BNCO_ASM_OBJ)";
821 $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src);
822 }
823 if ($des_enc_obj ne "")
824 {
825 $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/;
826 $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /;
827 $rules.=&do_asm_rule($des_enc_obj,$des_enc_src);
828 }
829 } 638 }
830 if (($bf_enc_obj ne "") && ($_ eq "CRYPTO")) 639 if (($bf_enc_obj ne "") && ($_ eq "CRYPTO"))
831 { 640 {
@@ -852,11 +661,21 @@ foreach (values %lib_nam)
852 $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/; 661 $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/;
853 $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src); 662 $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src);
854 } 663 }
664 if (($sha1_asm_obj ne "") && ($_ eq "CRYPTO"))
665 {
666 $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/;
667 $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src);
668 }
855 if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO")) 669 if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO"))
856 { 670 {
857 $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/; 671 $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/;
858 $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src); 672 $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src);
859 } 673 }
674 if (($cpuid_asm_obj ne "") && ($_ eq "CRYPTO"))
675 {
676 $lib_obj =~ s/\s(\S*\/cversion\S*)/ $1 \$(CPUID_ASM_OBJ)/;
677 $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src);
678 }
860 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); 679 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
861 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; 680 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
862 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); 681 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
@@ -871,43 +690,15 @@ if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) {
871\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc 690\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
872 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc 691 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
873 692
874\$(OBJ_D)\\\$(LIBFIPS).res: ms\\version32.rc
875 \$(RSC) /fo"\$(OBJ_D)\\\$(LIBFIPS).res" /d FIPS ms\\version32.rc
876
877EOF 693EOF
878} 694}
879 695
880$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); 696$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
881foreach (split(/\s+/,$test)) 697foreach (split(/\s+/,$test))
882 { 698 {
883 my $t_libs;
884 $t=&bname($_); 699 $t=&bname($_);
885 my $ltype;
886 # Check to see if test program is FIPS
887 if ($fips && /fips/)
888 {
889 # If fipsdso link to libosslfips.dll
890 # otherwise perform static link to
891 # $(O_FIPSCANISTER)
892 if ($fipsdso)
893 {
894 $t_libs = "\$(L_FIPS)";
895 $ltype = 0;
896 }
897 else
898 {
899 $t_libs = "\$(O_FIPSCANISTER)";
900 $ltype = 2;
901 }
902 }
903 else
904 {
905 $t_libs = "\$(L_LIBS)";
906 $ltype = 0;
907 }
908
909 $tt="\$(OBJ_D)${o}$t${obj}"; 700 $tt="\$(OBJ_D)${o}$t${obj}";
910 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype); 701 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
911 } 702 }
912 703
913$defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); 704$defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp);
@@ -921,69 +712,9 @@ foreach (split(/\s+/,$engines))
921 712
922 713
923$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); 714$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
715$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
924 716
925if ($fips) 717$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
926 {
927 if ($shlib)
928 {
929 if ($fipsdso)
930 {
931 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
932 "\$(O_CRYPTO)", "$crypto",
933 $shlib, "", "");
934 $rules.= &do_lib_rule(
935 "\$(O_FIPSCANISTER)",
936 "\$(O_FIPS)", "\$(LIBFIPS)",
937 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
938 $rules.= &do_sdef_rule();
939 }
940 else
941 {
942 $rules.= &do_lib_rule(
943 "\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
944 "\$(O_CRYPTO)", "$crypto",
945 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
946 }
947 }
948 else
949 {
950 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
951 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
952 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(FIPSOBJ)",
953 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
954 }
955 }
956 else
957 {
958 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
959 "\$(SO_CRYPTO)");
960 }
961
962if ($fips)
963 {
964 if ($fipscanisterbuild)
965 {
966 $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)",
967 "\$(OBJ_D)${o}fips_start$obj",
968 "\$(FIPSOBJ)",
969 "\$(OBJ_D)${o}fips_end$obj",
970 "\$(FIPS_SHA1_EXE)", "");
971 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
972 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(SHA1_ASM_OBJ)",
973 "","\$(EX_LIBS)", 1);
974 }
975 else
976 {
977 $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)",
978 "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)",
979 "","", 1);
980
981 }
982 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
983
984 }
985
986$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
987 718
988print $defs; 719print $defs;
989 720
@@ -1021,8 +752,6 @@ sub var_add
1021 return("") if $no_dh && $dir =~ /\/dh/; 752 return("") if $no_dh && $dir =~ /\/dh/;
1022 return("") if $no_ec && $dir =~ /\/ec/; 753 return("") if $no_ec && $dir =~ /\/ec/;
1023 return("") if $no_cms && $dir =~ /\/cms/; 754 return("") if $no_cms && $dir =~ /\/cms/;
1024 return("") if $no_jpake && $dir =~ /\/jpake/;
1025 return("") if !$fips && $dir =~ /^fips/;
1026 if ($no_des && $dir =~ /\/des/) 755 if ($no_des && $dir =~ /\/des/)
1027 { 756 {
1028 if ($val =~ /read_pwd/) 757 if ($val =~ /read_pwd/)
@@ -1282,7 +1011,6 @@ sub read_options
1282 "no-hmac" => \$no_hmac, 1011 "no-hmac" => \$no_hmac,
1283 "no-asm" => \$no_asm, 1012 "no-asm" => \$no_asm,
1284 "nasm" => \$nasm, 1013 "nasm" => \$nasm,
1285 "ml64" => \$ml64,
1286 "nw-nasm" => \$nw_nasm, 1014 "nw-nasm" => \$nw_nasm,
1287 "nw-mwasm" => \$nw_mwasm, 1015 "nw-mwasm" => \$nw_mwasm,
1288 "gaswin" => \$gaswin, 1016 "gaswin" => \$gaswin,
@@ -1290,7 +1018,6 @@ sub read_options
1290 "no-ssl3" => \$no_ssl3, 1018 "no-ssl3" => \$no_ssl3,
1291 "no-tlsext" => \$no_tlsext, 1019 "no-tlsext" => \$no_tlsext,
1292 "no-cms" => \$no_cms, 1020 "no-cms" => \$no_cms,
1293 "no-jpake" => \$no_jpake,
1294 "no-capieng" => \$no_capieng, 1021 "no-capieng" => \$no_capieng,
1295 "no-err" => \$no_err, 1022 "no-err" => \$no_err,
1296 "no-sock" => \$no_sock, 1023 "no-sock" => \$no_sock,
@@ -1318,9 +1045,6 @@ sub read_options
1318 "no-shared" => 0, 1045 "no-shared" => 0,
1319 "no-zlib" => 0, 1046 "no-zlib" => 0,
1320 "no-zlib-dynamic" => 0, 1047 "no-zlib-dynamic" => 0,
1321 "fips" => \$fips,
1322 "fipscanisterbuild" => [\$fips, \$fipscanisterbuild],
1323 "fipsdso" => [\$fips, \$fipscanisterbuild, \$fipsdso],
1324 ); 1048 );
1325 1049
1326 if (exists $valid_options{$_}) 1050 if (exists $valid_options{$_})
@@ -1362,18 +1086,6 @@ sub read_options
1362 {return 1;} 1086 {return 1;}
1363 return 0; 1087 return 0;
1364 } 1088 }
1365 # experimental-xxx is mostly like enable-xxx, but opensslconf.v
1366 # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx.
1367 # (No need to fail if we don't know the algorithm -- this is for adventurous users only.)
1368 elsif (/^experimental-/)
1369 {
1370 my $algo, $ALGO;
1371 ($algo = $_) =~ s/^experimental-//;
1372 ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/;
1373
1374 $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags";
1375
1376 }
1377 elsif (/^--with-krb5-flavor=(.*)$/) 1089 elsif (/^--with-krb5-flavor=(.*)$/)
1378 { 1090 {
1379 my $krb5_flavor = $1; 1091 my $krb5_flavor = $1;
@@ -1390,38 +1102,10 @@ sub read_options
1390 } 1102 }
1391 } 1103 }
1392 } 1104 }
1393 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } 1105 elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; }
1394 elsif (/^-[lL].*$/) { $l_flags.="$_ "; } 1106 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1395 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) 1107 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1396 { $c_flags.="$_ "; } 1108 { $c_flags.="$_ "; }
1397 else { return(0); } 1109 else { return(0); }
1398 return(1); 1110 return(1);
1399 } 1111 }
1400
1401sub fipslib_error
1402 {
1403 print STDERR "***FIPS module directory sanity check failed***\n";
1404 print STDERR "FIPS module build failed, or was deleted\n";
1405 print STDERR "Please rebuild FIPS module.\n";
1406 exit 1;
1407 }
1408
1409sub fips_check_files
1410 {
1411 my $dir = shift @_;
1412 my $ret = 1;
1413 if (!-d $dir)
1414 {
1415 print STDERR "FIPS module directory $dir does not exist\n";
1416 fipslib_error();
1417 }
1418 foreach (@_)
1419 {
1420 if (!-f "$dir${o}$_")
1421 {
1422 print STDERR "FIPS module file $_ does not exist!\n";
1423 $ret = 0;
1424 }
1425 }
1426 fipslib_error() if ($ret == 0);
1427 }
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl
index 5ae9ebb619..8ecfde1848 100644
--- a/src/lib/libcrypto/util/mkdef.pl
+++ b/src/lib/libcrypto/util/mkdef.pl
@@ -79,7 +79,7 @@ my $OS2=0;
79my $safe_stack_def = 0; 79my $safe_stack_def = 0;
80 80
81my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", 81my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
82 "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS"); 82 "EXPORT_VAR_AS_FUNCTION", "ZLIB" );
83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); 83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", 84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", 85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
@@ -102,8 +102,6 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
102 "CMS", 102 "CMS",
103 # CryptoAPI Engine 103 # CryptoAPI Engine
104 "CAPIENG", 104 "CAPIENG",
105 # JPAKE
106 "JPAKE",
107 # Deprecated functions 105 # Deprecated functions
108 "DEPRECATED" ); 106 "DEPRECATED" );
109 107
@@ -124,8 +122,7 @@ my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
124my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; my $no_camellia; 122my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; my $no_camellia;
125my $no_seed; 123my $no_seed;
126my $no_fp_api; my $no_static_engine; my $no_gmp; my $no_deprecated; 124my $no_fp_api; my $no_static_engine; my $no_gmp; my $no_deprecated;
127my $no_rfc3779; my $no_tlsext; my $no_cms; my $no_capieng; my $no_jpake; 125my $no_rfc3779; my $no_tlsext; my $no_cms; my $no_capieng;
128my $fips;
129 126
130 127
131foreach (@ARGV, split(/ /, $options)) 128foreach (@ARGV, split(/ /, $options))
@@ -147,13 +144,12 @@ foreach (@ARGV, split(/ /, $options))
147 } 144 }
148 $VMS=1 if $_ eq "VMS"; 145 $VMS=1 if $_ eq "VMS";
149 $OS2=1 if $_ eq "OS2"; 146 $OS2=1 if $_ eq "OS2";
150 $fips=1 if /^fips/;
151
152 if ($_ eq "zlib" || $_ eq "zlib-dynamic" 147 if ($_ eq "zlib" || $_ eq "zlib-dynamic"
153 || $_ eq "enable-zlib-dynamic") { 148 || $_ eq "enable-zlib-dynamic") {
154 $zlib = 1; 149 $zlib = 1;
155 } 150 }
156 151
152
157 $do_ssl=1 if $_ eq "ssleay"; 153 $do_ssl=1 if $_ eq "ssleay";
158 if ($_ eq "ssl") { 154 if ($_ eq "ssl") {
159 $do_ssl=1; 155 $do_ssl=1;
@@ -213,7 +209,6 @@ foreach (@ARGV, split(/ /, $options))
213 elsif (/^no-tlsext$/) { $no_tlsext=1; } 209 elsif (/^no-tlsext$/) { $no_tlsext=1; }
214 elsif (/^no-cms$/) { $no_cms=1; } 210 elsif (/^no-cms$/) { $no_cms=1; }
215 elsif (/^no-capieng$/) { $no_capieng=1; } 211 elsif (/^no-capieng$/) { $no_capieng=1; }
216 elsif (/^no-jpake$/) { $no_jpake=1; }
217 } 212 }
218 213
219 214
@@ -310,8 +305,6 @@ $crypto.=" crypto/tmdiff.h";
310$crypto.=" crypto/store/store.h"; 305$crypto.=" crypto/store/store.h";
311$crypto.=" crypto/pqueue/pqueue.h"; 306$crypto.=" crypto/pqueue/pqueue.h";
312$crypto.=" crypto/cms/cms.h"; 307$crypto.=" crypto/cms/cms.h";
313$crypto.=" crypto/jpake/jpake.h";
314$crypto.=" fips/fips.h fips/rand/fips_rand.h";
315 308
316my $symhacks="crypto/symhacks.h"; 309my $symhacks="crypto/symhacks.h";
317 310
@@ -1097,9 +1090,6 @@ sub is_valid
1097 if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { 1090 if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
1098 return 1; 1091 return 1;
1099 } 1092 }
1100 if ($keyword eq "OPENSSL_FIPS" && $fips) {
1101 return 1;
1102 }
1103 if ($keyword eq "ZLIB" && $zlib) { return 1; } 1093 if ($keyword eq "ZLIB" && $zlib) { return 1; }
1104 return 0; 1094 return 0;
1105 } else { 1095 } else {
@@ -1145,7 +1135,6 @@ sub is_valid
1145 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } 1135 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
1146 if ($keyword eq "CMS" && $no_cms) { return 0; } 1136 if ($keyword eq "CMS" && $no_cms) { return 0; }
1147 if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } 1137 if ($keyword eq "CAPIENG" && $no_capieng) { return 0; }
1148 if ($keyword eq "JPAKE" && $no_jpake) { return 0; }
1149 if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } 1138 if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; }
1150 1139
1151 # Nothing recognise as true 1140 # Nothing recognise as true
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl
new file mode 100644
index 0000000000..53e14ab4df
--- /dev/null
+++ b/src/lib/libcrypto/util/mkerr.pl
@@ -0,0 +1,714 @@
1#!/usr/local/bin/perl -w
2
3my $config = "crypto/err/openssl.ec";
4my $debug = 0;
5my $rebuild = 0;
6my $static = 1;
7my $recurse = 0;
8my $reindex = 0;
9my $dowrite = 0;
10my $staticloader = "";
11
12my $pack_errcode;
13my $load_errcode;
14
15while (@ARGV) {
16 my $arg = $ARGV[0];
17 if($arg eq "-conf") {
18 shift @ARGV;
19 $config = shift @ARGV;
20 } elsif($arg eq "-debug") {
21 $debug = 1;
22 shift @ARGV;
23 } elsif($arg eq "-rebuild") {
24 $rebuild = 1;
25 shift @ARGV;
26 } elsif($arg eq "-recurse") {
27 $recurse = 1;
28 shift @ARGV;
29 } elsif($arg eq "-reindex") {
30 $reindex = 1;
31 shift @ARGV;
32 } elsif($arg eq "-nostatic") {
33 $static = 0;
34 shift @ARGV;
35 } elsif($arg eq "-staticloader") {
36 $staticloader = "static ";
37 shift @ARGV;
38 } elsif($arg eq "-write") {
39 $dowrite = 1;
40 shift @ARGV;
41 } else {
42 last;
43 }
44}
45
46if($recurse) {
47 @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>);
48} else {
49 @source = @ARGV;
50}
51
52# Read in the config file
53
54open(IN, "<$config") || die "Can't open config file $config";
55
56# Parse config file
57
58while(<IN>)
59{
60 if(/^L\s+(\S+)\s+(\S+)\s+(\S+)/) {
61 $hinc{$1} = $2;
62 $libinc{$2} = $1;
63 $cskip{$3} = $1;
64 if($3 ne "NONE") {
65 $csrc{$1} = $3;
66 $fmax{$1} = 99;
67 $rmax{$1} = 99;
68 $fassigned{$1} = ":";
69 $rassigned{$1} = ":";
70 $fnew{$1} = 0;
71 $rnew{$1} = 0;
72 }
73 } elsif (/^F\s+(\S+)/) {
74 # Add extra function with $1
75 } elsif (/^R\s+(\S+)\s+(\S+)/) {
76 $rextra{$1} = $2;
77 $rcodes{$1} = $2;
78 }
79}
80
81close IN;
82
83# Scan each header file in turn and make a list of error codes
84# and function names
85
86while (($hdr, $lib) = each %libinc)
87{
88 next if($hdr eq "NONE");
89 print STDERR "Scanning header file $hdr\n" if $debug;
90 my $line = "", $def= "", $linenr = 0, $gotfile = 0;
91 if (open(IN, "<$hdr")) {
92 $gotfile = 1;
93 while(<IN>) {
94 $linenr++;
95 print STDERR "line: $linenr\r" if $debug;
96
97 last if(/BEGIN\s+ERROR\s+CODES/);
98 if ($line ne '') {
99 $_ = $line . $_;
100 $line = '';
101 }
102
103 if (/\\$/) {
104 $line = $_;
105 next;
106 }
107
108 if(/\/\*/) {
109 if (not /\*\//) { # multiline comment...
110 $line = $_; # ... just accumulate
111 next;
112 } else {
113 s/\/\*.*?\*\///gs; # wipe it
114 }
115 }
116
117 if ($cpp) {
118 $cpp++ if /^#\s*if/;
119 $cpp-- if /^#\s*endif/;
120 next;
121 }
122 $cpp = 1 if /^#.*ifdef.*cplusplus/; # skip "C" declaration
123
124 next if (/^\#/); # skip preprocessor directives
125
126 s/{[^{}]*}//gs; # ignore {} blocks
127
128 if (/\{|\/\*/) { # Add a } so editor works...
129 $line = $_;
130 } else {
131 $def .= $_;
132 }
133 }
134 }
135
136 print STDERR " \r" if $debug;
137 $defnr = 0;
138 # Delete any DECLARE_ macros
139 $def =~ s/DECLARE_\w+\([\w,\s]+\)//gs;
140 foreach (split /;/, $def) {
141 $defnr++;
142 print STDERR "def: $defnr\r" if $debug;
143
144 # The goal is to collect function names from function declarations.
145
146 s/^[\n\s]*//g;
147 s/[\n\s]*$//g;
148
149 # Skip over recognized non-function declarations
150 next if(/typedef\W/ or /DECLARE_STACK_OF/ or /TYPEDEF_.*_OF/);
151
152 # Remove STACK_OF(foo)
153 s/STACK_OF\(\w+\)/void/;
154
155 # Reduce argument lists to empty ()
156 # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {}
157 while(/\(.*\)/s) {
158 s/\([^\(\)]+\)/\{\}/gs;
159 s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f
160 }
161 # pretend as we didn't use curly braces: {} -> ()
162 s/\{\}/\(\)/gs;
163
164 if (/(\w+)\s*\(\).*/s) { # first token prior [first] () is
165 my $name = $1; # a function name!
166 $name =~ tr/[a-z]/[A-Z]/;
167 $ftrans{$name} = $1;
168 } elsif (/[\(\)]/ and not (/=/)) {
169 print STDERR "Header $hdr: cannot parse: $_;\n";
170 }
171 }
172
173 print STDERR " \r" if $debug;
174
175 next if $reindex;
176
177 # Scan function and reason codes and store them: keep a note of the
178 # maximum code used.
179
180 if ($gotfile) {
181 while(<IN>) {
182 if(/^\#define\s+(\S+)\s+(\S+)/) {
183 $name = $1;
184 $code = $2;
185 next if $name =~ /^${lib}err/;
186 unless($name =~ /^${lib}_([RF])_(\w+)$/) {
187 print STDERR "Invalid error code $name\n";
188 next;
189 }
190 if($1 eq "R") {
191 $rcodes{$name} = $code;
192 if ($rassigned{$lib} =~ /:$code:/) {
193 print STDERR "!! ERROR: $lib reason code $code assigned twice\n";
194 }
195 $rassigned{$lib} .= "$code:";
196 if(!(exists $rextra{$name}) &&
197 ($code > $rmax{$lib}) ) {
198 $rmax{$lib} = $code;
199 }
200 } else {
201 if ($fassigned{$lib} =~ /:$code:/) {
202 print STDERR "!! ERROR: $lib function code $code assigned twice\n";
203 }
204 $fassigned{$lib} .= "$code:";
205 if($code > $fmax{$lib}) {
206 $fmax{$lib} = $code;
207 }
208 $fcodes{$name} = $code;
209 }
210 }
211 }
212 }
213
214 if ($debug) {
215 if (defined($fmax{$lib})) {
216 print STDERR "Max function code fmax" . "{" . "$lib" . "} = $fmax{$lib}\n";
217 $fassigned{$lib} =~ m/^:(.*):$/;
218 @fassigned = sort {$a <=> $b} split(":", $1);
219 print STDERR " @fassigned\n";
220 }
221 if (defined($rmax{$lib})) {
222 print STDERR "Max reason code rmax" . "{" . "$lib" . "} = $rmax{$lib}\n";
223 $rassigned{$lib} =~ m/^:(.*):$/;
224 @rassigned = sort {$a <=> $b} split(":", $1);
225 print STDERR " @rassigned\n";
226 }
227 }
228
229 if ($lib eq "SSL") {
230 if ($rmax{$lib} >= 1000) {
231 print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n";
232 print STDERR "!! Any new alerts must be added to $config.\n";
233 print STDERR "\n";
234 }
235 }
236 close IN;
237}
238
239# Scan each C source file and look for function and reason codes
240# This is done by looking for strings that "look like" function or
241# reason codes: basically anything consisting of all upper case and
242# numerics which has _F_ or _R_ in it and which has the name of an
243# error library at the start. This seems to work fine except for the
244# oddly named structure BIO_F_CTX which needs to be ignored.
245# If a code doesn't exist in list compiled from headers then mark it
246# with the value "X" as a place holder to give it a value later.
247# Store all function and reason codes found in %ufcodes and %urcodes
248# so all those unreferenced can be printed out.
249
250
251foreach $file (@source) {
252 # Don't parse the error source file.
253 next if exists $cskip{$file};
254 print STDERR "File loaded: ".$file."\r" if $debug;
255 open(IN, "<$file") || die "Can't open source file $file\n";
256 while(<IN>) {
257 if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) {
258 next unless exists $csrc{$2};
259 next if($1 eq "BIO_F_BUFFER_CTX");
260 $ufcodes{$1} = 1;
261 if(!exists $fcodes{$1}) {
262 $fcodes{$1} = "X";
263 $fnew{$2}++;
264 }
265 $notrans{$1} = 1 unless exists $ftrans{$3};
266 }
267 if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) {
268 next unless exists $csrc{$2};
269 $urcodes{$1} = 1;
270 if(!exists $rcodes{$1}) {
271 $rcodes{$1} = "X";
272 $rnew{$2}++;
273 }
274 }
275 }
276 close IN;
277}
278print STDERR " \n" if $debug;
279
280# Now process each library in turn.
281
282foreach $lib (keys %csrc)
283{
284 my $hfile = $hinc{$lib};
285 my $cfile = $csrc{$lib};
286 if(!$fnew{$lib} && !$rnew{$lib}) {
287 print STDERR "$lib:\t\tNo new error codes\n";
288 next unless $rebuild;
289 } else {
290 print STDERR "$lib:\t\t$fnew{$lib} New Functions,";
291 print STDERR " $rnew{$lib} New Reasons.\n";
292 next unless $dowrite;
293 }
294
295 # If we get here then we have some new error codes so we
296 # need to rebuild the header file and C file.
297
298 # Make a sorted list of error and reason codes for later use.
299
300 my @function = sort grep(/^${lib}_/,keys %fcodes);
301 my @reasons = sort grep(/^${lib}_/,keys %rcodes);
302
303 # Rewrite the header file
304
305 if (open(IN, "<$hfile")) {
306 # Copy across the old file
307 while(<IN>) {
308 push @out, $_;
309 last if (/BEGIN ERROR CODES/);
310 }
311 close IN;
312 } else {
313 push @out,
314"/* ====================================================================\n",
315" * Copyright (c) 2001-2008 The OpenSSL Project. All rights reserved.\n",
316" *\n",
317" * Redistribution and use in source and binary forms, with or without\n",
318" * modification, are permitted provided that the following conditions\n",
319" * are met:\n",
320" *\n",
321" * 1. Redistributions of source code must retain the above copyright\n",
322" * notice, this list of conditions and the following disclaimer. \n",
323" *\n",
324" * 2. Redistributions in binary form must reproduce the above copyright\n",
325" * notice, this list of conditions and the following disclaimer in\n",
326" * the documentation and/or other materials provided with the\n",
327" * distribution.\n",
328" *\n",
329" * 3. All advertising materials mentioning features or use of this\n",
330" * software must display the following acknowledgment:\n",
331" * \"This product includes software developed by the OpenSSL Project\n",
332" * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n",
333" *\n",
334" * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n",
335" * endorse or promote products derived from this software without\n",
336" * prior written permission. For written permission, please contact\n",
337" * openssl-core\@openssl.org.\n",
338" *\n",
339" * 5. Products derived from this software may not be called \"OpenSSL\"\n",
340" * nor may \"OpenSSL\" appear in their names without prior written\n",
341" * permission of the OpenSSL Project.\n",
342" *\n",
343" * 6. Redistributions of any form whatsoever must retain the following\n",
344" * acknowledgment:\n",
345" * \"This product includes software developed by the OpenSSL Project\n",
346" * for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n",
347" *\n",
348" * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n",
349" * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n",
350" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n",
351" * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n",
352" * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n",
353" * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n",
354" * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n",
355" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n",
356" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n",
357" * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n",
358" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n",
359" * OF THE POSSIBILITY OF SUCH DAMAGE.\n",
360" * ====================================================================\n",
361" *\n",
362" * This product includes cryptographic software written by Eric Young\n",
363" * (eay\@cryptsoft.com). This product includes software written by Tim\n",
364" * Hudson (tjh\@cryptsoft.com).\n",
365" *\n",
366" */\n",
367"\n",
368"#ifndef HEADER_${lib}_ERR_H\n",
369"#define HEADER_${lib}_ERR_H\n",
370"\n",
371"/* BEGIN ERROR CODES */\n";
372 }
373 open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n";
374
375 print OUT @out;
376 undef @out;
377 print OUT <<"EOF";
378/* The following lines are auto generated by the script mkerr.pl. Any changes
379 * made after this point may be overwritten when the script is next run.
380 */
381EOF
382 if($static) {
383 print OUT <<"EOF";
384${staticloader}void ERR_load_${lib}_strings(void);
385
386EOF
387 } else {
388 print OUT <<"EOF";
389${staticloader}void ERR_load_${lib}_strings(void);
390${staticloader}void ERR_unload_${lib}_strings(void);
391${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
392#define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
393
394EOF
395 }
396 print OUT <<"EOF";
397/* Error codes for the $lib functions. */
398
399/* Function codes. */
400EOF
401
402 foreach $i (@function) {
403 $z=6-int(length($i)/8);
404 if($fcodes{$i} eq "X") {
405 $fassigned{$lib} =~ m/^:([^:]*):/;
406 $findcode = $1;
407 if (!defined($findcode)) {
408 $findcode = $fmax{$lib};
409 }
410 while ($fassigned{$lib} =~ m/:$findcode:/) {
411 $findcode++;
412 }
413 $fcodes{$i} = $findcode;
414 $fassigned{$lib} .= "$findcode:";
415 print STDERR "New Function code $i\n" if $debug;
416 }
417 printf OUT "#define $i%s $fcodes{$i}\n","\t" x $z;
418 }
419
420 print OUT "\n/* Reason codes. */\n";
421
422 foreach $i (@reasons) {
423 $z=6-int(length($i)/8);
424 if($rcodes{$i} eq "X") {
425 $rassigned{$lib} =~ m/^:([^:]*):/;
426 $findcode = $1;
427 if (!defined($findcode)) {
428 $findcode = $rmax{$lib};
429 }
430 while ($rassigned{$lib} =~ m/:$findcode:/) {
431 $findcode++;
432 }
433 $rcodes{$i} = $findcode;
434 $rassigned{$lib} .= "$findcode:";
435 print STDERR "New Reason code $i\n" if $debug;
436 }
437 printf OUT "#define $i%s $rcodes{$i}\n","\t" x $z;
438 }
439 print OUT <<"EOF";
440
441#ifdef __cplusplus
442}
443#endif
444#endif
445EOF
446 close OUT;
447
448 # Rewrite the C source file containing the error details.
449
450 # First, read any existing reason string definitions:
451 my %err_reason_strings;
452 if (open(IN,"<$cfile")) {
453 while (<IN>) {
454 if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) {
455 $err_reason_strings{$1} = $2;
456 }
457 }
458 close(IN);
459 }
460
461 my $hincf;
462 if($static) {
463 $hfile =~ /([^\/]+)$/;
464 $hincf = "<openssl/$1>";
465 } else {
466 $hincf = "\"$hfile\"";
467 }
468
469 # If static we know the error code at compile time so use it
470 # in error definitions.
471
472 if ($static)
473 {
474 $pack_errcode = "ERR_LIB_${lib}";
475 $load_errcode = "0";
476 }
477 else
478 {
479 $pack_errcode = "0";
480 $load_errcode = "ERR_LIB_${lib}";
481 }
482
483
484 open (OUT,">$cfile") || die "Can't open $cfile for writing";
485
486 print OUT <<"EOF";
487/* $cfile */
488/* ====================================================================
489 * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
490 *
491 * Redistribution and use in source and binary forms, with or without
492 * modification, are permitted provided that the following conditions
493 * are met:
494 *
495 * 1. Redistributions of source code must retain the above copyright
496 * notice, this list of conditions and the following disclaimer.
497 *
498 * 2. Redistributions in binary form must reproduce the above copyright
499 * notice, this list of conditions and the following disclaimer in
500 * the documentation and/or other materials provided with the
501 * distribution.
502 *
503 * 3. All advertising materials mentioning features or use of this
504 * software must display the following acknowledgment:
505 * "This product includes software developed by the OpenSSL Project
506 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
507 *
508 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
509 * endorse or promote products derived from this software without
510 * prior written permission. For written permission, please contact
511 * openssl-core\@OpenSSL.org.
512 *
513 * 5. Products derived from this software may not be called "OpenSSL"
514 * nor may "OpenSSL" appear in their names without prior written
515 * permission of the OpenSSL Project.
516 *
517 * 6. Redistributions of any form whatsoever must retain the following
518 * acknowledgment:
519 * "This product includes software developed by the OpenSSL Project
520 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
521 *
522 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
523 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
524 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
525 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
526 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
527 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
528 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
529 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
530 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
531 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
532 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
533 * OF THE POSSIBILITY OF SUCH DAMAGE.
534 * ====================================================================
535 *
536 * This product includes cryptographic software written by Eric Young
537 * (eay\@cryptsoft.com). This product includes software written by Tim
538 * Hudson (tjh\@cryptsoft.com).
539 *
540 */
541
542/* NOTE: this file was auto generated by the mkerr.pl script: any changes
543 * made to it will be overwritten when the script next updates this file,
544 * only reason strings will be preserved.
545 */
546
547#include <stdio.h>
548#include <openssl/err.h>
549#include $hincf
550
551/* BEGIN ERROR CODES */
552#ifndef OPENSSL_NO_ERR
553
554#define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0)
555#define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason)
556
557static ERR_STRING_DATA ${lib}_str_functs[]=
558 {
559EOF
560 # Add each function code: if a function name is found then use it.
561 foreach $i (@function) {
562 my $fn;
563 $i =~ /^${lib}_F_(\S+)$/;
564 $fn = $1;
565 if(exists $ftrans{$fn}) {
566 $fn = $ftrans{$fn};
567 }
568# print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n";
569 print OUT "{ERR_FUNC($i),\t\"$fn\"},\n";
570 }
571 print OUT <<"EOF";
572{0,NULL}
573 };
574
575static ERR_STRING_DATA ${lib}_str_reasons[]=
576 {
577EOF
578 # Add each reason code.
579 foreach $i (@reasons) {
580 my $rn;
581 my $rstr = "ERR_REASON($i)";
582 my $nspc = 0;
583 if (exists $err_reason_strings{$i}) {
584 $rn = $err_reason_strings{$i};
585 } else {
586 $i =~ /^${lib}_R_(\S+)$/;
587 $rn = $1;
588 $rn =~ tr/_[A-Z]/ [a-z]/;
589 }
590 $nspc = 40 - length($rstr) unless length($rstr) > 40;
591 $nspc = " " x $nspc;
592 print OUT "{${rstr}${nspc},\"$rn\"},\n";
593 }
594if($static) {
595 print OUT <<"EOF";
596{0,NULL}
597 };
598
599#endif
600
601${staticloader}void ERR_load_${lib}_strings(void)
602 {
603#ifndef OPENSSL_NO_ERR
604
605 if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL)
606 {
607 ERR_load_strings($load_errcode,${lib}_str_functs);
608 ERR_load_strings($load_errcode,${lib}_str_reasons);
609 }
610#endif
611 }
612EOF
613} else {
614 print OUT <<"EOF";
615{0,NULL}
616 };
617
618#endif
619
620#ifdef ${lib}_LIB_NAME
621static ERR_STRING_DATA ${lib}_lib_name[]=
622 {
623{0 ,${lib}_LIB_NAME},
624{0,NULL}
625 };
626#endif
627
628
629static int ${lib}_lib_error_code=0;
630static int ${lib}_error_init=1;
631
632${staticloader}void ERR_load_${lib}_strings(void)
633 {
634 if (${lib}_lib_error_code == 0)
635 ${lib}_lib_error_code=ERR_get_next_error_library();
636
637 if (${lib}_error_init)
638 {
639 ${lib}_error_init=0;
640#ifndef OPENSSL_NO_ERR
641 ERR_load_strings(${lib}_lib_error_code,${lib}_str_functs);
642 ERR_load_strings(${lib}_lib_error_code,${lib}_str_reasons);
643#endif
644
645#ifdef ${lib}_LIB_NAME
646 ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0);
647 ERR_load_strings(0,${lib}_lib_name);
648#endif
649 }
650 }
651
652${staticloader}void ERR_unload_${lib}_strings(void)
653 {
654 if (${lib}_error_init == 0)
655 {
656#ifndef OPENSSL_NO_ERR
657 ERR_unload_strings(${lib}_lib_error_code,${lib}_str_functs);
658 ERR_unload_strings(${lib}_lib_error_code,${lib}_str_reasons);
659#endif
660
661#ifdef ${lib}_LIB_NAME
662 ERR_unload_strings(0,${lib}_lib_name);
663#endif
664 ${lib}_error_init=1;
665 }
666 }
667
668${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line)
669 {
670 if (${lib}_lib_error_code == 0)
671 ${lib}_lib_error_code=ERR_get_next_error_library();
672 ERR_PUT_error(${lib}_lib_error_code,function,reason,file,line);
673 }
674EOF
675
676}
677
678 close OUT;
679 undef %err_reason_strings;
680}
681
682if($debug && defined(%notrans)) {
683 print STDERR "The following function codes were not translated:\n";
684 foreach(sort keys %notrans)
685 {
686 print STDERR "$_\n";
687 }
688}
689
690# Make a list of unreferenced function and reason codes
691
692foreach (keys %fcodes) {
693 push (@funref, $_) unless exists $ufcodes{$_};
694}
695
696foreach (keys %rcodes) {
697 push (@runref, $_) unless exists $urcodes{$_};
698}
699
700if($debug && defined(@funref) ) {
701 print STDERR "The following function codes were not referenced:\n";
702 foreach(sort @funref)
703 {
704 print STDERR "$_\n";
705 }
706}
707
708if($debug && defined(@runref) ) {
709 print STDERR "The following reason codes were not referenced:\n";
710 foreach(sort @runref)
711 {
712 print STDERR "$_\n";
713 }
714}
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl
index 67fb8694c8..1282392fea 100644
--- a/src/lib/libcrypto/util/mkfiles.pl
+++ b/src/lib/libcrypto/util/mkfiles.pl
@@ -47,7 +47,6 @@ my @dirs = (
47"crypto/x509", 47"crypto/x509",
48"crypto/x509v3", 48"crypto/x509v3",
49"crypto/conf", 49"crypto/conf",
50"crypto/jpake",
51"crypto/txt_db", 50"crypto/txt_db",
52"crypto/pkcs7", 51"crypto/pkcs7",
53"crypto/pkcs12", 52"crypto/pkcs12",
@@ -59,15 +58,6 @@ my @dirs = (
59"crypto/store", 58"crypto/store",
60"crypto/pqueue", 59"crypto/pqueue",
61"crypto/cms", 60"crypto/cms",
62"fips",
63"fips/aes",
64"fips/des",
65"fips/dsa",
66"fips/dh",
67"fips/hmac",
68"fips/rand",
69"fips/rsa",
70"fips/sha",
71"ssl", 61"ssl",
72"apps", 62"apps",
73"engines", 63"engines",
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl
index eacc327882..d9bc98aab8 100644
--- a/src/lib/libcrypto/util/mklink.pl
+++ b/src/lib/libcrypto/util/mklink.pl
@@ -15,21 +15,13 @@
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 17
18my $pwd; 18use Cwd;
19eval 'use Cwd;';
20if ($@)
21 {
22 $pwd = `pwd`;
23 }
24else
25 {
26 $pwd = getcwd();
27 }
28 19
29my $from = shift; 20my $from = shift;
30my @files = @ARGV; 21my @files = @ARGV;
31 22
32my @from_path = split(/[\\\/]/, $from); 23my @from_path = split(/[\\\/]/, $from);
24my $pwd = getcwd();
33chomp($pwd); 25chomp($pwd);
34my @pwd_path = split(/[\\\/]/, $pwd); 26my @pwd_path = split(/[\\\/]/, $pwd);
35 27
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl
new file mode 100644
index 0000000000..2a968f395f
--- /dev/null
+++ b/src/lib/libcrypto/util/mkstack.pl
@@ -0,0 +1,126 @@
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
12my $safestack = "crypto/stack/safestack";
13
14my $do_write;
15while (@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]>);
25foreach $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
45my $old_stackfile = "";
46my $new_stackfile = "";
47my $inside_block = 0;
48my $type_thing;
49
50open(IN, "< $safestack.h") || die "Can't open input file: $!";
51while(<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}_find_ex(st, val) SKM_sk_find_ex($type_thing, (st), (val))
79#define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i))
80#define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr))
81#define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i))
82#define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp))
83#define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st)
84#define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func))
85#define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st))
86#define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st))
87#define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st))
88#define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st))
89EOF
90 }
91 foreach $type_thing (sort @asn1setlst) {
92 $new_stackfile .= <<EOF;
93
94#define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\
95 SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
96#define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\
97 SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
98#define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\
99 SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len))
100#define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\
101 SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func))
102EOF
103 }
104 foreach $type_thing (sort @p12stklst) {
105 $new_stackfile .= <<EOF;
106
107#define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\
108 SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
109EOF
110 }
111 $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n";
112 $inside_block = 2;
113}
114
115
116if ($new_stackfile eq $old_stackfile) {
117 print "No changes to $safestack.h.\n";
118 exit 0; # avoid unnecessary rebuild
119}
120
121if ($do_write) {
122 print "Writing new $safestack.h.\n";
123 open OUT, ">$safestack.h" || die "Can't open output file";
124 print OUT $new_stackfile;
125 close OUT;
126}
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl
index 730c2083bd..1e254119e6 100644
--- a/src/lib/libcrypto/util/pl/VC-32.pl
+++ b/src/lib/libcrypto/util/pl/VC-32.pl
@@ -4,26 +4,12 @@
4# 4#
5 5
6$ssl= "ssleay32"; 6$ssl= "ssleay32";
7 7$crypto="libeay32";
8if ($fips && !$shlib)
9 {
10 $crypto="libeayfips32";
11 $crypto_compat = "libeaycompat32.lib";
12 }
13else
14 {
15 $crypto="libeay32";
16 }
17
18if ($fipscanisterbuild)
19 {
20 $fips_canister_path = "\$(LIB_D)\\fipscanister.lib";
21 }
22 8
23$o='\\'; 9$o='\\';
24$cp='$(PERL) util/copy.pl'; 10$cp='$(PERL) util/copy.pl';
25$mkdir='$(PERL) util/mkdir-p.pl'; 11$mkdir='$(PERL) util/mkdir-p.pl';
26$rm='del /Q'; 12$rm='del';
27 13
28$zlib_lib="zlib1.lib"; 14$zlib_lib="zlib1.lib";
29 15
@@ -110,7 +96,7 @@ else # Win32
110 $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; 96 $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
111 $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 97 $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
112 $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 98 $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
113 my $f = $shlib || $fips ?' /MD':' /MT'; 99 my $f = $shlib?' /MD':' /MT';
114 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib 100 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
115 $opt_cflags=$f.' /Ox /O2 /Ob2'; 101 $opt_cflags=$f.' /Ox /O2 /Ob2';
116 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; 102 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
@@ -179,17 +165,12 @@ if ($nasm) {
179 # pick newest version 165 # pick newest version
180 $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; 166 $asm=($ver gt $vew?"nasm":"nasmw")." -f win32";
181 $afile='-o '; 167 $afile='-o ';
182} elsif ($ml64) {
183 $asm='ml64 /c /Cp /Cx';
184 $asm.=' /Zi' if $debug;
185 $afile='/Fo';
186} else { 168} else {
187 $asm='ml /Cp /coff /c /Cx'; 169 $asm='ml /Cp /coff /c /Cx';
188 $asm.=" /Zi" if $debug; 170 $asm.=" /Zi" if $debug;
189 $afile='/Fo'; 171 $afile='/Fo';
190} 172}
191 173
192$aes_asm_obj='';
193$bn_asm_obj=''; 174$bn_asm_obj='';
194$bn_asm_src=''; 175$bn_asm_src='';
195$des_enc_obj=''; 176$des_enc_obj='';
@@ -198,13 +179,11 @@ $bf_enc_obj='';
198$bf_enc_src=''; 179$bf_enc_src='';
199 180
200if (!$no_asm) 181if (!$no_asm)
201 {
202 if ($FLAVOR =~ "WIN32")
203 { 182 {
204 $aes_asm_obj='crypto\aes\asm\a_win32.obj'; 183 $aes_asm_obj='crypto\aes\asm\a_win32.obj';
205 $aes_asm_src='crypto\aes\asm\a_win32.asm'; 184 $aes_asm_src='crypto\aes\asm\a_win32.asm';
206 $bn_asm_obj='crypto\bn\asm\bn_win32.obj crypto\bn\asm\mt_win32.obj'; 185 $bn_asm_obj='crypto\bn\asm\bn_win32.obj';
207 $bn_asm_src='crypto\bn\asm\bn_win32.asm crypto\bn\asm\mt_win32.asm'; 186 $bn_asm_src='crypto\bn\asm\bn_win32.asm';
208 $bnco_asm_obj='crypto\bn\asm\co_win32.obj'; 187 $bnco_asm_obj='crypto\bn\asm\co_win32.obj';
209 $bnco_asm_src='crypto\bn\asm\co_win32.asm'; 188 $bnco_asm_src='crypto\bn\asm\co_win32.asm';
210 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj'; 189 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
@@ -225,26 +204,12 @@ if (!$no_asm)
225 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm'; 204 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
226 $cpuid_asm_obj='crypto\cpu_win32.obj'; 205 $cpuid_asm_obj='crypto\cpu_win32.obj';
227 $cpuid_asm_src='crypto\cpu_win32.asm'; 206 $cpuid_asm_src='crypto\cpu_win32.asm';
228 $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; 207 $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
229 } 208 }
230 elsif ($FLAVOR =~ "WIN64A")
231 {
232 $aes_asm_obj='$(OBJ_D)\aes-x86_64.obj';
233 $aes_asm_src='crypto\aes\asm\aes-x86_64.asm';
234 $bn_asm_obj='$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj';
235 $bn_asm_src='crypto\bn\asm\x86_64-mont.asm';
236 $sha1_asm_obj='$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OBJ_D)\sha512-x86_64.obj';
237 $sha1_asm_src='crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86_64.asm crypto\sha\asm\sha512-x86_64.asm';
238 $cpuid_asm_obj='$(OBJ_D)\cpuid-x86_64.obj';
239 $cpuid_asm_src='crypto\cpuid-x86_64.asm';
240 $cflags.=" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
241 }
242 }
243 209
244if ($shlib && $FLAVOR !~ /CE/) 210if ($shlib && $FLAVOR !~ /CE/)
245 { 211 {
246 $mlflags.=" $lflags /dll"; 212 $mlflags.=" $lflags /dll";
247# $cflags =~ s| /MD| /MT|;
248 $lib_cflag=" -D_WINDLL"; 213 $lib_cflag=" -D_WINDLL";
249 $out_def="out32dll"; 214 $out_def="out32dll";
250 $tmp_def="tmp32dll"; 215 $tmp_def="tmp32dll";
@@ -267,8 +232,8 @@ $(INCO_D)\applink.c: ms\applink.c
267EXHEADER= $(EXHEADER) $(INCO_D)\applink.c 232EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
268 233
269LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj 234LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
235CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
270___ 236___
271$banner .= "CRYPTOOBJ=\$(OBJ_D)\\uplink.obj \$(CRYPTOOBJ)\n";
272 $banner.=<<'___' if ($FLAVOR =~ /WIN64/); 237 $banner.=<<'___' if ($FLAVOR =~ /WIN64/);
273CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ) 238CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
274___ 239___
@@ -285,57 +250,26 @@ $cflags.=" /Fd$out_def";
285 250
286sub do_lib_rule 251sub do_lib_rule
287 { 252 {
288 my($objs,$target,$name,$shlib,$ign,$base_addr) = @_; 253 local($objs,$target,$name,$shlib)=@_;
289 local($ret); 254 local($ret);
290 255
291 $taget =~ s/\//$o/g if $o ne '/'; 256 $taget =~ s/\//$o/g if $o ne '/';
292 my $base_arg; 257 if ($name ne "")
293 if ($base_addr ne "")
294 {
295 $base_arg= " /base:$base_addr";
296 }
297 else
298 {
299 $base_arg = "";
300 }
301 if ($target =~ /O_CRYPTO/ && $fipsdso)
302 {
303 $name = "/def:ms/libeayfips.def";
304 }
305 elsif ($name ne "")
306 { 258 {
307 $name =~ tr/a-z/A-Z/; 259 $name =~ tr/a-z/A-Z/;
308 $name = "/def:ms/${name}.def"; 260 $name = "/def:ms/${name}.def";
309 } 261 }
310
311# $target="\$(LIB_D)$o$target"; 262# $target="\$(LIB_D)$o$target";
312# $ret.="$target: $objs\n"; 263 $ret.="$target: $objs\n";
313 if (!$shlib) 264 if (!$shlib)
314 { 265 {
315# $ret.="\t\$(RM) \$(O_$Name)\n"; 266# $ret.="\t\$(RM) \$(O_$Name)\n";
316 $ex =' '; 267 $ex =' ';
317 $ret.="$target: $objs\n";
318 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; 268 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
319 } 269 }
320 else 270 else
321 { 271 {
322 my $ex = ""; 272 local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)';
323 if ($target =~ /O_SSL/)
324 {
325 $ex .= " \$(L_CRYPTO)";
326 #$ex .= " \$(L_FIPS)" if $fipsdso;
327 }
328 my $fipstarget;
329 if ($fipsdso)
330 {
331 $fipstarget = "O_FIPS";
332 }
333 else
334 {
335 $fipstarget = "O_CRYPTO";
336 }
337
338
339 if ($name eq "") 273 if ($name eq "")
340 { 274 {
341 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); 275 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
@@ -356,39 +290,7 @@ sub do_lib_rule
356 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); 290 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
357 } 291 }
358 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; 292 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
359 293 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
360 if ($fips && $target =~ /$fipstarget/)
361 {
362 $ex.= $mwex unless $fipscanisterbuild;
363 $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
364 if ($fipsdso)
365 {
366 $ex.=" \$(OBJ_D)\\\$(LIBFIPS).res";
367 $ret.=" \$(OBJ_D)\\\$(LIBFIPS).res";
368 $ret.=" ms/\$(LIBFIPS).def";
369 }
370 $ret.="\n\tSET FIPS_LINK=\$(LINK)\n";
371 $ret.="\tSET FIPS_CC=\$(CC)\n";
372 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
373 $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
374 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
375 $ret.="\tSET FIPS_TARGET=$target\n";
376 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
377 $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target ";
378 $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs ";
379 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
380 }
381 else
382 {
383 $ret.="$target: $objs";
384 if ($target =~ /O_CRYPTO/ && $fipsdso)
385 {
386 $ret .= " \$(O_FIPS)";
387 $ex .= " \$(L_FIPS)";
388 }
389 $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
390 }
391
392 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; 294 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
393 } 295 }
394 $ret.="\n"; 296 $ret.="\n";
@@ -397,64 +299,16 @@ sub do_lib_rule
397 299
398sub do_link_rule 300sub do_link_rule
399 { 301 {
400 my($target,$files,$dep_libs,$libs,$standalone)=@_; 302 local($target,$files,$dep_libs,$libs)=@_;
401 local($ret,$_); 303 local($ret,$_);
304
402 $file =~ s/\//$o/g if $o ne '/'; 305 $file =~ s/\//$o/g if $o ne '/';
403 $n=&bname($targer); 306 $n=&bname($targer);
404 $ret.="$target: $files $dep_libs\n"; 307 $ret.="$target: $files $dep_libs\n";
405 if ($standalone == 1) 308 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
406 { 309 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
407 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; 310 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
408 $ret.= "$mwex advapi32.lib " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
409 $ret.="$files $libs\n<<\n";
410 }
411 elsif ($standalone == 2)
412 {
413 $ret.="\tSET FIPS_LINK=\$(LINK)\n";
414 $ret.="\tSET FIPS_CC=\$(CC)\n";
415 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
416 $ret.="\tSET PREMAIN_DSO_EXE=\n";
417 $ret.="\tSET FIPS_TARGET=$target\n";
418 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
419 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
420 $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n";
421 $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n";
422 }
423 else
424 {
425 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
426 $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
427 }
428 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
429 return($ret); 311 return($ret);
430 } 312 }
431 313
432sub do_rlink_rule
433 {
434 local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=@_;
435 local($ret,$_);
436 my $files = "$rl_start $rl_mid $rl_end";
437
438 $file =~ s/\//$o/g if $o ne '/';
439 $n=&bname($targer);
440 $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
441 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n";
442 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n";
443 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$c $rl_end\n";
444 $ret.="\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n";
445 $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n";
446 $ret.="\t\$(PERL) util${o}copy.pl -stripcr fips${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n";
447 $ret.="\t\$(CP) fips${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n";
448 $ret.="\n";
449 return($ret);
450 }
451
452sub do_sdef_rule
453 {
454 my $ret = "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n";
455 $ret.="\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/libeay32.def @<<\n \$(O_FIPSCANISTER)\n<<\n";
456 $ret.="\n";
457 return $ret;
458 }
459
4601; 3141;
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl
new file mode 100644
index 0000000000..173c9919f2
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/netware.pl
@@ -0,0 +1,526 @@
1# Metrowerks Codewarrior or gcc / nlmconv for NetWare
2#
3
4$version_header = "crypto/opensslv.h";
5open(IN, "$version_header") or die "Couldn't open $version_header: $!";
6while (<IN>) {
7 if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/)
8 {
9 # die "OpenSSL version detected: $1.$2.$3.$4\n";
10 #$nlmvernum = "$1,$2,$3";
11 $nlmvernum = "$1,".($2*10+$3).",".($4*1);
12 #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):"");
13 break;
14 }
15}
16close(IN) or die "Couldn't close $version_header: $!";
17
18$readme_file = "README";
19open(IN, $readme_file) or die "Couldn't open $readme_file: $!";
20while (<IN>) {
21 if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/)
22 {
23 #$nlmvernum = "$1,$2,$3";
24 #$nlmvernum = "$1,".($2*10+$3).",".($4*1);
25 $nlmverstr = "$1.$2.$3$4$5";
26 }
27 elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/)
28 {
29 $nlmcpystr = $1;
30 }
31 break if ($nlmvernum && $nlmcpystr);
32}
33close(IN) or die "Couldn't close $readme_file: $!";
34
35# Define stacksize here
36$nlmstack = "32768";
37
38# some default settings here in case we failed to find them in README
39$nlmvernum = "1,0,0" if (!$nlmvernum);
40$nlmverstr = "OpenSSL" if (!$nlmverstr);
41$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr);
42
43# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n";
44
45# The import files and other misc imports needed to link
46@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
47 "GetSuperHighResolutionTimer");
48if ($LIBC)
49{
50 @import_files = ("libc.imp");
51 @module_files = ("libc");
52 $libarch = "LIBC";
53}
54else
55{
56 # clib build
57 @import_files = ("clib.imp");
58 push(@import_files, "socklib.imp") if ($BSDSOCK);
59 @module_files = ("clib");
60 # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
61 $libarch = "CLIB";
62}
63if ($BSDSOCK)
64{
65 $libarch .= "-BSD";
66}
67else
68{
69 $libarch .= "-WS2";
70 push(@import_files, "ws2nlm.imp");
71}
72
73# The "IMPORTS" environment variable must be set and point to the location
74# where import files (*.imp) can be found.
75# Example: set IMPORTS=c:\ndk\nwsdk\imports
76$import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
77
78
79# The "PRELUDE" environment variable must be set and point to the location
80# and name of the prelude source to link with ( nwpre.obj is recommended ).
81# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
82$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
83
84# The "INCLUDES" environment variable must be set and point to the location
85# where import files (*.imp) can be found.
86$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n");
87$include_path =~ s/\\/\//g;
88$include_path = join(" -I", split(/;/, $include_path));
89
90# check for gcc compiler
91$gnuc = $ENV{"GNUC"};
92
93#$ssl= "ssleay32";
94#$crypto="libeay32";
95
96if ($gnuc)
97{
98 # C compiler
99 $cc='gcc';
100 # Linker
101 $link='nlmconv';
102 # librarian
103 $mklib='ar';
104 $o='/';
105 # cp command
106 $cp='cp -af';
107 # rm command
108 $rm='rm -f';
109 # mv command
110 $mv='mv -f';
111 # mkdir command
112 $mkdir='gmkdir';
113 #$ranlib='ranlib';
114}
115else
116{
117 # C compiler
118 $cc='mwccnlm';
119 # Linker
120 $link='mwldnlm';
121 # librarian
122 $mklib='mwldnlm';
123 # Path separator
124 $o='\\';
125 # cp command
126 $cp='copy >nul:';
127 # rm command
128 $rm='del /f /q';
129}
130
131# assembler
132if ($nw_nasm)
133{
134 if ($gnuc)
135 {
136 $asm="nasmw -s -f elf";
137 }
138 else
139 {
140 $asm="nasmw -s -f coff";
141 }
142 $afile="-o ";
143 $asm.=" -g" if $debug;
144}
145elsif ($nw_mwasm)
146{
147 $asm="mwasmnlm -maxerrors 20";
148 $afile="-o ";
149 $asm.=" -g" if $debug;
150}
151elsif ($nw_masm)
152{
153# masm assembly settings - it should be possible to use masm but haven't
154# got it working.
155# $asm='ml /Cp /coff /c /Cx';
156# $asm.=" /Zi" if $debug;
157# $afile='/Fo';
158 die("Support for masm assembler not yet functional\n");
159}
160else
161{
162 $asm="";
163 $afile="";
164}
165
166
167
168if ($gnuc)
169{
170 # compile flags for GNUC
171 # additional flags based upon debug | non-debug
172 if ($debug)
173 {
174 $cflags="-g -DDEBUG";
175 }
176 else
177 {
178 $cflags="-O2";
179 }
180 $cflags.=" -nostdinc -I$include_path \\
181 -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\
182 -funsigned-char -Wall -Wno-unused -Wno-uninitialized";
183
184 # link flags
185 $lflags="-T";
186}
187else
188{
189 # compile flags for CodeWarrior
190 # additional flags based upon debug | non-debug
191 if ($debug)
192 {
193 $cflags="-opt off -g -sym internal -DDEBUG";
194 }
195 else
196 {
197 # CodeWarrior compiler has a problem with optimizations for floating
198 # points - no optimizations until further investigation
199 # $cflags="-opt all";
200 }
201
202 # NOTES: Several c files in the crypto subdirectory include headers from
203 # their local directories. Metrowerks wouldn't find these h files
204 # without adding individual include directives as compile flags
205 # or modifying the c files. Instead of adding individual include
206 # paths for each subdirectory a recursive include directive
207 # is used ( -ir crypto ).
208 #
209 # A similar issue exists for the engines and apps subdirectories.
210 #
211 # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
212 # complained a lot about various stuff. May want to turn back
213 # on for further development.
214 $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\
215 -msgstyle gcc -align 4 -processor pentium -char unsigned \\
216 -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\
217 -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20";
218
219 # link flags
220 $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile";
221}
222
223# common defines
224$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32";
225
226# If LibC build add in NKS_LIBC define and set the entry/exit
227# routines - The default entry/exit routines are for CLib and don't exist
228# in LibC
229if ($LIBC)
230{
231 $cflags.=" -DNETWARE_LIBC";
232 $nlmstart = "_LibCPrelude";
233 $nlmexit = "_LibCPostlude";
234 @nlm_flags = ("pseudopreemption", "flag_on 64");
235}
236else
237{
238 $cflags.=" -DNETWARE_CLIB";
239 $nlmstart = "_Prelude";
240 $nlmexit = "_Stop";
241}
242
243# If BSD Socket support is requested, set a define for the compiler
244if ($BSDSOCK)
245{
246 $cflags.=" -DNETWARE_BSDSOCK";
247 if (!$LIBC)
248 {
249 $cflags.=" -DNETDB_USE_INTERNET";
250 }
251}
252
253
254# linking stuff
255# for the output directories use the mk1mf.pl values with "_nw" appended
256if ($shlib)
257{
258 if ($LIBC)
259 {
260 $out_def.="_nw_libc_nlm";
261 $tmp_def.="_nw_libc_nlm";
262 $inc_def.="_nw_libc_nlm";
263 }
264 else # NETWARE_CLIB
265 {
266 $out_def.="_nw_clib_nlm";
267 $tmp_def.="_nw_clib_nlm";
268 $inc_def.="_nw_clib_nlm";
269 }
270}
271else
272{
273 if ($gnuc) # GNUC Tools
274 {
275 $libp=".a";
276 $shlibp=".a";
277 $lib_flags="-cr";
278 }
279 else # CodeWarrior
280 {
281 $libp=".lib";
282 $shlibp=".lib";
283 $lib_flags="-nodefaults -type library -o";
284 }
285 if ($LIBC)
286 {
287 $out_def.="_nw_libc";
288 $tmp_def.="_nw_libc";
289 $inc_def.="_nw_libc";
290 }
291 else # NETWARE_CLIB
292 {
293 $out_def.="_nw_clib";
294 $tmp_def.="_nw_clib";
295 $inc_def.="_nw_clib";
296 }
297}
298
299# used by mk1mf.pl
300$obj='.o';
301$ofile='-o ';
302$efile='';
303$exep='.nlm';
304$ex_libs='';
305
306if (!$no_asm)
307{
308 $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}";
309 $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
310 $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}";
311 $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm";
312 $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}";
313 $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm";
314 $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}";
315 $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
316 $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}";
317 $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
318 $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}";
319 $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
320 $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}";
321 $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
322 $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}";
323 $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
324 $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}";
325 $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
326 $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj}";
327 $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm";
328 $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}";
329 $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
330 $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}";
331 $cpuid_asm_src="crypto${o}x86cpuid-nw.asm";
332 $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM";
333 $cflags.=" -DAES_ASM -DRMD160_ASM";
334}
335else
336{
337 $bn_asm_obj='';
338 $bn_asm_src='';
339 $bnco_asm_obj='';
340 $bnco_asm_src='';
341 $aes_asm_obj='';
342 $aes_asm_src='';
343 $des_enc_obj='';
344 $des_enc_src='';
345 $bf_enc_obj='';
346 $bf_enc_src='';
347 $cast_enc_obj='';
348 $cast_enc_src='';
349 $rc4_enc_obj='';
350 $rc4_enc_src='';
351 $rc5_enc_obj='';
352 $rc5_enc_src='';
353 $md5_asm_obj='';
354 $md5_asm_src='';
355 $sha1_asm_obj='';
356 $sha1_asm_src='';
357 $rmd160_asm_obj='';
358 $rmd160_asm_src='';
359 $cpuid_asm_obj='';
360 $cpuid_asm_src='';
361}
362
363# create the *.def linker command files in \openssl\netware\ directory
364sub do_def_file
365{
366 # strip off the leading path
367 my($target) = bname(shift);
368 my($i);
369
370 if ($target =~ /(.*).nlm/)
371 {
372 $target = $1;
373 }
374
375 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
376 if ($target =~ /E_EXE/)
377 {
378 $target =~ s/\$\(E_EXE\)/openssl/;
379 }
380
381 # Note: originally tried to use full path ( \openssl\netware\$target.def )
382 # Metrowerks linker choked on this with an assertion failure. bug???
383 #
384 my($def_file) = "netware${o}$target.def";
385
386 open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
387
388 print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" );
389 print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" );
390 print( DEF_OUT "#\n");
391 print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n");
392 print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n");
393 print( DEF_OUT "VERSION $nlmvernum\n");
394 print( DEF_OUT "STACK $nlmstack\n");
395 print( DEF_OUT "START $nlmstart\n");
396 print( DEF_OUT "EXIT $nlmexit\n");
397
398 # special case for openssl
399 if ($target eq "openssl")
400 {
401 print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n");
402 }
403 else
404 {
405 print( DEF_OUT "SCREENNAME \"DEFAULT\"\n");
406 }
407
408 foreach $i (@misc_imports)
409 {
410 print( DEF_OUT "IMPORT $i\n");
411 }
412
413 foreach $i (@import_files)
414 {
415 print( DEF_OUT "IMPORT \@$import_path${o}$i\n");
416 }
417
418 foreach $i (@module_files)
419 {
420 print( DEF_OUT "MODULE $i\n");
421 }
422
423 foreach $i (@nlm_flags)
424 {
425 print( DEF_OUT "$i\n");
426 }
427
428 if ($gnuc)
429 {
430 if ($target =~ /openssl/)
431 {
432 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n");
433 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n");
434 }
435 else
436 {
437 print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n");
438 }
439 print( DEF_OUT "INPUT $prelude\n");
440 print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n");
441 print( DEF_OUT "OUTPUT $target.nlm\n");
442 }
443
444 close(DEF_OUT);
445 return($def_file);
446}
447
448sub do_lib_rule
449{
450 my($objs,$target,$name,$shlib)=@_;
451 my($ret);
452
453 $ret.="$target: $objs\n";
454 if (!$shlib)
455 {
456 $ret.="\t\@echo Building Lib: $name\n";
457 $ret.="\t\$(MKLIB) $lib_flags $target $objs\n";
458 $ret.="\t\@echo .\n"
459 }
460 else
461 {
462 die( "Building as NLM not currently supported!" );
463 }
464
465 $ret.="\n";
466 return($ret);
467}
468
469sub do_link_rule
470{
471 my($target,$files,$dep_libs,$libs)=@_;
472 my($ret);
473 my($def_file) = do_def_file($target);
474
475 $ret.="$target: $files $dep_libs\n";
476
477 # NOTE: When building the test nlms no screen name is given
478 # which causes the console screen to be used. By using the console
479 # screen there is no "<press any key to continue>" message which
480 # requires user interaction. The test script ( do_tests.pl ) needs
481 # to be able to run the tests without requiring user interaction.
482 #
483 # However, the sample program "openssl.nlm" is used by the tests and is
484 # a interactive sample so a screen is desired when not be run by the
485 # tests. To solve the problem, two versions of the program are built:
486 # openssl2 - no screen used by tests
487 # openssl - default screen - use for normal interactive modes
488 #
489
490 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
491 if ($target =~ /E_EXE/)
492 {
493 my($target2) = $target;
494
495 $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
496
497 # openssl2
498 my($def_file2) = do_def_file($target2);
499
500 if ($gnuc)
501 {
502 $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
503 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n";
504 $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
505 }
506 else
507 {
508 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
509 }
510 }
511 if ($gnuc)
512 {
513 $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n";
514 $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
515 }
516 else
517 {
518 $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
519 }
520
521 $ret.="\n";
522 return($ret);
523
524}
525
5261;