summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-07-09 21:02:35 +0000
committertedu <tedu@openbsd.org>2014-07-09 21:02:35 +0000
commit4980287c3a268f1ba0d1f7952c9afe831c9c247c (patch)
treee45dc63e46e540090c212d3733f4834dcccc5100 /lib
parentclean up if 0/if 1 code. we don't care anymore. (diff)
downloadwireguard-openbsd-4980287c3a268f1ba0d1f7952c9afe831c9c247c.tar.xz
wireguard-openbsd-4980287c3a268f1ba0d1f7952c9afe831c9c247c.zip
unifdef a whole bunch of NO RSA/DSA/ECDH defines i deleted from libssl
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/apps/apps.c6
-rw-r--r--lib/libssl/src/apps/dhparam.c16
-rw-r--r--lib/libssl/src/apps/dsa.c4
-rw-r--r--lib/libssl/src/apps/dsaparam.c4
-rw-r--r--lib/libssl/src/apps/gendsa.c4
-rw-r--r--lib/libssl/src/apps/genrsa.c4
-rw-r--r--lib/libssl/src/apps/req.c12
-rw-r--r--lib/libssl/src/apps/rsa.c4
-rw-r--r--lib/libssl/src/apps/rsautl.c4
-rw-r--r--lib/libssl/src/apps/s_server.c22
-rw-r--r--lib/libssl/src/apps/speed.c112
-rw-r--r--lib/libssl/src/apps/x509.c10
12 files changed, 12 insertions, 190 deletions
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c
index 17f4f7668c5..e586ec26cca 100644
--- a/lib/libssl/src/apps/apps.c
+++ b/lib/libssl/src/apps/apps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.c,v 1.62 2014/07/09 20:37:20 tedu Exp $ */
+/* $OpenBSD: apps.c,v 1.63 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -137,9 +137,7 @@
#include <openssl/engine.h>
#endif
-#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
-#endif
typedef struct {
const char *name;
@@ -797,7 +795,6 @@ load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
if (format == FORMAT_ASN1) {
pkey = d2i_PUBKEY_bio(key, NULL);
}
-#ifndef OPENSSL_NO_RSA
else if (format == FORMAT_ASN1RSA) {
RSA *rsa;
rsa = d2i_RSAPublicKey_bio(key, NULL);
@@ -819,7 +816,6 @@ load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
} else
pkey = NULL;
}
-#endif
else if (format == FORMAT_PEM) {
pkey = PEM_read_bio_PUBKEY(key, NULL, password_callback, &cb_data);
}
diff --git a/lib/libssl/src/apps/dhparam.c b/lib/libssl/src/apps/dhparam.c
index 935687ffebc..4bd888541bd 100644
--- a/lib/libssl/src/apps/dhparam.c
+++ b/lib/libssl/src/apps/dhparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhparam.c,v 1.30 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: dhparam.c,v 1.31 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -127,9 +127,7 @@
#include <openssl/pem.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
-#endif
#define DEFBITS 512
@@ -153,9 +151,7 @@ dhparam_main(int argc, char **argv)
{
DH *dh = NULL;
int i, badops = 0, text = 0;
-#ifndef OPENSSL_NO_DSA
int dsaparam = 0;
-#endif
BIO *in = NULL, *out = NULL;
int informat, outformat, check = 0, noout = 0, C = 0, ret = 1;
char *infile, *outfile, *prog;
@@ -204,10 +200,8 @@ dhparam_main(int argc, char **argv)
check = 1;
else if (strcmp(*argv, "-text") == 0)
text = 1;
-#ifndef OPENSSL_NO_DSA
else if (strcmp(*argv, "-dsaparam") == 0)
dsaparam = 1;
-#endif
else if (strcmp(*argv, "-C") == 0)
C = 1;
else if (strcmp(*argv, "-noout") == 0)
@@ -230,9 +224,7 @@ bad:
BIO_printf(bio_err, " -outform arg output format - one of DER PEM\n");
BIO_printf(bio_err, " -in arg input file\n");
BIO_printf(bio_err, " -out arg output file\n");
-#ifndef OPENSSL_NO_DSA
BIO_printf(bio_err, " -dsaparam read or generate DSA parameters, convert to DH\n");
-#endif
BIO_printf(bio_err, " -check check the DH parameters\n");
BIO_printf(bio_err, " -text print a text form of the DH parameters\n");
BIO_printf(bio_err, " -C Output C code\n");
@@ -254,14 +246,12 @@ bad:
if (g && !num)
num = DEFBITS;
-#ifndef OPENSSL_NO_DSA
if (dsaparam) {
if (g) {
BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n");
goto end;
}
} else
-#endif
{
/* DH parameters */
if (num && !g)
@@ -272,7 +262,6 @@ bad:
BN_GENCB cb;
BN_GENCB_set(&cb, dh_cb, bio_err);
-#ifndef OPENSSL_NO_DSA
if (dsaparam) {
DSA *dsa = DSA_new();
@@ -291,7 +280,6 @@ bad:
goto end;
}
} else
-#endif
{
dh = DH_new();
BIO_printf(bio_err, "Generating DH parameters, %d bit long safe prime, generator %d\n", num, g);
@@ -321,7 +309,6 @@ bad:
BIO_printf(bio_err, "bad input format specified\n");
goto end;
}
-#ifndef OPENSSL_NO_DSA
if (dsaparam) {
DSA *dsa;
@@ -342,7 +329,6 @@ bad:
goto end;
}
} else
-#endif
{
if (informat == FORMAT_ASN1)
dh = d2i_DHparams_bio(in, NULL);
diff --git a/lib/libssl/src/apps/dsa.c b/lib/libssl/src/apps/dsa.c
index 4a05e2d1743..d667d6efb71 100644
--- a/lib/libssl/src/apps/dsa.c
+++ b/lib/libssl/src/apps/dsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsa.c,v 1.25 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: dsa.c,v 1.26 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -58,7 +58,6 @@
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */
-#ifndef OPENSSL_NO_DSA
#include <stdio.h>
#include <stdlib.h>
@@ -335,4 +334,3 @@ end:
return (ret);
}
-#endif
diff --git a/lib/libssl/src/apps/dsaparam.c b/lib/libssl/src/apps/dsaparam.c
index 18e25d1a219..217679f3660 100644
--- a/lib/libssl/src/apps/dsaparam.c
+++ b/lib/libssl/src/apps/dsaparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsaparam.c,v 1.31 2014/06/29 18:26:26 logan Exp $ */
+/* $OpenBSD: dsaparam.c,v 1.32 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -64,7 +64,6 @@
#undef OPENSSL_NO_DEPRECATED
#endif
-#ifndef OPENSSL_NO_DSA
#include <stdio.h>
#include <stdlib.h>
@@ -417,4 +416,3 @@ dsa_cb(int p, int n, BN_GENCB * cb)
#endif
return 1;
}
-#endif
diff --git a/lib/libssl/src/apps/gendsa.c b/lib/libssl/src/apps/gendsa.c
index 92e58a57923..cb86c4ac3ef 100644
--- a/lib/libssl/src/apps/gendsa.c
+++ b/lib/libssl/src/apps/gendsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gendsa.c,v 1.27 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: gendsa.c,v 1.28 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -58,7 +58,6 @@
#include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */
-#ifndef OPENSSL_NO_DSA
#include <sys/types.h>
#include <sys/stat.h>
@@ -233,4 +232,3 @@ end:
return (ret);
}
-#endif
diff --git a/lib/libssl/src/apps/genrsa.c b/lib/libssl/src/apps/genrsa.c
index 9398120809e..7b670ece6b9 100644
--- a/lib/libssl/src/apps/genrsa.c
+++ b/lib/libssl/src/apps/genrsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: genrsa.c,v 1.34 2014/07/09 09:06:58 bcook Exp $ */
+/* $OpenBSD: genrsa.c,v 1.35 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -64,7 +64,6 @@
#undef OPENSSL_NO_DEPRECATED
#endif
-#ifndef OPENSSL_NO_RSA
#include <sys/types.h>
#include <sys/stat.h>
@@ -288,4 +287,3 @@ genrsa_cb(int p, int n, BN_GENCB * cb)
(void) BIO_flush(cb->arg);
return 1;
}
-#endif
diff --git a/lib/libssl/src/apps/req.c b/lib/libssl/src/apps/req.c
index dcb7ab4a4a9..81a58ca54be 100644
--- a/lib/libssl/src/apps/req.c
+++ b/lib/libssl/src/apps/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.44 2014/06/28 04:39:41 deraadt Exp $ */
+/* $OpenBSD: req.c,v 1.45 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -81,13 +81,9 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
-#endif
#define SECTION "req"
@@ -383,9 +379,7 @@ bad:
BIO_printf(bio_err, " -keyout arg file to send the key to\n");
BIO_printf(bio_err, " -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
BIO_printf(bio_err, " -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
-#ifndef OPENSSL_NO_ECDSA
BIO_printf(bio_err, " -newkey ec:file generate a new EC key, parameters taken from CA in 'file'\n");
-#endif
BIO_printf(bio_err, " -[digest] Digest to sign with (md5, sha1, md2, mdc2, md4)\n");
BIO_printf(bio_err, " -config file request template file.\n");
BIO_printf(bio_err, " -subj arg set or modify request subject\n");
@@ -848,11 +842,9 @@ loop:
goto end;
}
fprintf(stdout, "Modulus=");
-#ifndef OPENSSL_NO_RSA
if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA)
BN_print(out, tpubkey->pkey.rsa->n);
else
-#endif
fprintf(stdout, "Wrong Algorithm type");
EVP_PKEY_free(tpubkey);
fprintf(stdout, "\n");
@@ -1512,7 +1504,6 @@ set_keygen_ctx(BIO * err, const char *gstr, int *pkey_type,
ERR_print_errors(err);
return NULL;
}
-#ifndef OPENSSL_NO_RSA
if ((*pkey_type == EVP_PKEY_RSA) && (keylen != -1)) {
if (EVP_PKEY_CTX_set_rsa_keygen_bits(gctx, keylen) <= 0) {
BIO_puts(err, "Error setting RSA keysize\n");
@@ -1521,7 +1512,6 @@ set_keygen_ctx(BIO * err, const char *gstr, int *pkey_type,
return NULL;
}
}
-#endif
return gctx;
}
diff --git a/lib/libssl/src/apps/rsa.c b/lib/libssl/src/apps/rsa.c
index 1fe7e4bae8e..2a9995ed5ec 100644
--- a/lib/libssl/src/apps/rsa.c
+++ b/lib/libssl/src/apps/rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa.c,v 1.24 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: rsa.c,v 1.25 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -58,7 +58,6 @@
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_RSA
#include <stdio.h>
#include <stdlib.h>
@@ -394,4 +393,3 @@ end:
return (ret);
}
-#endif
diff --git a/lib/libssl/src/apps/rsautl.c b/lib/libssl/src/apps/rsautl.c
index adfae34896f..85003780d08 100644
--- a/lib/libssl/src/apps/rsautl.c
+++ b/lib/libssl/src/apps/rsautl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsautl.c,v 1.21 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: rsautl.c,v 1.22 2014/07/09 21:02:35 tedu Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -58,7 +58,6 @@
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_RSA
#include <string.h>
@@ -343,4 +342,3 @@ usage()
}
-#endif
diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c
index 1f80a8f7d9b..1c13d5517d6 100644
--- a/lib/libssl/src/apps/s_server.c
+++ b/lib/libssl/src/apps/s_server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_server.c,v 1.55 2014/07/09 20:59:41 tedu Exp $ */
+/* $OpenBSD: s_server.c,v 1.56 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -173,16 +173,12 @@
#include <openssl/dh.h>
#endif
-#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
-#endif
#include "s_apps.h"
#include "timeouts.h"
-#ifndef OPENSSL_NO_RSA
static RSA *tmp_rsa_cb(SSL * s, int is_export, int keylength);
-#endif
static int sv_body(char *hostname, int s, unsigned char *context);
static int www_body(char *hostname, int s, unsigned char *context);
static void close_accept_socket(void);
@@ -406,11 +402,9 @@ sv_usage(void)
BIO_printf(bio_err, " -dpass arg - second private key file pass phrase source\n");
BIO_printf(bio_err, " -dhparam arg - DH parameter file to use, in cert file if not specified\n");
BIO_printf(bio_err, " or a default set of parameters is used\n");
-#ifndef OPENSSL_NO_ECDH
BIO_printf(bio_err, " -named_curve arg - Elliptic curve name to use for ephemeral ECDH keys.\n" \
" Use \"openssl ecparam -list_curves\" for all names\n" \
" (default is nistp256).\n");
-#endif
BIO_printf(bio_err, " -nbio - Run with non-blocking IO\n");
BIO_printf(bio_err, " -nbio_test - test with the non-blocking test bio\n");
BIO_printf(bio_err, " -crlf - convert LF from terminal into CRLF\n");
@@ -444,9 +438,7 @@ sv_usage(void)
#ifndef OPENSSL_NO_DH
BIO_printf(bio_err, " -no_dhe - Disable ephemeral DH\n");
#endif
-#ifndef OPENSSL_NO_ECDH
BIO_printf(bio_err, " -no_ecdhe - Disable ephemeral ECDH\n");
-#endif
BIO_printf(bio_err, " -bugs - Turn on SSL bug compatibility\n");
BIO_printf(bio_err, " -www - Respond to a 'GET /' with a status page\n");
BIO_printf(bio_err, " -WWW - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
@@ -681,9 +673,7 @@ s_server_main(int argc, char *argv[])
char *CApath = NULL, *CAfile = NULL;
unsigned char *context = NULL;
char *dhfile = NULL;
-#ifndef OPENSSL_NO_ECDH
char *named_curve = NULL;
-#endif
int badop = 0, bugs = 0;
int ret = 1;
int off = 0;
@@ -783,13 +773,11 @@ s_server_main(int argc, char *argv[])
goto bad;
dhfile = *(++argv);
}
-#ifndef OPENSSL_NO_ECDH
else if (strcmp(*argv, "-named_curve") == 0) {
if (--argc < 1)
goto bad;
named_curve = *(++argv);
}
-#endif
else if (strcmp(*argv, "-dcertform") == 0) {
if (--argc < 1)
goto bad;
@@ -1123,9 +1111,7 @@ bad:
bio_s_out = BIO_new_fp(stdout, BIO_NOCLOSE);
}
}
-#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
if (nocert)
-#endif
{
s_cert_file = NULL;
s_key_file = NULL;
@@ -1286,7 +1272,6 @@ bad:
}
#endif
-#ifndef OPENSSL_NO_ECDH
if (!no_ecdhe) {
EC_KEY *ecdh = NULL;
@@ -1324,7 +1309,6 @@ bad:
#endif
EC_KEY_free(ecdh);
}
-#endif
if (!set_cert_key_stuff(ctx, s_cert, s_key))
goto end;
@@ -1336,7 +1320,6 @@ bad:
if (!set_cert_key_stuff(ctx, s_dcert, s_dkey))
goto end;
}
-#ifndef OPENSSL_NO_RSA
if (!no_tmp_rsa) {
SSL_CTX_set_tmp_rsa_callback(ctx, tmp_rsa_cb);
#ifndef OPENSSL_NO_TLSEXT
@@ -1344,7 +1327,6 @@ bad:
SSL_CTX_set_tmp_rsa_callback(ctx2, tmp_rsa_cb);
#endif
}
-#endif
#ifndef OPENSSL_NO_PSK
if (psk_key != NULL) {
@@ -2213,7 +2195,6 @@ err:
return (ret);
}
-#ifndef OPENSSL_NO_RSA
static RSA *
tmp_rsa_cb(SSL * s, int is_export, int keylength)
{
@@ -2241,7 +2222,6 @@ tmp_rsa_cb(SSL * s, int is_export, int keylength)
}
return (rsa_tmp);
}
-#endif
#define MAX_SESSION_ID_ATTEMPTS 10
static int
diff --git a/lib/libssl/src/apps/speed.c b/lib/libssl/src/apps/speed.c
index 1d320db010f..8ff12b27c3a 100644
--- a/lib/libssl/src/apps/speed.c
+++ b/lib/libssl/src/apps/speed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: speed.c,v 1.49 2014/06/28 04:39:41 deraadt Exp $ */
+/* $OpenBSD: speed.c,v 1.50 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -116,15 +116,9 @@
#ifndef OPENSSL_NO_DES
#include <openssl/des.h>
#endif
-#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_ECDH
#include <openssl/ecdh.h>
-#endif
-#ifndef OPENSSL_NO_ECDSA
#include <openssl/ecdsa.h>
-#endif
#ifndef OPENSSL_NO_HMAC
#include <openssl/hmac.h>
#endif
@@ -149,9 +143,7 @@
#ifndef OPENSSL_NO_RC5
#include <openssl/rc5.h>
#endif
-#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
-#endif
#ifndef OPENSSL_NO_RIPEMD
#include <openssl/ripemd.h>
#endif
@@ -162,12 +154,8 @@
#include <openssl/whrlpool.h>
#endif
-#ifndef OPENSSL_NO_DSA
#include "./testdsa.h"
-#endif
-#ifndef OPENSSL_NO_RSA
#include "./testrsa.h"
-#endif
#define BUFSIZE ((long)1024*8+1)
int run = 0;
@@ -201,18 +189,10 @@ static const char *names[ALGOR_NUM] = {
"aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash"};
static double results[ALGOR_NUM][SIZE_NUM];
static int lengths[SIZE_NUM] = {16, 64, 256, 1024, 8 * 1024};
-#ifndef OPENSSL_NO_RSA
static double rsa_results[RSA_NUM][2];
-#endif
-#ifndef OPENSSL_NO_DSA
static double dsa_results[DSA_NUM][2];
-#endif
-#ifndef OPENSSL_NO_ECDSA
static double ecdsa_results[EC_NUM][2];
-#endif
-#ifndef OPENSSL_NO_ECDH
static double ecdh_results[EC_NUM][1];
-#endif
static void sig_done(int sig);
@@ -234,7 +214,6 @@ Time_F(int s)
}
-#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)
@@ -249,7 +228,6 @@ KDF1_SHA1(const void *in, size_t inlen, void *out, size_t * outlen)
return NULL;
#endif /* OPENSSL_NO_SHA */
}
-#endif /* OPENSSL_NO_ECDH */
int speed_main(int, char **);
@@ -261,12 +239,8 @@ speed_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)
long rsa_count;
-#endif
-#ifndef OPENSSL_NO_RSA
unsigned rsa_num;
-#endif
unsigned char md[EVP_MAX_MD_SIZE];
#ifndef OPENSSL_NO_MDC2
unsigned char mdc2[MDC2_DIGEST_LENGTH];
@@ -414,7 +388,6 @@ speed_main(int argc, char **argv)
#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] = {512, 1024, 2048, 4096};
@@ -423,12 +396,9 @@ speed_main(int argc, char **argv)
static int rsa_data_length[RSA_NUM] = {
sizeof(test512), sizeof(test1024),
sizeof(test2048), sizeof(test4096)};
-#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
/*
* We only test over the following curves as they are representative,
@@ -487,30 +457,22 @@ speed_main(int argc, char **argv)
#endif
-#ifndef OPENSSL_NO_ECDSA
unsigned char ecdsasig[256];
unsigned int ecdsasiglen;
EC_KEY *ecdsa[EC_NUM];
long ecdsa_c[EC_NUM][2];
-#endif
-#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
int rsa_doit[RSA_NUM];
int dsa_doit[DSA_NUM];
-#ifndef OPENSSL_NO_ECDSA
int ecdsa_doit[EC_NUM];
-#endif
-#ifndef OPENSSL_NO_ECDH
int ecdh_doit[EC_NUM];
-#endif
int doit[ALGOR_NUM];
int pr_header = 0;
const EVP_CIPHER *evp_cipher = NULL;
@@ -524,28 +486,20 @@ speed_main(int argc, char **argv)
#endif
memset(results, 0, sizeof(results));
-#ifndef OPENSSL_NO_DSA
memset(dsa_key, 0, sizeof(dsa_key));
-#endif
-#ifndef OPENSSL_NO_ECDSA
for (i = 0; i < EC_NUM; i++)
ecdsa[i] = NULL;
-#endif
-#ifndef OPENSSL_NO_ECDH
for (i = 0; i < EC_NUM; i++) {
ecdh_a[i] = NULL;
ecdh_b[i] = NULL;
}
-#endif
if (!load_config(bio_err, NULL))
goto end;
-#ifndef OPENSSL_NO_RSA
memset(rsa_key, 0, sizeof(rsa_key));
for (i = 0; i < RSA_NUM; i++)
rsa_key[i] = NULL;
-#endif
if ((buf = malloc((int) BUFSIZE)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
@@ -565,14 +519,10 @@ speed_main(int argc, char **argv)
rsa_doit[i] = 0;
for (i = 0; i < DSA_NUM; i++)
dsa_doit[i] = 0;
-#ifndef OPENSSL_NO_ECDSA
for (i = 0; i < EC_NUM; i++)
ecdsa_doit[i] = 0;
-#endif
-#ifndef OPENSSL_NO_ECDH
for (i = 0; i < EC_NUM; i++)
ecdh_doit[i] = 0;
-#endif
j = 0;
@@ -731,7 +681,6 @@ speed_main(int argc, char **argv)
doit[D_CBC_256_CML] = 1;
else
#endif
-#ifndef OPENSSL_NO_RSA
#if 0 /* was: #ifdef RSAref */
if (strcmp(*argv, "rsaref") == 0) {
RSA_set_default_openssl_method(RSA_PKCS1_RSAref());
@@ -744,7 +693,6 @@ speed_main(int argc, char **argv)
j--;
} else
#endif
-#endif /* !OPENSSL_NO_RSA */
if (strcmp(*argv, "dsa512") == 0)
dsa_doit[R_DSA_512] = 2;
else if (strcmp(*argv, "dsa1024") == 0)
@@ -821,22 +769,17 @@ speed_main(int argc, char **argv)
doit[D_CBC_256_CML] = 1;
} else
#endif
-#ifndef OPENSSL_NO_RSA
if (strcmp(*argv, "rsa") == 0) {
rsa_doit[R_RSA_512] = 1;
rsa_doit[R_RSA_1024] = 1;
rsa_doit[R_RSA_2048] = 1;
rsa_doit[R_RSA_4096] = 1;
} else
-#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
if (strcmp(*argv, "ecdsap160") == 0)
ecdsa_doit[R_EC_P160] = 2;
else if (strcmp(*argv, "ecdsap192") == 0)
@@ -873,8 +816,6 @@ speed_main(int argc, char **argv)
for (i = 0; i < EC_NUM; i++)
ecdsa_doit[i] = 1;
} else
-#endif
-#ifndef OPENSSL_NO_ECDH
if (strcmp(*argv, "ecdhp160") == 0)
ecdh_doit[R_EC_P160] = 2;
else if (strcmp(*argv, "ecdhp192") == 0)
@@ -911,7 +852,6 @@ speed_main(int argc, char **argv)
for (i = 0; i < EC_NUM; i++)
ecdh_doit[i] = 1;
} else
-#endif
{
BIO_printf(bio_err, "Error: bad option or value\n");
BIO_printf(bio_err, "\n");
@@ -982,25 +922,17 @@ speed_main(int argc, char **argv)
#endif
BIO_printf(bio_err, "\n");
-#ifndef OPENSSL_NO_RSA
BIO_printf(bio_err, "rsa512 rsa1024 rsa2048 rsa4096\n");
-#endif
-#ifndef OPENSSL_NO_DSA
BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n");
-#endif
-#ifndef OPENSSL_NO_ECDSA
BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 ecdsap256 ecdsap384 ecdsap521\n");
BIO_printf(bio_err, "ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n");
BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n");
BIO_printf(bio_err, "ecdsa\n");
-#endif
-#ifndef OPENSSL_NO_ECDH
BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 ecdhp256 ecdhp384 ecdhp521\n");
BIO_printf(bio_err, "ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n");
BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n");
BIO_printf(bio_err, "ecdh\n");
-#endif
#ifndef OPENSSL_NO_IDEA
BIO_printf(bio_err, "idea ");
@@ -1017,9 +949,7 @@ speed_main(int argc, char **argv)
#ifndef OPENSSL_NO_CAMELLIA
BIO_printf(bio_err, "camellia ");
#endif
-#ifndef OPENSSL_NO_RSA
BIO_printf(bio_err, "rsa ");
-#endif
#ifndef OPENSSL_NO_BF
BIO_printf(bio_err, "blowfish");
#endif
@@ -1061,14 +991,10 @@ speed_main(int argc, char **argv)
rsa_doit[i] = 1;
for (i = 0; i < DSA_NUM; i++)
dsa_doit[i] = 1;
-#ifndef OPENSSL_NO_ECDSA
for (i = 0; i < EC_NUM; i++)
ecdsa_doit[i] = 1;
-#endif
-#ifndef OPENSSL_NO_ECDH
for (i = 0; i < EC_NUM; i++)
ecdh_doit[i] = 1;
-#endif
}
for (i = 0; i < ALGOR_NUM; i++)
if (doit[i])
@@ -1077,7 +1003,6 @@ speed_main(int argc, char **argv)
if (usertime == 0 && !mr)
BIO_printf(bio_err, "You have chosen to measure elapsed time instead of user CPU time.\n");
-#ifndef OPENSSL_NO_RSA
for (i = 0; i < RSA_NUM; i++) {
const unsigned char *p;
@@ -1097,13 +1022,10 @@ speed_main(int argc, char **argv)
}
#endif
}
-#endif
-#ifndef OPENSSL_NO_DSA
dsa_key[0] = get_dsa512();
dsa_key[1] = get_dsa1024();
dsa_key[2] = get_dsa2048();
-#endif
#ifndef OPENSSL_NO_DES
DES_set_key_unchecked(&key, &sch);
@@ -1138,9 +1060,7 @@ speed_main(int argc, char **argv)
#ifndef OPENSSL_NO_CAST
CAST_set_key(&cast_ks, 16, key16);
#endif
-#ifndef OPENSSL_NO_RSA
memset(rsa_c, 0, sizeof(rsa_c));
-#endif
#define COND(c) (run && count<0x7fffffff)
#define COUNT(d) (count)
signal(SIGALRM, sig_done);
@@ -1555,7 +1475,6 @@ speed_main(int argc, char **argv)
}
}
RAND_pseudo_bytes(buf, 36);
-#ifndef OPENSSL_NO_RSA
for (j = 0; j < RSA_NUM; j++) {
int ret;
if (!rsa_doit[j])
@@ -1626,10 +1545,8 @@ speed_main(int argc, char **argv)
rsa_doit[j] = 0;
}
}
-#endif
RAND_pseudo_bytes(buf, 20);
-#ifndef OPENSSL_NO_DSA
for (j = 0; j < DSA_NUM; j++) {
unsigned int kk;
int ret;
@@ -1703,9 +1620,7 @@ speed_main(int argc, char **argv)
dsa_doit[j] = 0;
}
}
-#endif
-#ifndef OPENSSL_NO_ECDSA
for (j = 0; j < EC_NUM; j++) {
int ret;
@@ -1792,9 +1707,7 @@ speed_main(int argc, char **argv)
}
}
}
-#endif
-#ifndef OPENSSL_NO_ECDH
for (j = 0; j < EC_NUM; j++) {
if (!ecdh_doit[j])
continue;
@@ -1877,7 +1790,6 @@ speed_main(int argc, char **argv)
ecdh_doit[j] = 0;
}
}
-#endif
show_res:
if (!mr) {
fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION));
@@ -1927,7 +1839,6 @@ show_res:
}
fprintf(stdout, "\n");
}
-#ifndef OPENSSL_NO_RSA
j = 1;
for (k = 0; k < RSA_NUM; k++) {
if (!rsa_doit[k])
@@ -1945,8 +1856,6 @@ show_res:
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
j = 1;
for (k = 0; k < DSA_NUM; k++) {
if (!dsa_doit[k])
@@ -1963,8 +1872,6 @@ show_res:
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
j = 1;
for (k = 0; k < EC_NUM; k++) {
if (!ecdsa_doit[k])
@@ -1985,10 +1892,8 @@ show_res:
ecdsa_results[k][0], ecdsa_results[k][1],
1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]);
}
-#endif
-#ifndef OPENSSL_NO_ECDH
j = 1;
for (k = 0; k < EC_NUM; k++) {
if (!ecdh_doit[k])
@@ -2008,7 +1913,6 @@ show_res:
test_curves_names[k],
ecdh_results[k][0], 1.0 / ecdh_results[k][0]);
}
-#endif
mret = 0;
@@ -2016,30 +1920,22 @@ end:
ERR_print_errors(bio_err);
free(buf);
free(buf2);
-#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
for (i = 0; i < DSA_NUM; i++)
if (dsa_key[i] != NULL)
DSA_free(dsa_key[i]);
-#endif
-#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
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
return (mret);
@@ -2204,7 +2100,6 @@ do_multi(int multi)
else
rsa_results[k][1] = d;
}
-#ifndef OPENSSL_NO_DSA
else if (!strncmp(buf, "+F3:", 4)) {
int k;
double d;
@@ -2226,8 +2121,6 @@ do_multi(int multi)
else
dsa_results[k][1] = d;
}
-#endif
-#ifndef OPENSSL_NO_ECDSA
else if (!strncmp(buf, "+F4:", 4)) {
int k;
double d;
@@ -2249,9 +2142,7 @@ do_multi(int multi)
else
ecdsa_results[k][1] = d;
}
-#endif
-#ifndef OPENSSL_NO_ECDH
else if (!strncmp(buf, "+F5:", 4)) {
int k;
double d;
@@ -2268,7 +2159,6 @@ do_multi(int multi)
ecdh_results[k][0] = d;
}
-#endif
else if (!strncmp(buf, "+H:", 3)) {
} else
diff --git a/lib/libssl/src/apps/x509.c b/lib/libssl/src/apps/x509.c
index 4f86a1bb53e..e6b33c7a192 100644
--- a/lib/libssl/src/apps/x509.c
+++ b/lib/libssl/src/apps/x509.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.c,v 1.46 2014/06/28 04:39:41 deraadt Exp $ */
+/* $OpenBSD: x509.c,v 1.47 2014/07/09 21:02:35 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -74,13 +74,9 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-#ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h>
-#endif
-#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
-#endif
#define POSTFIX ".srl"
#define DEF_DAYS 30
@@ -713,16 +709,12 @@ bad:
goto end;
}
BIO_printf(STDout, "Modulus=");
-#ifndef OPENSSL_NO_RSA
if (pkey->type == EVP_PKEY_RSA)
BN_print(STDout, pkey->pkey.rsa->n);
else
-#endif
-#ifndef OPENSSL_NO_DSA
if (pkey->type == EVP_PKEY_DSA)
BN_print(STDout, pkey->pkey.dsa->pub_key);
else
-#endif
BIO_printf(STDout, "Wrong Algorithm type");
BIO_printf(STDout, "\n");
EVP_PKEY_free(pkey);