From 75d0ebef2aef7a2c77b27575b8da898e22f3ccd5 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 30 Jan 2015 14:52:57 -0500 Subject: [PATCH] Dead code clean: #if 0 removal in apps Reviewed-by: Tim Hudson --- apps/ca.c | 12 ------------ apps/engine.c | 3 --- apps/openssl.c | 7 +------ apps/s_cb.c | 4 ---- apps/s_client.c | 25 ------------------------- apps/s_server.c | 49 ------------------------------------------------- apps/s_time.c | 16 ---------------- apps/smime.c | 5 ----- apps/speed.c | 16 ---------------- 9 files changed, 1 insertion(+), 136 deletions(-) diff --git a/apps/ca.c b/apps/ca.c index a9171123c2..bcb3f50d8a 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -2171,18 +2171,6 @@ static void write_new_certificate(BIO *bp, X509 *x, int output_der, (void)i2d_X509_bio(bp, x); return; } -#if 0 - /* ??? Not needed since X509_print prints all this stuff anyway */ - f = X509_NAME_oneline(X509_get_issuer_name(x), buf, 256); - BIO_printf(bp, "issuer :%s\n", f); - - f = X509_NAME_oneline(X509_get_subject_name(x), buf, 256); - BIO_printf(bp, "subject:%s\n", f); - - BIO_puts(bp, "serial :"); - i2a_ASN1_INTEGER(bp, x->cert_info->serialNumber); - BIO_puts(bp, "\n\n"); -#endif if (!notext) X509_print(bp, x); PEM_write_bio_X509(bp, x); diff --git a/apps/engine.c b/apps/engine.c index 275d5999ed..8a1e746ab6 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -196,9 +196,6 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, if (!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) || ((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE, 0, NULL, NULL)) <= 0)) { -# if 0 - BIO_printf(bio_out, "%s\n", indent); -# endif return 1; } diff --git a/apps/openssl.c b/apps/openssl.c index b19628571b..50c8275a4e 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -301,12 +301,7 @@ int main(int Argc, char *ARGV[]) } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); -#if 0 - if (getenv("OPENSSL_DEBUG_LOCKING") != NULL) -#endif - { - CRYPTO_set_locking_callback(lock_dbg_cb); - } + CRYPTO_set_locking_callback(lock_dbg_cb); if (getenv("OPENSSL_FIPS")) { #ifdef OPENSSL_FIPS diff --git a/apps/s_cb.c b/apps/s_cb.c index eb89949525..eef86cb77b 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -812,10 +812,6 @@ void msg_cb(int write_p, int version, int content_type, const void *buf, BIO_printf(bio, " "); num = len; -#if 0 - if (num > 16) - num = 16; -#endif for (i = 0; i < num; i++) { if (i % 16 == 0 && i > 0) BIO_printf(bio, "\n "); diff --git a/apps/s_client.c b/apps/s_client.c index 0fb4771108..325dbf11b3 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1326,10 +1326,6 @@ int MAIN(int argc, char **argv) if (state) SSL_CTX_set_info_callback(ctx, apps_ssl_info_callback); -#if 0 - else - SSL_CTX_set_cipher_list(ctx, getenv("SSL_CIPHER")); -#endif SSL_CTX_set_verify(ctx, verify, verify_callback); @@ -1508,17 +1504,6 @@ int MAIN(int argc, char **argv) SSL_set_tlsext_status_type(con, TLSEXT_STATUSTYPE_ocsp); SSL_CTX_set_tlsext_status_cb(ctx, ocsp_resp_cb); SSL_CTX_set_tlsext_status_arg(ctx, bio_c_out); -# if 0 - { - STACK_OF(OCSP_RESPID) *ids = sk_OCSP_RESPID_new_null(); - OCSP_RESPID *id = OCSP_RESPID_new(); - id->value.byKey = ASN1_OCTET_STRING_new(); - id->type = V_OCSP_RESPID_KEY; - ASN1_STRING_set(id->value.byKey, "Hello World", -1); - sk_OCSP_RESPID_push(ids, id); - SSL_set_tlsext_status_ids(con, ids); - } -# endif } #endif #ifndef OPENSSL_NO_JPAKE @@ -1667,16 +1652,6 @@ int MAIN(int argc, char **argv) tty_on = 1; if (in_init) { in_init = 0; -#if 0 /* This test doesn't really work as intended - * (needs to be fixed) */ -# ifndef OPENSSL_NO_TLSEXT - if (servername != NULL && !SSL_session_reused(con)) { - BIO_printf(bio_c_out, - "Server did %sacknowledge servername extension.\n", - tlsextcbp.ack ? "" : "not "); - } -# endif -#endif if (sess_out) { BIO *stmp = BIO_new_file(sess_out, "w"); if (stmp) { diff --git a/apps/s_server.c b/apps/s_server.c index e6ea350baf..5537fdea0f 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -838,12 +838,6 @@ static int cert_status_cb(SSL *s, void *arg) STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; -# if 0 - STACK_OF(OCSP_RESPID) *ids; - SSL_get_tlsext_status_ids(s, &ids); - BIO_printf(err, "cert_status: received %d ids\n", - sk_OCSP_RESPID_num(ids)); -# endif if (srctx->verbose) BIO_puts(err, "cert_status: callback called\n"); /* Build up OCSP query from server certificate */ @@ -1735,19 +1729,6 @@ int MAIN(int argc, char *argv[]) SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles); #endif -#if 0 - if (cipher == NULL) - cipher = getenv("SSL_CIPHER"); -#endif - -#if 0 - if (s_cert_file == NULL) { - BIO_printf(bio_err, - "You must specify a certificate file for the server to use\n"); - goto end; - } -#endif - if ((!SSL_CTX_load_verify_locations(ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(ctx))) { /* BIO_printf(bio_err,"X509_load_verify_locations\n"); */ @@ -2691,27 +2672,6 @@ static DH *load_dh_param(const char *dhfile) } #endif -#if 0 -static int load_CA(SSL_CTX *ctx, char *file) -{ - FILE *in; - X509 *x = NULL; - - if ((in = fopen(file, "r")) == NULL) - return (0); - - for (;;) { - if (PEM_read_X509(in, &x, NULL) == NULL) - break; - SSL_CTX_add_client_CA(ctx, x); - } - if (x != NULL) - X509_free(x); - fclose(in); - return (1); -} -#endif - static int www_body(char *hostname, int s, int stype, unsigned char *context) { char *buf = NULL; @@ -3010,21 +2970,12 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context) BIO_printf(io, "'%s' is an invalid path\r\n", p); break; } -#if 0 - /* append if a directory lookup */ - if (e[-1] == '/') - strcat(p, "index.html"); -#endif /* if a directory, do the index thang */ if (app_isdir(p) > 0) { -#if 0 /* must check buffer size */ - strcat(p, "/index.html"); -#else BIO_puts(io, text); BIO_printf(io, "'%s' is a directory\r\n", p); break; -#endif } if ((file = BIO_new_file(p, "r")) == NULL) { diff --git a/apps/s_time.c b/apps/s_time.c index 972dccff2c..102ee7291b 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -217,17 +217,6 @@ static int parseArgs(int argc, char **argv) goto bad; host = *(++argv); } -#if 0 - else if (strcmp(*argv, "-host") == 0) { - if (--argc < 1) - goto bad; - host = *(++argv); - } else if (strcmp(*argv, "-port") == 0) { - if (--argc < 1) - goto bad; - port = *(++argv); - } -#endif else if (strcmp(*argv, "-reuse") == 0) perform = 2; else if (strcmp(*argv, "-new") == 0) @@ -582,11 +571,6 @@ static SSL *doConnection(SSL *scon) SSL_set_bio(serverCon, conn, conn); -#if 0 - if (scon != NULL) - SSL_set_session(serverCon, SSL_get_session(scon)); -#endif - /* ok, lets connect */ for (;;) { i = SSL_connect(serverCon); diff --git a/apps/smime.c b/apps/smime.c index 05321a9356..5efe51f7d7 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -511,11 +511,6 @@ int MAIN(int argc, char **argv) while (*args) { if (!(cert = load_cert(bio_err, *args, FORMAT_PEM, NULL, e, "recipient certificate file"))) { -#if 0 /* An appropriate message is already printed */ - BIO_printf(bio_err, - "Can't read recipient certificate file %s\n", - *args); -#endif goto end; } sk_X509_push(encerts, cert); diff --git a/apps/speed.c b/apps/speed.c index 419dced807..8dc9de9ce6 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -874,12 +874,6 @@ int MAIN(int argc, char **argv) else #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 if (strcmp(*argv, "openssl") == 0) { RSA_set_default_method(RSA_PKCS1_SSLeay()); @@ -1273,16 +1267,6 @@ int MAIN(int argc, char **argv) i); goto end; } -# if 0 - else { - BIO_printf(bio_err, - mr ? "+RK:%d:" - : "Loaded RSA key, %d bit modulus and e= 0x", - BN_num_bits(rsa_key[i]->n)); - BN_print(bio_err, rsa_key[i]->e); - BIO_printf(bio_err, "\n"); - } -# endif } #endif -- 2.40.0