From a00ae6c46e0d7907a7c9f9e85334e968aa5fd338 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 27 Jan 2015 10:06:22 -0500 Subject: [PATCH] OPENSSL_NO_xxx cleanup: many removals The following compile options (#ifdef's) are removed: OPENSSL_NO_BIO OPENSSL_NO_BUFFER OPENSSL_NO_CHAIN_VERIFY OPENSSL_NO_EVP OPENSSL_NO_FIPS_ERR OPENSSL_NO_HASH_COMP OPENSSL_NO_LHASH OPENSSL_NO_OBJECT OPENSSL_NO_SPEED OPENSSL_NO_STACK OPENSSL_NO_X509 OPENSSL_NO_X509_VERIFY This diff is big because of updating the indents on preprocessor lines. Reviewed-by: Richard Levitte --- apps/progs.h | 2 - apps/progs.pl | 2 - apps/speed.c | 1194 +++++++++++++++++++------------------- crypto/asn1/asn1.h | 10 +- crypto/bn/bn_print.c | 2 - crypto/dh/dh.h | 8 +- crypto/dsa/dsa.h | 6 +- crypto/ec/ec.h | 4 - crypto/err/err.c | 2 - crypto/err/err.h | 12 +- crypto/err/err_all.c | 2 - crypto/evp/evp.h | 13 +- crypto/lhash/lh_stats.c | 79 +-- crypto/lhash/lhash.c | 9 - crypto/lhash/lhash.h | 14 +- crypto/objects/obj_dat.c | 15 +- crypto/pem/pem.h | 24 +- crypto/rsa/rsa.h | 6 +- crypto/ts/ts.h | 12 +- crypto/ts/ts_asn1.c | 8 - crypto/txt_db/txt_db.h | 9 +- crypto/x509/x509.h | 26 +- crypto/x509/x509_vfy.c | 4 - crypto/x509/x509_vfy.h | 4 +- ssl/ssl.h | 24 +- ssl/ssl_cert.c | 6 - ssl/ssltest.c | 2 - 27 files changed, 616 insertions(+), 883 deletions(-) diff --git a/apps/progs.h b/apps/progs.h index 5eb974b23d..c66da3036b 100644 --- a/apps/progs.h +++ b/apps/progs.h @@ -113,9 +113,7 @@ FUNCTION functions[] = { #if !defined(OPENSSL_NO_SOCK) {FUNC_TYPE_GENERAL, "s_client", s_client_main}, #endif -#ifndef OPENSSL_NO_SPEED {FUNC_TYPE_GENERAL, "speed", speed_main}, -#endif #if !defined(OPENSSL_NO_SOCK) {FUNC_TYPE_GENERAL, "s_time", s_time_main}, #endif diff --git a/apps/progs.pl b/apps/progs.pl index 2b1efd8fed..8695742f28 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -33,8 +33,6 @@ foreach (@ARGV) $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n"; if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/)) { print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; } - elsif ( ($_ =~ /^speed$/)) - { print "#ifndef OPENSSL_NO_SPEED\n${str}#endif\n"; } elsif ( ($_ =~ /^engine$/)) { print "#ifndef OPENSSL_NO_ENGINE\n${str}#endif\n"; } elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || ($_ =~ /^rsautl$/)) diff --git a/apps/speed.c b/apps/speed.c index 1b4d23b4e8..f5af9a345e 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -69,147 +69,140 @@ * */ -/* most of this code has been pilfered from my libdes speed.c program */ - -#ifndef OPENSSL_NO_SPEED - -# undef SECONDS -# define SECONDS 3 -# define PRIME_SECONDS 10 -# define RSA_SECONDS 10 -# define DSA_SECONDS 10 -# define ECDSA_SECONDS 10 -# define ECDH_SECONDS 10 - -/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ -/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ - -# undef PROG -# define PROG speed_main - -# include -# include - -# include -# include -# include "apps.h" -# include -# include -# include -# include -# include -# if !defined(OPENSSL_SYS_MSDOS) -# include OPENSSL_UNISTD -# endif +#undef SECONDS +#define SECONDS 3 +#define PRIME_SECONDS 10 +#define RSA_SECONDS 10 +#define DSA_SECONDS 10 +#define ECDSA_SECONDS 10 +#define ECDH_SECONDS 10 + +#undef PROG +#define PROG speed_main + +#include +#include + +#include +#include +#include "apps.h" +#include +#include +#include +#include +#include +#if !defined(OPENSSL_SYS_MSDOS) +# include OPENSSL_UNISTD +#endif -# ifndef OPENSSL_SYS_NETWARE -# include -# endif +#ifndef OPENSSL_SYS_NETWARE +# include +#endif -# if defined(_WIN32) || defined(__CYGWIN__) -# include -# if defined(__CYGWIN__) && !defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) +# include +# if defined(__CYGWIN__) && !defined(_WIN32) /* * should define _WIN32, which normally is mutually exclusive * with __CYGWIN__, but if it didn't... */ -# define _WIN32 +# define _WIN32 /* this is done because Cygwin alarm() fails sometimes. */ -# endif -# endif - -# include -# ifndef OPENSSL_NO_DES -# include -# endif -# ifndef OPENSSL_NO_AES -# include -# endif -# ifndef OPENSSL_NO_CAMELLIA -# include -# endif -# ifndef OPENSSL_NO_MD2 -# include -# endif -# ifndef OPENSSL_NO_MDC2 -# include -# endif -# ifndef OPENSSL_NO_MD4 -# include -# endif -# ifndef OPENSSL_NO_MD5 -# include -# endif -# ifndef OPENSSL_NO_HMAC -# include -# endif -# include -# ifndef OPENSSL_NO_SHA -# include -# endif -# ifndef OPENSSL_NO_RMD160 -# include -# endif -# ifndef OPENSSL_NO_WHIRLPOOL -# include -# endif -# ifndef OPENSSL_NO_RC4 -# include -# endif -# ifndef OPENSSL_NO_RC5 -# include -# endif -# ifndef OPENSSL_NO_RC2 -# include -# endif -# ifndef OPENSSL_NO_IDEA -# include -# endif -# ifndef OPENSSL_NO_SEED -# include -# endif -# ifndef OPENSSL_NO_BF -# include -# endif -# ifndef OPENSSL_NO_CAST -# include -# endif -# ifndef OPENSSL_NO_RSA -# include -# include "./testrsa.h" -# endif -# include -# ifndef OPENSSL_NO_DSA -# include -# include "./testdsa.h" -# endif -# ifndef OPENSSL_NO_ECDSA -# include # endif -# ifndef OPENSSL_NO_ECDH -# include -# endif -# include +#endif -# include +#include +#ifndef OPENSSL_NO_DES +# include +#endif +#ifndef OPENSSL_NO_AES +# include +#endif +#ifndef OPENSSL_NO_CAMELLIA +# include +#endif +#ifndef OPENSSL_NO_MD2 +# include +#endif +#ifndef OPENSSL_NO_MDC2 +# include +#endif +#ifndef OPENSSL_NO_MD4 +# include +#endif +#ifndef OPENSSL_NO_MD5 +# include +#endif +#ifndef OPENSSL_NO_HMAC +# include +#endif +#include +#ifndef OPENSSL_NO_SHA +# include +#endif +#ifndef OPENSSL_NO_RMD160 +# include +#endif +#ifndef OPENSSL_NO_WHIRLPOOL +# include +#endif +#ifndef OPENSSL_NO_RC4 +# include +#endif +#ifndef OPENSSL_NO_RC5 +# include +#endif +#ifndef OPENSSL_NO_RC2 +# include +#endif +#ifndef OPENSSL_NO_IDEA +# include +#endif +#ifndef OPENSSL_NO_SEED +# include +#endif +#ifndef OPENSSL_NO_BF +# include +#endif +#ifndef OPENSSL_NO_CAST +# include +#endif +#ifndef OPENSSL_NO_RSA +# include +# include "./testrsa.h" +#endif +#include +#ifndef OPENSSL_NO_DSA +# include +# include "./testdsa.h" +#endif +#ifndef OPENSSL_NO_ECDSA +# include +#endif +#ifndef OPENSSL_NO_ECDH +# include +#endif +#include -# ifndef HAVE_FORK -# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE) -# define HAVE_FORK 0 -# else -# define HAVE_FORK 1 -# endif -# endif +#include -# if HAVE_FORK -# undef NO_FORK +#ifndef HAVE_FORK +# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE) +# define HAVE_FORK 0 # else -# define NO_FORK +# define HAVE_FORK 1 # endif +#endif -# undef BUFSIZE -# define BUFSIZE (1024*8+1) -# define MAX_MISALIGNMENT 63 +#if HAVE_FORK +# undef NO_FORK +#else +# define NO_FORK +#endif + +#undef BUFSIZE +#define BUFSIZE (1024*8+1) +#define MAX_MISALIGNMENT 63 static volatile int run = 0; @@ -221,18 +214,18 @@ static void print_message(const char *s, long num, int length); static void pkey_print_message(const char *str, const char *str2, long num, int bits, int sec); static void print_result(int alg, int run_no, int count, double time_used); -# ifndef NO_FORK +#ifndef NO_FORK static int do_multi(int multi); -# endif +#endif -# define ALGOR_NUM 30 -# define SIZE_NUM 5 -# define PRIME_NUM 3 -# define RSA_NUM 7 -# define DSA_NUM 3 +#define ALGOR_NUM 30 +#define SIZE_NUM 5 +#define PRIME_NUM 3 +#define RSA_NUM 7 +#define DSA_NUM 3 -# define EC_NUM 16 -# define MAX_ECDH_SIZE 256 +#define EC_NUM 16 +#define MAX_ECDH_SIZE 256 static const char *names[ALGOR_NUM] = { "md2", "mdc2", "md4", "md5", "hmac(md5)", "sha1", "rmd160", "rc4", @@ -247,31 +240,31 @@ static const char *names[ALGOR_NUM] = { static double results[ALGOR_NUM][SIZE_NUM]; static int lengths[SIZE_NUM] = { 16, 64, 256, 1024, 8 * 1024 }; -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA static double rsa_results[RSA_NUM][2]; -# endif -# ifndef OPENSSL_NO_DSA +#endif +#ifndef OPENSSL_NO_DSA static double dsa_results[DSA_NUM][2]; -# endif -# ifndef OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDSA static double ecdsa_results[EC_NUM][2]; -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH static double ecdh_results[EC_NUM][1]; -# endif +#endif -# if defined(OPENSSL_NO_DSA) && !(defined(OPENSSL_NO_ECDSA) && defined(OPENSSL_NO_ECDH)) +#if defined(OPENSSL_NO_DSA) && !(defined(OPENSSL_NO_ECDSA) && defined(OPENSSL_NO_ECDH)) static const char rnd_seed[] = "string to make the random number generator think it has entropy"; static int rnd_fake = 0; -# endif +#endif -# ifdef SIGALRM -# if defined(__STDC__) || defined(sgi) || defined(_AIX) -# define SIGRETTYPE void -# else -# define SIGRETTYPE int -# endif +#ifdef SIGALRM +# if defined(__STDC__) || defined(sgi) || defined(_AIX) +# define SIGRETTYPE void +# else +# define SIGRETTYPE int +# endif static SIGRETTYPE sig_done(int sig); static SIGRETTYPE sig_done(int sig) @@ -279,23 +272,23 @@ static SIGRETTYPE sig_done(int sig) signal(SIGALRM, sig_done); run = 0; } -# endif +#endif -# define START 0 -# define STOP 1 +#define START 0 +#define STOP 1 -# if defined(_WIN32) +#if defined(_WIN32) -# if !defined(SIGALRM) -# define SIGALRM -# endif +# if !defined(SIGALRM) +# define SIGALRM +# endif static unsigned int lapse, schlock; static void alarm_win32(unsigned int secs) { lapse = secs * 1000; } -# define alarm alarm_win32 +# define alarm alarm_win32 static DWORD WINAPI sleepy(VOID * arg) { @@ -330,7 +323,7 @@ static double Time_F(int s) return ret; } -# else +#else static double Time_F(int s) { @@ -339,24 +332,24 @@ static double Time_F(int s) alarm(0); return ret; } -# endif +#endif -# ifndef OPENSSL_NO_ECDH +#ifndef OPENSSL_NO_ECDH static const int KDF1_SHA1_len = 20; static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) { -# ifndef OPENSSL_NO_SHA +# ifndef OPENSSL_NO_SHA if (*outlen < SHA_DIGEST_LENGTH) return NULL; else *outlen = SHA_DIGEST_LENGTH; return SHA1(in, inlen, out); -# else +# else return NULL; -# endif /* OPENSSL_NO_SHA */ +# endif /* OPENSSL_NO_SHA */ } -# endif /* OPENSSL_NO_ECDH */ +#endif /* OPENSSL_NO_ECDH */ static void multiblock_speed(const EVP_CIPHER *evp_cipher); @@ -369,67 +362,67 @@ int MAIN(int argc, char **argv) int mret = 1; long count = 0, save_count = 0; int i, j, k; -# if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) +#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) long rsa_count; -# endif -# ifndef OPENSSL_NO_RSA +#endif +#ifndef OPENSSL_NO_RSA unsigned rsa_num; -# endif +#endif unsigned char md[EVP_MAX_MD_SIZE]; -# ifndef OPENSSL_NO_MD2 +#ifndef OPENSSL_NO_MD2 unsigned char md2[MD2_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_MDC2 unsigned char mdc2[MDC2_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_MD4 +#endif +#ifndef OPENSSL_NO_MD4 unsigned char md4[MD4_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_MD5 +#endif +#ifndef OPENSSL_NO_MD5 unsigned char md5[MD5_DIGEST_LENGTH]; unsigned char hmac[MD5_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_SHA +#endif +#ifndef OPENSSL_NO_SHA unsigned char sha[SHA_DIGEST_LENGTH]; -# ifndef OPENSSL_NO_SHA256 +# ifndef OPENSSL_NO_SHA256 unsigned char sha256[SHA256_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_SHA512 +# endif +# ifndef OPENSSL_NO_SHA512 unsigned char sha512[SHA512_DIGEST_LENGTH]; -# endif # endif -# ifndef OPENSSL_NO_WHIRLPOOL +#endif +#ifndef OPENSSL_NO_WHIRLPOOL unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_RMD160 +#endif +#ifndef OPENSSL_NO_RMD160 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 RC4_KEY rc4_ks; -# endif -# ifndef OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RC5 RC5_32_KEY rc5_ks; -# endif -# ifndef OPENSSL_NO_RC2 +#endif +#ifndef OPENSSL_NO_RC2 RC2_KEY rc2_ks; -# endif -# ifndef OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_IDEA IDEA_KEY_SCHEDULE idea_ks; -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED SEED_KEY_SCHEDULE seed_ks; -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF BF_KEY bf_ks; -# endif -# ifndef OPENSSL_NO_CAST +#endif +#ifndef OPENSSL_NO_CAST CAST_KEY cast_ks; -# endif +#endif static const unsigned char key16[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; -# ifndef OPENSSL_NO_AES +#ifndef OPENSSL_NO_AES static const unsigned char key24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, @@ -441,8 +434,8 @@ int MAIN(int argc, char **argv) 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA static const unsigned char ckey24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, @@ -454,15 +447,15 @@ int MAIN(int argc, char **argv) 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; -# endif -# ifndef OPENSSL_NO_AES -# define MAX_BLOCK_SIZE 128 -# else -# define MAX_BLOCK_SIZE 64 -# endif +#endif +#ifndef OPENSSL_NO_AES +# define MAX_BLOCK_SIZE 128 +#else +# define MAX_BLOCK_SIZE 64 +#endif unsigned char DES_iv[8]; unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; -# ifndef OPENSSL_NO_DES +#ifndef OPENSSL_NO_DES static DES_cblock key = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; static DES_cblock key2 = @@ -472,77 +465,77 @@ int MAIN(int argc, char **argv) DES_key_schedule sch; DES_key_schedule sch2; DES_key_schedule sch3; -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES AES_KEY aes_ks1, aes_ks2, aes_ks3; -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; -# endif -# define D_MD2 0 -# define D_MDC2 1 -# define D_MD4 2 -# define D_MD5 3 -# define D_HMAC 4 -# define D_SHA1 5 -# define D_RMD160 6 -# define D_RC4 7 -# define D_CBC_DES 8 -# define D_EDE3_DES 9 -# define D_CBC_IDEA 10 -# define D_CBC_SEED 11 -# define D_CBC_RC2 12 -# define D_CBC_RC5 13 -# define D_CBC_BF 14 -# define D_CBC_CAST 15 -# define D_CBC_128_AES 16 -# define D_CBC_192_AES 17 -# define D_CBC_256_AES 18 -# define D_CBC_128_CML 19 -# define D_CBC_192_CML 20 -# define D_CBC_256_CML 21 -# define D_EVP 22 -# define D_SHA256 23 -# define D_SHA512 24 -# define D_WHIRLPOOL 25 -# define D_IGE_128_AES 26 -# define D_IGE_192_AES 27 -# define D_IGE_256_AES 28 -# define D_GHASH 29 +#endif +#define D_MD2 0 +#define D_MDC2 1 +#define D_MD4 2 +#define D_MD5 3 +#define D_HMAC 4 +#define D_SHA1 5 +#define D_RMD160 6 +#define D_RC4 7 +#define D_CBC_DES 8 +#define D_EDE3_DES 9 +#define D_CBC_IDEA 10 +#define D_CBC_SEED 11 +#define D_CBC_RC2 12 +#define D_CBC_RC5 13 +#define D_CBC_BF 14 +#define D_CBC_CAST 15 +#define D_CBC_128_AES 16 +#define D_CBC_192_AES 17 +#define D_CBC_256_AES 18 +#define D_CBC_128_CML 19 +#define D_CBC_192_CML 20 +#define D_CBC_256_CML 21 +#define D_EVP 22 +#define D_SHA256 23 +#define D_SHA512 24 +#define D_WHIRLPOOL 25 +#define D_IGE_128_AES 26 +#define D_IGE_192_AES 27 +#define D_IGE_256_AES 28 +#define D_GHASH 29 double d = 0.0; long c[ALGOR_NUM][SIZE_NUM]; -# ifndef OPENSSL_SYS_WIN32 -# endif -# define R_DSA_512 0 -# define R_DSA_1024 1 -# define R_DSA_2048 2 -# define R_RSA_512 0 -# define R_RSA_1024 1 -# define R_RSA_2048 2 -# define R_RSA_3072 3 -# define R_RSA_4096 4 -# define R_RSA_7680 5 -# define R_RSA_15360 6 - -# define R_EC_P160 0 -# define R_EC_P192 1 -# define R_EC_P224 2 -# define R_EC_P256 3 -# define R_EC_P384 4 -# define R_EC_P521 5 -# define R_EC_K163 6 -# define R_EC_K233 7 -# define R_EC_K283 8 -# define R_EC_K409 9 -# define R_EC_K571 10 -# define R_EC_B163 11 -# define R_EC_B233 12 -# define R_EC_B283 13 -# define R_EC_B409 14 -# define R_EC_B571 15 - -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_SYS_WIN32 +#endif +#define R_DSA_512 0 +#define R_DSA_1024 1 +#define R_DSA_2048 2 +#define R_RSA_512 0 +#define R_RSA_1024 1 +#define R_RSA_2048 2 +#define R_RSA_3072 3 +#define R_RSA_4096 4 +#define R_RSA_7680 5 +#define R_RSA_15360 6 + +#define R_EC_P160 0 +#define R_EC_P192 1 +#define R_EC_P224 2 +#define R_EC_P256 3 +#define R_EC_P384 4 +#define R_EC_P521 5 +#define R_EC_K163 6 +#define R_EC_K233 7 +#define R_EC_K283 8 +#define R_EC_K409 9 +#define R_EC_K571 10 +#define R_EC_B163 11 +#define R_EC_B233 12 +#define R_EC_B283 13 +#define R_EC_B409 14 +#define R_EC_B571 15 + +#ifndef OPENSSL_NO_RSA RSA *rsa_key[RSA_NUM]; long rsa_c[RSA_NUM][2]; static unsigned int rsa_bits[RSA_NUM] = { @@ -557,13 +550,13 @@ int MAIN(int argc, char **argv) sizeof(test4096), sizeof(test7680), sizeof(test15360) }; -# endif -# ifndef OPENSSL_NO_DSA +#endif +#ifndef OPENSSL_NO_DSA DSA *dsa_key[DSA_NUM]; long dsa_c[DSA_NUM][2]; static unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 }; -# endif -# ifndef OPENSSL_NO_EC +#endif +#ifndef OPENSSL_NO_EC /* * We only test over the following curves as they are representative, To * add tests over more curves, simply add the curve NID and curve name to @@ -615,62 +608,62 @@ int MAIN(int argc, char **argv) 163, 233, 283, 409, 571 }; -# endif +#endif -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA unsigned char ecdsasig[256]; unsigned int ecdsasiglen; EC_KEY *ecdsa[EC_NUM]; long ecdsa_c[EC_NUM][2]; -# endif +#endif -# ifndef OPENSSL_NO_ECDH +#ifndef OPENSSL_NO_ECDH EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; int secret_size_a, secret_size_b; int ecdh_checks = 0; int secret_idx = 0; long ecdh_c[EC_NUM][2]; -# endif +#endif int rsa_doit[RSA_NUM]; int dsa_doit[DSA_NUM]; -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA int ecdsa_doit[EC_NUM]; -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH int ecdh_doit[EC_NUM]; -# endif +#endif int doit[ALGOR_NUM]; int pr_header = 0; const EVP_CIPHER *evp_cipher = NULL; const EVP_MD *evp_md = NULL; int decrypt = 0; -# ifndef NO_FORK +#ifndef NO_FORK int multi = 0; -# endif +#endif int multiblock = 0; int misalign = MAX_MISALIGNMENT + 1; -# ifndef TIMES +#ifndef TIMES usertime = -1; -# endif +#endif apps_startup(); memset(results, 0, sizeof(results)); -# ifndef OPENSSL_NO_DSA +#ifndef OPENSSL_NO_DSA memset(dsa_key, 0, sizeof(dsa_key)); -# endif -# ifndef OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa[i] = NULL; -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) { ecdh_a[i] = NULL; ecdh_b[i] = NULL; } -# endif +#endif if (bio_err == NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL) @@ -679,11 +672,11 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA memset(rsa_key, 0, sizeof(rsa_key)); for (i = 0; i < RSA_NUM; i++) rsa_key[i] = NULL; -# endif +#endif if ((buf_malloc = (unsigned char *)OPENSSL_malloc(BUFSIZE + misalign)) == NULL) { @@ -711,14 +704,14 @@ int MAIN(int argc, char **argv) rsa_doit[i] = 0; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 0; -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 0; -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 0; -# endif +#endif j = 0; argc--; @@ -750,7 +743,7 @@ int MAIN(int argc, char **argv) j--; /* Otherwise, -elapsed gets confused with an * algorithm. */ } -# ifndef OPENSSL_NO_ENGINE +#ifndef OPENSSL_NO_ENGINE else if ((argc > 0) && (strcmp(*argv, "-engine") == 0)) { argc--; argv++; @@ -766,8 +759,8 @@ int MAIN(int argc, char **argv) */ j--; } -# endif -# ifndef NO_FORK +#endif +#ifndef NO_FORK else if ((argc > 0) && (strcmp(*argv, "-multi") == 0)) { argc--; argv++; @@ -783,7 +776,7 @@ int MAIN(int argc, char **argv) j--; /* Otherwise, -mr gets confused with an * algorithm. */ } -# endif +#endif else if (argc > 0 && !strcmp(*argv, "-mr")) { mr = 1; j--; /* Otherwise, -mr gets confused with an @@ -809,54 +802,54 @@ int MAIN(int argc, char **argv) buf2 = buf2_malloc + misalign; j--; } else -# ifndef OPENSSL_NO_MD2 +#ifndef OPENSSL_NO_MD2 if (strcmp(*argv, "md2") == 0) doit[D_MD2] = 1; else -# endif -# ifndef OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_MDC2 if (strcmp(*argv, "mdc2") == 0) doit[D_MDC2] = 1; else -# endif -# ifndef OPENSSL_NO_MD4 +#endif +#ifndef OPENSSL_NO_MD4 if (strcmp(*argv, "md4") == 0) doit[D_MD4] = 1; else -# endif -# ifndef OPENSSL_NO_MD5 +#endif +#ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "md5") == 0) doit[D_MD5] = 1; else -# endif -# ifndef OPENSSL_NO_MD5 +#endif +#ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "hmac") == 0) doit[D_HMAC] = 1; else -# endif -# ifndef OPENSSL_NO_SHA +#endif +#ifndef OPENSSL_NO_SHA if (strcmp(*argv, "sha1") == 0) doit[D_SHA1] = 1; else if (strcmp(*argv, "sha") == 0) doit[D_SHA1] = 1, doit[D_SHA256] = 1, doit[D_SHA512] = 1; else -# ifndef OPENSSL_NO_SHA256 +# ifndef OPENSSL_NO_SHA256 if (strcmp(*argv, "sha256") == 0) doit[D_SHA256] = 1; else -# endif -# ifndef OPENSSL_NO_SHA512 +# endif +# ifndef OPENSSL_NO_SHA512 if (strcmp(*argv, "sha512") == 0) doit[D_SHA512] = 1; else -# endif # endif -# ifndef OPENSSL_NO_WHIRLPOOL +#endif +#ifndef OPENSSL_NO_WHIRLPOOL if (strcmp(*argv, "whirlpool") == 0) doit[D_WHIRLPOOL] = 1; else -# endif -# ifndef OPENSSL_NO_RMD160 +#endif +#ifndef OPENSSL_NO_RMD160 if (strcmp(*argv, "ripemd") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "rmd160") == 0) @@ -864,20 +857,20 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "ripemd160") == 0) doit[D_RMD160] = 1; else -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 if (strcmp(*argv, "rc4") == 0) doit[D_RC4] = 1; else -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES if (strcmp(*argv, "des-cbc") == 0) doit[D_CBC_DES] = 1; else if (strcmp(*argv, "des-ede3") == 0) doit[D_EDE3_DES] = 1; else -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes-128-cbc") == 0) doit[D_CBC_128_AES] = 1; else if (strcmp(*argv, "aes-192-cbc") == 0) @@ -891,8 +884,8 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "aes-256-ige") == 0) doit[D_IGE_256_AES] = 1; else -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia-128-cbc") == 0) doit[D_CBC_128_CML] = 1; else if (strcmp(*argv, "camellia-192-cbc") == 0) @@ -900,21 +893,21 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "camellia-256-cbc") == 0) doit[D_CBC_256_CML] = 1; else -# endif -# ifndef OPENSSL_NO_RSA -# if 0 /* was: #ifdef RSAref */ +#endif +#ifndef OPENSSL_NO_RSA +# if 0 /* was: #ifdef RSAref */ if (strcmp(*argv, "rsaref") == 0) { RSA_set_default_openssl_method(RSA_PKCS1_RSAref()); j--; } else -# endif -# ifndef RSA_NULL +# endif +# ifndef RSA_NULL if (strcmp(*argv, "openssl") == 0) { RSA_set_default_method(RSA_PKCS1_SSLeay()); j--; } else -# endif -# endif /* !OPENSSL_NO_RSA */ +# endif +#endif /* !OPENSSL_NO_RSA */ if (strcmp(*argv, "dsa512") == 0) dsa_doit[R_DSA_512] = 2; else if (strcmp(*argv, "dsa1024") == 0) @@ -936,35 +929,35 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "rsa15360") == 0) rsa_doit[R_RSA_15360] = 2; else -# ifndef OPENSSL_NO_RC2 +#ifndef OPENSSL_NO_RC2 if (strcmp(*argv, "rc2-cbc") == 0) doit[D_CBC_RC2] = 1; else if (strcmp(*argv, "rc2") == 0) doit[D_CBC_RC2] = 1; else -# endif -# ifndef OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RC5 if (strcmp(*argv, "rc5-cbc") == 0) doit[D_CBC_RC5] = 1; else if (strcmp(*argv, "rc5") == 0) doit[D_CBC_RC5] = 1; else -# endif -# ifndef OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_IDEA if (strcmp(*argv, "idea-cbc") == 0) doit[D_CBC_IDEA] = 1; else if (strcmp(*argv, "idea") == 0) doit[D_CBC_IDEA] = 1; else -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED if (strcmp(*argv, "seed-cbc") == 0) doit[D_CBC_SEED] = 1; else if (strcmp(*argv, "seed") == 0) doit[D_CBC_SEED] = 1; else -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF if (strcmp(*argv, "bf-cbc") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "blowfish") == 0) @@ -972,8 +965,8 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "bf") == 0) doit[D_CBC_BF] = 1; else -# endif -# ifndef OPENSSL_NO_CAST +#endif +#ifndef OPENSSL_NO_CAST if (strcmp(*argv, "cast-cbc") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast") == 0) @@ -981,14 +974,14 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv, "cast5") == 0) doit[D_CBC_CAST] = 1; else -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES if (strcmp(*argv, "des") == 0) { doit[D_CBC_DES] = 1; doit[D_EDE3_DES] = 1; } else -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes") == 0) { doit[D_CBC_128_AES] = 1; doit[D_CBC_192_AES] = 1; @@ -996,15 +989,15 @@ int MAIN(int argc, char **argv) } else if (strcmp(*argv, "ghash") == 0) { doit[D_GHASH] = 1; } else -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia") == 0) { doit[D_CBC_128_CML] = 1; doit[D_CBC_192_CML] = 1; doit[D_CBC_256_CML] = 1; } else -# endif -# ifndef OPENSSL_NO_RSA +#endif +#ifndef OPENSSL_NO_RSA if (strcmp(*argv, "rsa") == 0) { rsa_doit[R_RSA_512] = 1; rsa_doit[R_RSA_1024] = 1; @@ -1014,15 +1007,15 @@ int MAIN(int argc, char **argv) rsa_doit[R_RSA_7680] = 1; rsa_doit[R_RSA_15360] = 1; } else -# endif -# ifndef OPENSSL_NO_DSA +#endif +#ifndef OPENSSL_NO_DSA if (strcmp(*argv, "dsa") == 0) { dsa_doit[R_DSA_512] = 1; dsa_doit[R_DSA_1024] = 1; dsa_doit[R_DSA_2048] = 1; } else -# endif -# ifndef OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDSA if (strcmp(*argv, "ecdsap160") == 0) ecdsa_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdsap192") == 0) @@ -1059,8 +1052,8 @@ int MAIN(int argc, char **argv) for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; } else -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH if (strcmp(*argv, "ecdhp160") == 0) ecdh_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdhp192") == 0) @@ -1097,94 +1090,94 @@ int MAIN(int argc, char **argv) for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; } else -# endif +#endif { BIO_printf(bio_err, "Error: bad option or value\n"); BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available values:\n"); -# ifndef OPENSSL_NO_MD2 +#ifndef OPENSSL_NO_MD2 BIO_printf(bio_err, "md2 "); -# endif -# ifndef OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_MDC2 BIO_printf(bio_err, "mdc2 "); -# endif -# ifndef OPENSSL_NO_MD4 +#endif +#ifndef OPENSSL_NO_MD4 BIO_printf(bio_err, "md4 "); -# endif -# ifndef OPENSSL_NO_MD5 +#endif +#ifndef OPENSSL_NO_MD5 BIO_printf(bio_err, "md5 "); -# ifndef OPENSSL_NO_HMAC +# ifndef OPENSSL_NO_HMAC BIO_printf(bio_err, "hmac "); -# endif # endif -# ifndef OPENSSL_NO_SHA1 +#endif +#ifndef OPENSSL_NO_SHA1 BIO_printf(bio_err, "sha1 "); -# endif -# ifndef OPENSSL_NO_SHA256 +#endif +#ifndef OPENSSL_NO_SHA256 BIO_printf(bio_err, "sha256 "); -# endif -# ifndef OPENSSL_NO_SHA512 +#endif +#ifndef OPENSSL_NO_SHA512 BIO_printf(bio_err, "sha512 "); -# endif -# ifndef OPENSSL_NO_WHIRLPOOL +#endif +#ifndef OPENSSL_NO_WHIRLPOOL BIO_printf(bio_err, "whirlpool"); -# endif -# ifndef OPENSSL_NO_RMD160 +#endif +#ifndef OPENSSL_NO_RMD160 BIO_printf(bio_err, "rmd160"); -# endif -# if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \ +#endif +#if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \ !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RMD160) || \ !defined(OPENSSL_NO_WHIRLPOOL) BIO_printf(bio_err, "\n"); -# endif +#endif -# ifndef OPENSSL_NO_IDEA +#ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea-cbc "); -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed-cbc "); -# endif -# ifndef OPENSSL_NO_RC2 +#endif +#ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2-cbc "); -# endif -# ifndef OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RC5 BIO_printf(bio_err, "rc5-cbc "); -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF BIO_printf(bio_err, "bf-cbc"); -# endif -# if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \ +#endif +#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \ !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5) BIO_printf(bio_err, "\n"); -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des-cbc des-ede3 "); -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes-128-cbc aes-192-cbc aes-256-cbc "); BIO_printf(bio_err, "aes-128-ige aes-192-ige aes-256-ige "); -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "camellia-128-cbc camellia-192-cbc camellia-256-cbc "); -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 BIO_printf(bio_err, "rc4"); -# endif +#endif BIO_printf(bio_err, "\n"); -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa512 rsa1024 rsa2048 rsa3072 rsa4096\n"); BIO_printf(bio_err, "rsa7680 rsa15360\n"); -# endif +#endif -# ifndef OPENSSL_NO_DSA +#ifndef OPENSSL_NO_DSA BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); -# endif -# ifndef OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDSA BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 " "ecdsap256 ecdsap384 ecdsap521\n"); BIO_printf(bio_err, @@ -1192,8 +1185,8 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n"); BIO_printf(bio_err, "ecdsa\n"); -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 " "ecdhp256 ecdhp384 ecdhp521\n"); BIO_printf(bio_err, @@ -1201,50 +1194,50 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n"); BIO_printf(bio_err, "ecdh\n"); -# endif +#endif -# ifndef OPENSSL_NO_IDEA +#ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea "); -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed "); -# endif -# ifndef OPENSSL_NO_RC2 +#endif +#ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2 "); -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des "); -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes "); -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "camellia "); -# endif -# ifndef OPENSSL_NO_RSA +#endif +#ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa "); -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF BIO_printf(bio_err, "blowfish"); -# endif -# if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \ +#endif +#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \ !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \ !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \ !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA) BIO_printf(bio_err, "\n"); -# endif +#endif BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available options:\n"); -# if defined(TIMES) || defined(USE_TOD) +#if defined(TIMES) || defined(USE_TOD) BIO_printf(bio_err, "-elapsed " "measure time in real time instead of CPU user time.\n"); -# endif -# ifndef OPENSSL_NO_ENGINE +#endif +#ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, "-engine e " "use engine e, possibly a hardware device.\n"); -# endif +#endif BIO_printf(bio_err, "-evp e " "use EVP e.\n"); BIO_printf(bio_err, "-decrypt " @@ -1258,10 +1251,10 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "-misalign n " "perform benchmark with misaligned data\n"); -# ifndef NO_FORK +#ifndef NO_FORK BIO_printf(bio_err, "-multi n " "run n benchmarks in parallel.\n"); -# endif +#endif goto end; } argc--; @@ -1269,10 +1262,10 @@ int MAIN(int argc, char **argv) j++; } -# ifndef NO_FORK +#ifndef NO_FORK if (multi && do_multi(multi)) goto show_res; -# endif +#endif if (j == 0) { for (i = 0; i < ALGOR_NUM; i++) { @@ -1283,14 +1276,14 @@ int MAIN(int argc, char **argv) rsa_doit[i] = 1; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 1; -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; -# endif +#endif } for (i = 0; i < ALGOR_NUM; i++) if (doit[i]) @@ -1301,7 +1294,7 @@ int MAIN(int argc, char **argv) "You have chosen to measure elapsed time " "instead of user CPU time.\n"); -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) { const unsigned char *p; @@ -1312,7 +1305,7 @@ int MAIN(int argc, char **argv) i); goto end; } -# if 0 +# if 0 else { BIO_printf(bio_err, mr ? "+RK:%d:" @@ -1321,57 +1314,57 @@ int MAIN(int argc, char **argv) BN_print(bio_err, rsa_key[i]->e); BIO_printf(bio_err, "\n"); } -# endif - } # endif + } +#endif -# ifndef OPENSSL_NO_DSA +#ifndef OPENSSL_NO_DSA dsa_key[0] = get_dsa512(); dsa_key[1] = get_dsa1024(); dsa_key[2] = get_dsa2048(); -# endif +#endif -# ifndef OPENSSL_NO_DES +#ifndef OPENSSL_NO_DES DES_set_key_unchecked(&key, &sch); DES_set_key_unchecked(&key2, &sch2); DES_set_key_unchecked(&key3, &sch3); -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES AES_set_encrypt_key(key16, 128, &aes_ks1); AES_set_encrypt_key(key24, 192, &aes_ks2); AES_set_encrypt_key(key32, 256, &aes_ks3); -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA Camellia_set_key(key16, 128, &camellia_ks1); Camellia_set_key(ckey24, 192, &camellia_ks2); Camellia_set_key(ckey32, 256, &camellia_ks3); -# endif -# ifndef OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_IDEA idea_set_encrypt_key(key16, &idea_ks); -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED SEED_set_key(key16, &seed_ks); -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 RC4_set_key(&rc4_ks, 16, key16); -# endif -# ifndef OPENSSL_NO_RC2 +#endif +#ifndef OPENSSL_NO_RC2 RC2_set_key(&rc2_ks, 16, key16, 128); -# endif -# ifndef OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RC5 RC5_32_set_key(&rc5_ks, 16, key16, 12); -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF BF_set_key(&bf_ks, 16, key16); -# endif -# ifndef OPENSSL_NO_CAST +#endif +#ifndef OPENSSL_NO_CAST CAST_set_key(&cast_ks, 16, key16); -# endif -# ifndef OPENSSL_NO_RSA +#endif +#ifndef OPENSSL_NO_RSA memset(rsa_c, 0, sizeof(rsa_c)); -# endif -# ifndef SIGALRM -# ifndef OPENSSL_NO_DES +#endif +#ifndef SIGALRM +# ifndef OPENSSL_NO_DES BIO_printf(bio_err, "First we calculate the approximate speed ...\n"); count = 10; do { @@ -1453,7 +1446,7 @@ int MAIN(int argc, char **argv) c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1; } -# ifndef OPENSSL_NO_RSA +# ifndef OPENSSL_NO_RSA rsa_c[R_RSA_512][0] = count / 2000; rsa_c[R_RSA_512][1] = count / 400; for (i = 1; i < RSA_NUM; i++) { @@ -1468,9 +1461,9 @@ int MAIN(int argc, char **argv) } } } -# endif +# endif -# ifndef OPENSSL_NO_DSA +# ifndef OPENSSL_NO_DSA dsa_c[R_DSA_512][0] = count / 1000; dsa_c[R_DSA_512][1] = count / 1000 / 2; for (i = 1; i < DSA_NUM; i++) { @@ -1485,9 +1478,9 @@ int MAIN(int argc, char **argv) } } } -# endif +# endif -# ifndef OPENSSL_NO_ECDSA +# ifndef OPENSSL_NO_ECDSA ecdsa_c[R_EC_P160][0] = count / 1000; ecdsa_c[R_EC_P160][1] = count / 1000 / 2; for (i = R_EC_P192; i <= R_EC_P521; i++) { @@ -1530,9 +1523,9 @@ int MAIN(int argc, char **argv) } } } -# endif +# endif -# ifndef OPENSSL_NO_ECDH +# ifndef OPENSSL_NO_ECDH ecdh_c[R_EC_P160][0] = count / 1000; ecdh_c[R_EC_P160][1] = count / 1000; for (i = R_EC_P192; i <= R_EC_P521; i++) { @@ -1575,23 +1568,23 @@ int MAIN(int argc, char **argv) } } } -# endif +# endif -# define COND(d) (count < (d)) -# define COUNT(d) (d) -# else -/* not worth fixing */ -# error "You cannot disable DES on systems without SIGALRM." -# endif /* OPENSSL_NO_DES */ +# define COND(d) (count < (d)) +# define COUNT(d) (d) # else -# define COND(c) (run && count<0x7fffffff) -# define COUNT(d) (count) -# ifndef _WIN32 +/* not worth fixing */ +# error "You cannot disable DES on systems without SIGALRM." +# endif /* OPENSSL_NO_DES */ +#else +# define COND(c) (run && count<0x7fffffff) +# define COUNT(d) (count) +# ifndef _WIN32 signal(SIGALRM, sig_done); -# endif -# endif /* SIGALRM */ +# endif +#endif /* SIGALRM */ -# ifndef OPENSSL_NO_MD2 +#ifndef OPENSSL_NO_MD2 if (doit[D_MD2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD2], c[D_MD2][j], lengths[j]); @@ -1603,8 +1596,8 @@ int MAIN(int argc, char **argv) print_result(D_MD2, j, count, d); } } -# endif -# ifndef OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_MDC2 if (doit[D_MDC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MDC2], c[D_MDC2][j], lengths[j]); @@ -1616,9 +1609,9 @@ int MAIN(int argc, char **argv) print_result(D_MDC2, j, count, d); } } -# endif +#endif -# ifndef OPENSSL_NO_MD4 +#ifndef OPENSSL_NO_MD4 if (doit[D_MD4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD4], c[D_MD4][j], lengths[j]); @@ -1630,9 +1623,9 @@ int MAIN(int argc, char **argv) print_result(D_MD4, j, count, d); } } -# endif +#endif -# ifndef OPENSSL_NO_MD5 +#ifndef OPENSSL_NO_MD5 if (doit[D_MD5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD5], c[D_MD5][j], lengths[j]); @@ -1643,9 +1636,9 @@ int MAIN(int argc, char **argv) print_result(D_MD5, j, count, d); } } -# endif +#endif -# if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_HMAC) +#if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_HMAC) if (doit[D_HMAC]) { HMAC_CTX hctx; @@ -1666,24 +1659,24 @@ int MAIN(int argc, char **argv) } HMAC_CTX_cleanup(&hctx); } -# endif -# ifndef OPENSSL_NO_SHA +#endif +#ifndef OPENSSL_NO_SHA if (doit[D_SHA1]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) -# if 0 +# if 0 EVP_Digest(buf, (unsigned long)lengths[j], &(sha[0]), NULL, EVP_sha1(), NULL); -# else +# else SHA1(buf, lengths[j], sha); -# endif +# endif d = Time_F(STOP); print_result(D_SHA1, j, count, d); } } -# ifndef OPENSSL_NO_SHA256 +# ifndef OPENSSL_NO_SHA256 if (doit[D_SHA256]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); @@ -1694,9 +1687,9 @@ int MAIN(int argc, char **argv) print_result(D_SHA256, j, count, d); } } -# endif +# endif -# ifndef OPENSSL_NO_SHA512 +# ifndef OPENSSL_NO_SHA512 if (doit[D_SHA512]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); @@ -1707,10 +1700,10 @@ int MAIN(int argc, char **argv) print_result(D_SHA512, j, count, d); } } -# endif # endif +#endif -# ifndef OPENSSL_NO_WHIRLPOOL +#ifndef OPENSSL_NO_WHIRLPOOL if (doit[D_WHIRLPOOL]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]); @@ -1721,9 +1714,9 @@ int MAIN(int argc, char **argv) print_result(D_WHIRLPOOL, j, count, d); } } -# endif +#endif -# ifndef OPENSSL_NO_RMD160 +#ifndef OPENSSL_NO_RMD160 if (doit[D_RMD160]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); @@ -1735,8 +1728,8 @@ int MAIN(int argc, char **argv) print_result(D_RMD160, j, count, d); } } -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 if (doit[D_RC4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RC4], c[D_RC4][j], lengths[j]); @@ -1747,8 +1740,8 @@ int MAIN(int argc, char **argv) print_result(D_RC4, j, count, d); } } -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES if (doit[D_CBC_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); @@ -1773,8 +1766,8 @@ int MAIN(int argc, char **argv) print_result(D_EDE3_DES, j, count, d); } } -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES if (doit[D_CBC_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], @@ -1869,8 +1862,8 @@ int MAIN(int argc, char **argv) } CRYPTO_gcm128_release(ctx); } -# endif -# ifndef OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAMELLIA if (doit[D_CBC_128_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], @@ -1910,8 +1903,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_256_CML, j, count, d); } } -# endif -# ifndef OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_IDEA if (doit[D_CBC_IDEA]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); @@ -1924,8 +1917,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_IDEA, j, count, d); } } -# endif -# ifndef OPENSSL_NO_SEED +#endif +#ifndef OPENSSL_NO_SEED if (doit[D_CBC_SEED]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_SEED], c[D_CBC_SEED][j], lengths[j]); @@ -1937,8 +1930,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_SEED, j, count, d); } } -# endif -# ifndef OPENSSL_NO_RC2 +#endif +#ifndef OPENSSL_NO_RC2 if (doit[D_CBC_RC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); @@ -1951,8 +1944,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_RC2, j, count, d); } } -# endif -# ifndef OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RC5 if (doit[D_CBC_RC5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC5], c[D_CBC_RC5][j], lengths[j]); @@ -1965,8 +1958,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_RC5, j, count, d); } } -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF if (doit[D_CBC_BF]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); @@ -1979,8 +1972,8 @@ int MAIN(int argc, char **argv) print_result(D_CBC_BF, j, count, d); } } -# endif -# ifndef OPENSSL_NO_CAST +#endif +#ifndef OPENSSL_NO_CAST if (doit[D_CBC_CAST]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); @@ -1993,10 +1986,10 @@ int MAIN(int argc, char **argv) print_result(D_CBC_CAST, j, count, d); } } -# endif +#endif if (doit[D_EVP]) { -# ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK +#ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK if (multiblock && evp_cipher) { if (! (EVP_CIPHER_flags(evp_cipher) & @@ -2009,7 +2002,7 @@ int MAIN(int argc, char **argv) mret = 0; goto end; } -# endif +#endif for (j = 0; j < SIZE_NUM; j++) { if (evp_cipher) { EVP_CIPHER_CTX ctx; @@ -2061,10 +2054,10 @@ int MAIN(int argc, char **argv) print_result(D_EVP, j, count, d); } } -# ifndef OPENSSL_SYS_WIN32 -# endif +#ifndef OPENSSL_SYS_WIN32 +#endif RAND_pseudo_bytes(buf, 36); -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA for (j = 0; j < RSA_NUM; j++) { int ret; if (!rsa_doit[j]) @@ -2099,7 +2092,7 @@ int MAIN(int argc, char **argv) rsa_count = count; } -# if 1 +# if 1 ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, @@ -2127,7 +2120,7 @@ int MAIN(int argc, char **argv) count, rsa_bits[j], d); rsa_results[j][1] = d / (double)count; } -# endif +# endif if (rsa_count <= 1) { /* if longer than 10s, don't do any more */ @@ -2135,10 +2128,10 @@ int MAIN(int argc, char **argv) rsa_doit[j] = 0; } } -# endif +#endif RAND_pseudo_bytes(buf, 20); -# ifndef OPENSSL_NO_DSA +#ifndef OPENSSL_NO_DSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; @@ -2215,9 +2208,9 @@ int MAIN(int argc, char **argv) } if (rnd_fake) RAND_cleanup(); -# endif +#endif -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; @@ -2233,9 +2226,9 @@ int MAIN(int argc, char **argv) ERR_print_errors(bio_err); rsa_count = 1; } else { -# if 1 +# if 1 EC_KEY_precompute_mult(ecdsa[j], NULL); -# endif +# endif /* Perform ECDSA signature test */ EC_KEY_generate_key(ecdsa[j]); ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); @@ -2310,9 +2303,9 @@ int MAIN(int argc, char **argv) } if (rnd_fake) RAND_cleanup(); -# endif +#endif -# ifndef OPENSSL_NO_ECDH +#ifndef OPENSSL_NO_ECDH if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; @@ -2403,33 +2396,33 @@ int MAIN(int argc, char **argv) } if (rnd_fake) RAND_cleanup(); -# endif -# ifndef NO_FORK +#endif +#ifndef NO_FORK show_res: -# endif +#endif if (!mr) { fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION)); fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON)); printf("options:"); printf("%s ", BN_options()); -# ifndef OPENSSL_NO_MD2 +#ifndef OPENSSL_NO_MD2 printf("%s ", MD2_options()); -# endif -# ifndef OPENSSL_NO_RC4 +#endif +#ifndef OPENSSL_NO_RC4 printf("%s ", RC4_options()); -# endif -# ifndef OPENSSL_NO_DES +#endif +#ifndef OPENSSL_NO_DES printf("%s ", DES_options()); -# endif -# ifndef OPENSSL_NO_AES +#endif +#ifndef OPENSSL_NO_AES printf("%s ", AES_options()); -# endif -# ifndef OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_IDEA printf("%s ", idea_options()); -# endif -# ifndef OPENSSL_NO_BF +#endif +#ifndef OPENSSL_NO_BF printf("%s ", BF_options()); -# endif +#endif fprintf(stdout, "\n%s\n", SSLeay_version(SSLEAY_CFLAGS)); } @@ -2461,7 +2454,7 @@ int MAIN(int argc, char **argv) } fprintf(stdout, "\n"); } -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA j = 1; for (k = 0; k < RSA_NUM; k++) { if (!rsa_doit[k]) @@ -2478,8 +2471,8 @@ int MAIN(int argc, char **argv) rsa_bits[k], rsa_results[k][0], rsa_results[k][1], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1]); } -# endif -# ifndef OPENSSL_NO_DSA +#endif +#ifndef OPENSSL_NO_DSA j = 1; for (k = 0; k < DSA_NUM; k++) { if (!dsa_doit[k]) @@ -2496,8 +2489,8 @@ int MAIN(int argc, char **argv) dsa_bits[k], dsa_results[k][0], dsa_results[k][1], 1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1]); } -# endif -# ifndef OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDSA j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdsa_doit[k]) @@ -2519,9 +2512,9 @@ int MAIN(int argc, char **argv) ecdsa_results[k][0], ecdsa_results[k][1], 1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]); } -# endif +#endif -# ifndef OPENSSL_NO_ECDH +#ifndef OPENSSL_NO_ECDH j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdh_doit[k]) @@ -2541,7 +2534,7 @@ int MAIN(int argc, char **argv) test_curves_names[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); } -# endif +#endif mret = 0; @@ -2551,30 +2544,30 @@ int MAIN(int argc, char **argv) OPENSSL_free(buf_malloc); if (buf2_malloc != NULL) OPENSSL_free(buf2_malloc); -# ifndef OPENSSL_NO_RSA +#ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) if (rsa_key[i] != NULL) RSA_free(rsa_key[i]); -# endif -# ifndef OPENSSL_NO_DSA +#endif +#ifndef OPENSSL_NO_DSA for (i = 0; i < DSA_NUM; i++) if (dsa_key[i] != NULL) DSA_free(dsa_key[i]); -# endif +#endif -# ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_ECDSA for (i = 0; i < EC_NUM; i++) if (ecdsa[i] != NULL) EC_KEY_free(ecdsa[i]); -# endif -# ifndef OPENSSL_NO_ECDH +#endif +#ifndef OPENSSL_NO_ECDH for (i = 0; i < EC_NUM; i++) { if (ecdh_a[i] != NULL) EC_KEY_free(ecdh_a[i]); if (ecdh_b[i] != NULL) EC_KEY_free(ecdh_b[i]); } -# endif +#endif apps_shutdown(); OPENSSL_EXIT(mret); @@ -2582,35 +2575,35 @@ int MAIN(int argc, char **argv) static void print_message(const char *s, long num, int length) { -# ifdef SIGALRM +#ifdef SIGALRM BIO_printf(bio_err, mr ? "+DT:%s:%d:%d\n" : "Doing %s for %ds on %d size blocks: ", s, SECONDS, length); (void)BIO_flush(bio_err); alarm(SECONDS); -# else +#else BIO_printf(bio_err, mr ? "+DN:%s:%ld:%d\n" : "Doing %s %ld times on %d size blocks: ", s, num, length); (void)BIO_flush(bio_err); -# endif +#endif } static void pkey_print_message(const char *str, const char *str2, long num, int bits, int tm) { -# ifdef SIGALRM +#ifdef SIGALRM BIO_printf(bio_err, mr ? "+DTP:%d:%s:%s:%d\n" : "Doing %d bit %s %s's for %ds: ", bits, str, str2, tm); (void)BIO_flush(bio_err); alarm(tm); -# else +#else BIO_printf(bio_err, mr ? "+DNP:%ld:%d:%s:%s\n" : "Doing %ld %d bit %s %s's: ", num, bits, str, str2); (void)BIO_flush(bio_err); -# endif +#endif } static void print_result(int alg, int run_no, int count, double time_used) @@ -2621,7 +2614,7 @@ static void print_result(int alg, int run_no, int count, double time_used) results[alg][run_no] = ((double)count) / time_used * lengths[run_no]; } -# ifndef NO_FORK +#ifndef NO_FORK static char *sstrsep(char **string, const char *delim) { char isdelim[256]; @@ -2749,7 +2742,7 @@ static int do_multi(int multi) else rsa_results[k][1] = d; } -# ifndef OPENSSL_NO_DSA +# ifndef OPENSSL_NO_DSA else if (!strncmp(buf, "+F3:", 4)) { int k; double d; @@ -2770,8 +2763,8 @@ static int do_multi(int multi) else dsa_results[k][1] = d; } -# endif -# ifndef OPENSSL_NO_ECDSA +# endif +# ifndef OPENSSL_NO_ECDSA else if (!strncmp(buf, "+F4:", 4)) { int k; double d; @@ -2794,9 +2787,9 @@ static int do_multi(int multi) else ecdsa_results[k][1] = d; } -# endif +# endif -# ifndef OPENSSL_NO_ECDH +# ifndef OPENSSL_NO_ECDH else if (!strncmp(buf, "+F5:", 4)) { int k; double d; @@ -2812,7 +2805,7 @@ static int do_multi(int multi) ecdh_results[k][0] = d; } -# endif +# endif else if (!strncmp(buf, "+H:", 3)) { } else @@ -2824,7 +2817,7 @@ static int do_multi(int multi) free(fds); return 1; } -# endif +#endif static void multiblock_speed(const EVP_CIPHER *evp_cipher) { @@ -2925,4 +2918,3 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher) OPENSSL_free(inp); OPENSSL_free(out); } -#endif diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index a8f9c0c92a..e3fea150b3 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -61,9 +61,7 @@ # include # include -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # include # include @@ -827,10 +825,8 @@ int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, const unsigned char *flags, int flags_len); -# ifndef OPENSSL_NO_BIO int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, BIT_STRING_BITNAME *tbl, int indent); -# endif int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, BIT_STRING_BITNAME *tbl); @@ -915,7 +911,6 @@ STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, void (*free_func) (OPENSSL_BLOCK), int ex_tag, int ex_class); -# ifndef OPENSSL_NO_BIO int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); @@ -923,7 +918,6 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a); int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); -# endif int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a); int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); @@ -1015,7 +1009,6 @@ int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); -# ifndef OPENSSL_NO_BIO void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); # define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ @@ -1048,7 +1041,6 @@ int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump); -# endif const char *ASN1_tag2str(int tag); /* Used to load and write netscape format cert */ diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c index 0f356c24be..1000e69a86 100644 --- a/crypto/bn/bn_print.c +++ b/crypto/bn/bn_print.c @@ -322,7 +322,6 @@ int BN_asc2bn(BIGNUM **bn, const char *a) return 1; } -#ifndef OPENSSL_NO_BIO # ifndef OPENSSL_NO_STDIO int BN_print_fp(FILE *fp, const BIGNUM *a) { @@ -362,7 +361,6 @@ int BN_print(BIO *bp, const BIGNUM *a) end: return (ret); } -#endif char *BN_options(void) { diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h index ececd4d176..2d7c739eca 100644 --- a/crypto/dh/dh.h +++ b/crypto/dh/dh.h @@ -65,9 +65,7 @@ # error DH is disabled. # endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # include # ifdef OPENSSL_USE_DEPRECATED # include @@ -233,11 +231,7 @@ int i2d_DHxparams(const DH *a, unsigned char **pp); # ifndef OPENSSL_NO_STDIO int DHparams_print_fp(FILE *fp, const DH *x); # endif -# ifndef OPENSSL_NO_BIO int DHparams_print(BIO *bp, const DH *x); -# else -int DHparams_print(char *bp, const DH *x); -# endif /* RFC 5114 parameters */ DH *DH_get_1024_160(void); diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h index 2bb6b1100d..949360faab 100644 --- a/crypto/dsa/dsa.h +++ b/crypto/dsa/dsa.h @@ -71,9 +71,7 @@ # error DSA is disabled. # endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # include # include @@ -248,10 +246,8 @@ int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); int i2d_DSAparams(const DSA *a, unsigned char **pp); -# ifndef OPENSSL_NO_BIO int DSAparams_print(BIO *bp, const DSA *x); int DSA_print(BIO *bp, const DSA *x, int off); -# endif # ifndef OPENSSL_NO_STDIO int DSAparams_print_fp(FILE *fp, const DSA *x); int DSA_print_fp(FILE *bp, const DSA *x, int off); diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index a3d50e73d7..b89add60e0 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -729,9 +729,7 @@ int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); # define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ (unsigned char *)(x)) -# ifndef OPENSSL_NO_BIO int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); -# endif # ifndef OPENSSL_NO_STDIO int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); # endif @@ -951,7 +949,6 @@ EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); */ int i2o_ECPublicKey(EC_KEY *key, unsigned char **out); -# ifndef OPENSSL_NO_BIO /** Prints out the ec parameters on human readable form. * \param bp BIO object to which the information is printed * \param key EC_KEY object @@ -967,7 +964,6 @@ int ECParameters_print(BIO *bp, const EC_KEY *key); */ int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); -# endif # ifndef OPENSSL_NO_STDIO /** Prints out the ec parameters on human readable form. * \param fp file descriptor to which the information is printed diff --git a/crypto/err/err.c b/crypto/err/err.c index ed50511fcf..50865b8b26 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -109,8 +109,6 @@ * */ -#define OPENSSL_NO_FIPS_ERR - #include #include #include diff --git a/crypto/err/err.h b/crypto/err/err.h index d24ec9a7a6..577a121475 100644 --- a/crypto/err/err.h +++ b/crypto/err/err.h @@ -120,12 +120,8 @@ # endif # include -# ifndef OPENSSL_NO_BIO -# include -# endif -# ifndef OPENSSL_NO_LHASH -# include -# endif +# include +# include #ifdef __cplusplus extern "C" { @@ -341,9 +337,7 @@ void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), # ifndef OPENSSL_NO_STDIO void ERR_print_errors_fp(FILE *fp); # endif -# ifndef OPENSSL_NO_BIO void ERR_print_errors(BIO *bp); -# endif void ERR_add_error_data(int num, ...); void ERR_add_error_vdata(int num, va_list args); void ERR_load_strings(int lib, ERR_STRING_DATA str[]); @@ -359,11 +353,9 @@ DECLARE_DEPRECATED(void ERR_remove_state(unsigned long pid)); /* if zero we # endif ERR_STATE *ERR_get_state(void); -# ifndef OPENSSL_NO_LHASH LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void); LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void); void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash); -# endif int ERR_get_next_error_library(void); diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c index 54693ed3f4..1363fb026a 100644 --- a/crypto/err/err_all.c +++ b/crypto/err/err_all.c @@ -56,8 +56,6 @@ * [including the GNU Public Licence.] */ -#define OPENSSL_NO_FIPS_ERR - #include #include #include diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 0882324135..7a95de0b1d 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -71,17 +71,8 @@ # include -# ifndef OPENSSL_NO_BIO -# include -# endif +# include -/*- -#define EVP_RC2_KEY_SIZE 16 -#define EVP_RC4_KEY_SIZE 16 -#define EVP_BLOWFISH_KEY_SIZE 16 -#define EVP_CAST5_KEY_SIZE 16 -#define EVP_RC5_32_12_16_KEY_SIZE 16 -*/ # define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ # define EVP_MAX_KEY_LENGTH 64 # define EVP_MAX_IV_LENGTH 16 @@ -751,14 +742,12 @@ int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); -# ifndef OPENSSL_NO_BIO BIO_METHOD *BIO_f_md(void); BIO_METHOD *BIO_f_base64(void); BIO_METHOD *BIO_f_cipher(void); BIO_METHOD *BIO_f_reliable(void); __owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, const unsigned char *i, int enc); -# endif const EVP_MD *EVP_md_null(void); # ifndef OPENSSL_NO_MD2 diff --git a/crypto/lhash/lh_stats.c b/crypto/lhash/lh_stats.c index 8b09966097..0a213991d8 100644 --- a/crypto/lhash/lh_stats.c +++ b/crypto/lhash/lh_stats.c @@ -65,78 +65,9 @@ */ #include "cryptlib.h" -#ifndef OPENSSL_NO_BIO -# include -#endif +#include #include -#ifdef OPENSSL_NO_BIO - -void lh_stats(LHASH *lh, FILE *out) -{ - fprintf(out, "num_items = %lu\n", lh->num_items); - fprintf(out, "num_nodes = %u\n", lh->num_nodes); - fprintf(out, "num_alloc_nodes = %u\n", lh->num_alloc_nodes); - fprintf(out, "num_expands = %lu\n", lh->num_expands); - fprintf(out, "num_expand_reallocs = %lu\n", lh->num_expand_reallocs); - fprintf(out, "num_contracts = %lu\n", lh->num_contracts); - fprintf(out, "num_contract_reallocs = %lu\n", lh->num_contract_reallocs); - fprintf(out, "num_hash_calls = %lu\n", lh->num_hash_calls); - fprintf(out, "num_comp_calls = %lu\n", lh->num_comp_calls); - fprintf(out, "num_insert = %lu\n", lh->num_insert); - fprintf(out, "num_replace = %lu\n", lh->num_replace); - fprintf(out, "num_delete = %lu\n", lh->num_delete); - fprintf(out, "num_no_delete = %lu\n", lh->num_no_delete); - fprintf(out, "num_retrieve = %lu\n", lh->num_retrieve); - fprintf(out, "num_retrieve_miss = %lu\n", lh->num_retrieve_miss); - fprintf(out, "num_hash_comps = %lu\n", lh->num_hash_comps); -# if 0 - fprintf(out, "p = %u\n", lh->p); - fprintf(out, "pmax = %u\n", lh->pmax); - fprintf(out, "up_load = %lu\n", lh->up_load); - fprintf(out, "down_load = %lu\n", lh->down_load); -# endif -} - -void lh_node_stats(LHASH *lh, FILE *out) -{ - LHASH_NODE *n; - unsigned int i, num; - - for (i = 0; i < lh->num_nodes; i++) { - for (n = lh->b[i], num = 0; n != NULL; n = n->next) - num++; - fprintf(out, "node %6u -> %3u\n", i, num); - } -} - -void lh_node_usage_stats(LHASH *lh, FILE *out) -{ - LHASH_NODE *n; - unsigned long num; - unsigned int i; - unsigned long total = 0, n_used = 0; - - for (i = 0; i < lh->num_nodes; i++) { - for (n = lh->b[i], num = 0; n != NULL; n = n->next) - num++; - if (num != 0) { - n_used++; - total += num; - } - } - fprintf(out, "%lu nodes used out of %u\n", n_used, lh->num_nodes); - fprintf(out, "%lu items\n", total); - if (n_used == 0) - return; - fprintf(out, "load %d.%02d actual load %d.%02d\n", - (int)(total / lh->num_nodes), - (int)((total % lh->num_nodes) * 100 / lh->num_nodes), - (int)(total / n_used), (int)((total % n_used) * 100 / n_used)); -} - -#else - # ifndef OPENSSL_NO_STDIO void lh_stats(const _LHASH *lh, FILE *fp) { @@ -198,12 +129,6 @@ void lh_stats_bio(const _LHASH *lh, BIO *out) BIO_printf(out, "num_retrieve = %lu\n", lh->num_retrieve); BIO_printf(out, "num_retrieve_miss = %lu\n", lh->num_retrieve_miss); BIO_printf(out, "num_hash_comps = %lu\n", lh->num_hash_comps); -# if 0 - BIO_printf(out, "p = %u\n", lh->p); - BIO_printf(out, "pmax = %u\n", lh->pmax); - BIO_printf(out, "up_load = %lu\n", lh->up_load); - BIO_printf(out, "down_load = %lu\n", lh->down_load); -# endif } void lh_node_stats_bio(const _LHASH *lh, BIO *out) @@ -242,5 +167,3 @@ void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) (int)((total % lh->num_nodes) * 100 / lh->num_nodes), (int)(total / n_used), (int)((total % n_used) * 100 / n_used)); } - -#endif diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index 53c5c138bb..5e9bfb8b1c 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -194,9 +194,7 @@ void *lh_insert(_LHASH *lh, void *data) } nn->data = data; nn->next = NULL; -#ifndef OPENSSL_NO_HASH_COMP nn->hash = hash; -#endif *rn = nn; ret = NULL; lh->num_insert++; @@ -315,12 +313,7 @@ static void expand(_LHASH *lh) nni = lh->num_alloc_nodes; for (np = *n1; np != NULL;) { -#ifndef OPENSSL_NO_HASH_COMP hash = np->hash; -#else - hash = lh->hash(np->data); - lh->num_hash_calls++; -#endif if ((hash % nni) != p) { /* move it */ *n1 = (*n1)->next; np->next = *n2; @@ -404,13 +397,11 @@ static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash) cf = lh->comp; ret = &(lh->b[(int)nn]); for (n1 = *ret; n1 != NULL; n1 = n1->next) { -#ifndef OPENSSL_NO_HASH_COMP lh->num_hash_comps++; if (n1->hash != hash) { ret = &(n1->next); continue; } -#endif lh->num_comp_calls++; if (cf(n1->data, data) == 0) break; diff --git a/crypto/lhash/lhash.h b/crypto/lhash/lhash.h index 8ddac6ba28..92ec80af4b 100644 --- a/crypto/lhash/lhash.h +++ b/crypto/lhash/lhash.h @@ -68,9 +68,7 @@ # include # endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include #ifdef __cplusplus extern "C" { @@ -79,9 +77,7 @@ extern "C" { typedef struct lhash_node_st { void *data; struct lhash_node_st *next; -# ifndef OPENSSL_NO_HASH_COMP unsigned long hash; -# endif } LHASH_NODE; typedef int (*LHASH_COMP_FN_TYPE) (const void *, const void *); @@ -182,17 +178,9 @@ void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); unsigned long lh_strhash(const char *c); unsigned long lh_num_items(const _LHASH *lh); -# ifndef OPENSSL_NO_STDIO -void lh_stats(const _LHASH *lh, FILE *out); -void lh_node_stats(const _LHASH *lh, FILE *out); -void lh_node_usage_stats(const _LHASH *lh, FILE *out); -# endif - -# ifndef OPENSSL_NO_BIO void lh_stats_bio(const _LHASH *lh, BIO *out); void lh_node_stats_bio(const _LHASH *lh, BIO *out); void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out); -# endif /* Type checking... */ diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 0b06ea4a01..e7366af8dc 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -66,20 +66,7 @@ #include /* obj_dat.h is generated from objects.h by obj_dat.pl */ -#ifndef OPENSSL_NO_OBJECT -# include "obj_dat.h" -#else -/* You will have to load all the objects needed manually in the application */ -# define NUM_NID 0 -# define NUM_SN 0 -# define NUM_LN 0 -# define NUM_OBJ 0 -static const unsigned char lvalues[1]; -static const ASN1_OBJECT nid_objs[1]; -static const unsigned int sn_objs[1]; -static const unsigned int ln_objs[1]; -static const unsigned int obj_objs[1]; -#endif +#include "obj_dat.h" DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index 848649d3da..d8057cbaa0 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -60,12 +60,8 @@ # define HEADER_PEM_H # include -# ifndef OPENSSL_NO_BIO -# include -# endif -# ifndef OPENSSL_NO_STACK -# include -# endif +# include +# include # include # include # include @@ -343,7 +339,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ # endif -# ifndef OPENSSL_NO_BIO # define DECLARE_PEM_read_bio(name, type) \ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); @@ -357,13 +352,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ unsigned char *kstr, int klen, pem_password_cb *cb, void *u); -# else - -# define DECLARE_PEM_read_bio(name, type) /**/ -# define DECLARE_PEM_write_bio(name, type) /**/ -# define DECLARE_PEM_write_bio_const(name, type) /**/ -# define DECLARE_PEM_write_cb_bio(name, type) /**/ -# endif # define DECLARE_PEM_write(name, type) \ DECLARE_PEM_write_bio(name, type) \ DECLARE_PEM_write_fp(name, type) @@ -385,19 +373,12 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ # define DECLARE_PEM_rw_cb(name, type) \ DECLARE_PEM_read(name, type) \ DECLARE_PEM_write_cb(name, type) -# if 1 -/* "userdata": new with OpenSSL 0.9.4 */ typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); -# else -/* OpenSSL 0.9.3, 0.9.3a */ -typedef int pem_password_cb (char *buf, int size, int rwflag); -# endif int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, pem_password_cb *callback, void *u); -# ifndef OPENSSL_NO_BIO int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len); int PEM_write_bio(BIO *bp, const char *name, const char *hdr, @@ -416,7 +397,6 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u); -# endif int PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len); diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index b3d2839669..9ba64970b6 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -61,9 +61,7 @@ # include -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # include # include # ifdef OPENSSL_USE_DEPRECATED @@ -395,9 +393,7 @@ DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) int RSA_print_fp(FILE *fp, const RSA *r, int offset); # endif -# ifndef OPENSSL_NO_BIO int RSA_print(BIO *bp, const RSA *r, int offset); -# endif # ifndef OPENSSL_NO_RC4 int i2d_RSA_NET(const RSA *a, unsigned char **pp, diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h index 16eccbb38d..8b6b5f29a3 100644 --- a/crypto/ts/ts.h +++ b/crypto/ts/ts.h @@ -62,15 +62,9 @@ # include # include -# ifndef OPENSSL_NO_BUFFER -# include -# endif -# ifndef OPENSSL_NO_EVP -# include -# endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include +# include +# include # include # include # include diff --git a/crypto/ts/ts_asn1.c b/crypto/ts/ts_asn1.c index 06bf5f37d3..7c741d9691 100644 --- a/crypto/ts/ts_asn1.c +++ b/crypto/ts/ts_asn1.c @@ -67,7 +67,6 @@ ASN1_SEQUENCE(TS_MSG_IMPRINT) = { IMPLEMENT_ASN1_FUNCTIONS_const(TS_MSG_IMPRINT) IMPLEMENT_ASN1_DUP_FUNCTION(TS_MSG_IMPRINT) -#ifndef OPENSSL_NO_BIO TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT **a) { return ASN1_d2i_bio_of(TS_MSG_IMPRINT, TS_MSG_IMPRINT_new, @@ -78,7 +77,6 @@ int i2d_TS_MSG_IMPRINT_bio(BIO *bp, TS_MSG_IMPRINT *a) { return ASN1_i2d_bio_of_const(TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, bp, a); } -#endif #ifndef OPENSSL_NO_STDIO TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a) { @@ -103,7 +101,6 @@ ASN1_SEQUENCE(TS_REQ) = { IMPLEMENT_ASN1_FUNCTIONS_const(TS_REQ) IMPLEMENT_ASN1_DUP_FUNCTION(TS_REQ) -#ifndef OPENSSL_NO_BIO TS_REQ *d2i_TS_REQ_bio(BIO *bp, TS_REQ **a) { return ASN1_d2i_bio_of(TS_REQ, TS_REQ_new, d2i_TS_REQ, bp, a); @@ -113,7 +110,6 @@ int i2d_TS_REQ_bio(BIO *bp, TS_REQ *a) { return ASN1_i2d_bio_of_const(TS_REQ, i2d_TS_REQ, bp, a); } -#endif #ifndef OPENSSL_NO_STDIO TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a) { @@ -150,7 +146,6 @@ ASN1_SEQUENCE(TS_TST_INFO) = { IMPLEMENT_ASN1_FUNCTIONS_const(TS_TST_INFO) IMPLEMENT_ASN1_DUP_FUNCTION(TS_TST_INFO) -#ifndef OPENSSL_NO_BIO TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO **a) { return ASN1_d2i_bio_of(TS_TST_INFO, TS_TST_INFO_new, d2i_TS_TST_INFO, bp, @@ -161,7 +156,6 @@ int i2d_TS_TST_INFO_bio(BIO *bp, TS_TST_INFO *a) { return ASN1_i2d_bio_of_const(TS_TST_INFO, i2d_TS_TST_INFO, bp, a); } -#endif #ifndef OPENSSL_NO_STDIO TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a) { @@ -236,7 +230,6 @@ IMPLEMENT_ASN1_FUNCTIONS_const(TS_RESP) IMPLEMENT_ASN1_DUP_FUNCTION(TS_RESP) -#ifndef OPENSSL_NO_BIO TS_RESP *d2i_TS_RESP_bio(BIO *bp, TS_RESP **a) { return ASN1_d2i_bio_of(TS_RESP, TS_RESP_new, d2i_TS_RESP, bp, a); @@ -246,7 +239,6 @@ int i2d_TS_RESP_bio(BIO *bp, TS_RESP *a) { return ASN1_i2d_bio_of_const(TS_RESP, i2d_TS_RESP, bp, a); } -#endif #ifndef OPENSSL_NO_STDIO TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a) { diff --git a/crypto/txt_db/txt_db.h b/crypto/txt_db/txt_db.h index 98e23a2003..54b71fc03e 100644 --- a/crypto/txt_db/txt_db.h +++ b/crypto/txt_db/txt_db.h @@ -60,9 +60,7 @@ # define HEADER_TXT_DB_H # include -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # include # include @@ -91,13 +89,8 @@ typedef struct txt_db_st { OPENSSL_STRING *arg_row; } TXT_DB; -# ifndef OPENSSL_NO_BIO TXT_DB *TXT_DB_read(BIO *in, int num); long TXT_DB_write(BIO *out, TXT_DB *db); -# else -TXT_DB *TXT_DB_read(char *in, int num); -long TXT_DB_write(char *out, TXT_DB *db); -# endif int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); void TXT_DB_free(TXT_DB *db); diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index 8e672621ce..5b25de036b 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -66,15 +66,9 @@ # include # include -# ifndef OPENSSL_NO_BUFFER -# include -# endif -# ifndef OPENSSL_NO_EVP -# include -# endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include +# include +# include # include # include # include @@ -179,11 +173,7 @@ DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) struct X509_name_st { STACK_OF(X509_NAME_ENTRY) *entries; int modified; /* true if 'bytes' needs to be built */ -# ifndef OPENSSL_NO_BUFFER BUF_MEM *bytes; -# else - char *bytes; -# endif /* unsigned long hash; Keep the hash around for lookups */ unsigned char *canon_enc; int canon_enclen; @@ -492,7 +482,6 @@ typedef struct private_key_st { int references; } X509_PKEY; -# ifndef OPENSSL_NO_EVP typedef struct X509_info_st { X509 *x509; X509_CRL *crl; @@ -504,7 +493,6 @@ typedef struct X509_info_st { } X509_INFO; DECLARE_STACK_OF(X509_INFO) -# endif /* * The next 2 structures and their 8 routines were sent to me by Pat Richard @@ -627,7 +615,6 @@ void *X509_CRL_get_meth_data(X509_CRL *crl); const char *X509_verify_cert_error_string(long n); -# ifndef OPENSSL_NO_EVP int X509_verify(X509 *a, EVP_PKEY *r); int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); @@ -664,7 +651,6 @@ int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, unsigned char *md, unsigned int *len); int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, unsigned char *md, unsigned int *len); -# endif # ifndef OPENSSL_NO_STDIO X509 *d2i_X509_fp(FILE *fp, X509 **x509); @@ -705,7 +691,6 @@ int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); # endif -# ifndef OPENSSL_NO_BIO X509 *d2i_X509_bio(BIO *bp, X509 **x509); int i2d_X509_bio(BIO *bp, X509 *x509); X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); @@ -742,7 +727,6 @@ int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); -# endif X509 *X509_dup(X509 *x509); X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); @@ -869,7 +853,6 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) -# ifndef OPENSSL_NO_EVP X509_INFO *X509_INFO_new(void); void X509_INFO_free(X509_INFO *a); char *X509_NAME_oneline(X509_NAME *a, char *buf, int size); @@ -896,7 +879,6 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx); -# endif int X509_set_version(X509 *x, long version); int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); @@ -992,7 +974,6 @@ int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); # endif -# ifndef OPENSSL_NO_BIO int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); @@ -1005,7 +986,6 @@ int X509_CRL_print(BIO *bp, X509_CRL *x); int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); int X509_REQ_print(BIO *bp, X509_REQ *req); -# endif int X509_NAME_entry_count(X509_NAME *name); int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index f5da926a12..8e639c829d 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -538,9 +538,6 @@ static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) static int check_chain_extensions(X509_STORE_CTX *ctx) { -#ifdef OPENSSL_NO_CHAIN_VERIFY - return 1; -#else int i, ok = 0, must_be_ca, plen = 0; X509 *x; int (*cb) (int xok, X509_STORE_CTX *xctx); @@ -680,7 +677,6 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) ok = 1; end: return ok; -#endif } static int check_name_constraints(X509_STORE_CTX *ctx) diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h index 105862bc71..959af30fa8 100644 --- a/crypto/x509/x509_vfy.h +++ b/crypto/x509/x509_vfy.h @@ -68,9 +68,7 @@ # define HEADER_X509_VFY_H # include -# ifndef OPENSSL_NO_LHASH -# include -# endif +# include # include # include # include diff --git a/ssl/ssl.h b/ssl/ssl.h index ad2136a020..a0025e656b 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -148,13 +148,9 @@ # ifndef OPENSSL_NO_COMP # include # endif -# ifndef OPENSSL_NO_BIO -# include -# endif +# include # ifdef OPENSSL_USE_DEPRECATED -# ifndef OPENSSL_NO_X509 -# include -# endif +# include # include # include # include @@ -1417,20 +1413,12 @@ struct ssl_st { * There are 2 BIO's even though they are normally both the same. This * is so data can be read and written to different handlers */ -# ifndef OPENSSL_NO_BIO /* used by SSL_read */ BIO *rbio; /* used by SSL_write */ BIO *wbio; /* used during session-id reuse to concatenate messages */ BIO *bbio; -# else - /* used by SSL_read */ - char *rbio; - /* used by SSL_write */ - char *wbio; - char *bbio; -# endif /* * This holds a variable that indicates what we were doing when a 0 or -1 * is returned. This is needed for non-blocking IO so we know what @@ -2108,7 +2096,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) # define SSL_get0_ec_point_formats(s, plst) \ SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) -# ifndef OPENSSL_NO_BIO + BIO_METHOD *BIO_f_ssl(void); BIO *BIO_new_ssl(SSL_CTX *ctx, int client); BIO *BIO_new_ssl_connect(SSL_CTX *ctx); @@ -2116,8 +2104,6 @@ BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); int BIO_ssl_copy_session_id(BIO *to, BIO *from); void BIO_ssl_shutdown(BIO *ssl_bio); -# endif - int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); void SSL_CTX_free(SSL_CTX *); @@ -2148,11 +2134,9 @@ int SSL_set_fd(SSL *s, int fd); int SSL_set_rfd(SSL *s, int fd); int SSL_set_wfd(SSL *s, int fd); # endif -# ifndef OPENSSL_NO_BIO void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); BIO *SSL_get_rbio(const SSL *s); BIO *SSL_get_wbio(const SSL *s); -# endif int SSL_set_cipher_list(SSL *s, const char *str); void SSL_set_read_ahead(SSL *s, int yes); int SSL_get_verify_mode(const SSL *s); @@ -2222,10 +2206,8 @@ unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); # ifndef OPENSSL_NO_STDIO int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); # endif -# ifndef OPENSSL_NO_BIO int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); -# endif void SSL_SESSION_free(SSL_SESSION *ses); int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); int SSL_set_session(SSL *to, SSL_SESSION *session); diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index bfaf69aff7..f2de54bdf5 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -740,7 +740,6 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk) i = s->ctx->app_verify_callback(&ctx); /* should pass app_verify_arg */ #endif else { -#ifndef OPENSSL_NO_X509_VERIFY i = X509_verify_cert(&ctx); # if 0 /* Dummy error calls so mkerr generates them */ @@ -750,11 +749,6 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk) # endif if (i > 0) i = ssl_security_cert_chain(s, ctx.chain, NULL, 1); -#else - i = 0; - ctx.error = X509_V_ERR_APPLICATION_VERIFICATION; - SSLerr(SSL_F_SSL_VERIFY_CERT_CHAIN, SSL_R_NO_VERIFY_CALLBACK); -#endif } s->verify_result = ctx.error; diff --git a/ssl/ssltest.c b/ssl/ssltest.c index d217efae34..a49fd86d3d 100644 --- a/ssl/ssltest.c +++ b/ssl/ssltest.c @@ -2909,9 +2909,7 @@ static int app_verify_callback(X509_STORE_CTX *ctx, void *arg) if (cb_arg->allow_proxy_certs) { X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS); } -#ifndef OPENSSL_NO_X509_VERIFY ok = X509_verify_cert(ctx); -#endif if (cb_arg->proxy_auth) { if (ok > 0) { -- 2.34.1