From 690ecff7953193cc8e66b588216805f3014df778 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Thu, 14 Mar 2002 09:52:03 +0000 Subject: [PATCH] Fixes for 'no-hw' combined with 'no-SOME_CIPHER'. Fix dsaparam usage output. Submitted by: Nils Larsch --- apps/apps.c | 8 ++++---- apps/dsaparam.c | 1 + apps/pkcs8.c | 2 +- apps/speed.c | 3 +-- crypto/asn1/x_pubkey.c | 4 +++- crypto/ecdsa/ecdsatest.c | 15 ++++++++------- crypto/engine/engine.h | 2 +- crypto/engine/hw_4758_cca.c | 8 ++++---- crypto/engine/hw_sureware.c | 8 ++++---- crypto/evp/evp_pkey.c | 10 ++++++---- 10 files changed, 33 insertions(+), 28 deletions(-) diff --git a/apps/apps.c b/apps/apps.c index f0c280c38d..e797796e30 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -147,7 +147,7 @@ static UI_METHOD *ui_method = NULL; static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl); static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl); -#ifndef OPENSSL_NO_RC4 +#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) /* Looks like this stuff is worth moving into separate function */ static EVP_PKEY * load_netscape_key(BIO *err, BIO *key, const char *file, @@ -832,7 +832,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, pkey=PEM_read_bio_PrivateKey(key,NULL, (pem_password_cb *)password_callback, &cb_data); } -#ifndef OPENSSL_NO_RC4 +#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif @@ -901,7 +901,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, pkey=PEM_read_bio_PUBKEY(key,NULL, (pem_password_cb *)password_callback, &cb_data); } -#ifndef OPENSSL_NO_RC4 +#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC) pkey = load_netscape_key(err, key, file, key_descrip, format); #endif @@ -917,7 +917,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, return(pkey); } -#ifndef OPENSSL_NO_RC4 +#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA) EVP_PKEY * load_netscape_key(BIO *err, BIO *key, const char *file, const char *key_descrip, int format) diff --git a/apps/dsaparam.c b/apps/dsaparam.c index d54c77d93e..c6ecc48904 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -189,6 +189,7 @@ bad: BIO_printf(bio_err," -text print the key in text\n"); BIO_printf(bio_err," -C Output C code\n"); BIO_printf(bio_err," -noout no output\n"); + BIO_printf(bio_err," -genkey generate a DSA key\n"); BIO_printf(bio_err," -rand files to use for random number input\n"); BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err," number number of bits to use for generating private key\n"); diff --git a/apps/pkcs8.c b/apps/pkcs8.c index ea8c04dffa..ba91caee6b 100644 --- a/apps/pkcs8.c +++ b/apps/pkcs8.c @@ -83,7 +83,7 @@ int MAIN(int argc, char **argv) int nocrypt = 0; X509_SIG *p8; PKCS8_PRIV_KEY_INFO *p8inf; - EVP_PKEY *pkey; + EVP_PKEY *pkey=NULL; char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; char *engine=NULL; diff --git a/apps/speed.c b/apps/speed.c index b451a49af3..e817a0df15 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -372,11 +372,10 @@ int MAIN(int argc, char **argv) ENGINE *e = NULL; unsigned char *buf=NULL,*buf2=NULL; int mret=1; - long count=0,save_count=0; + long count=0,save_count=0, rsa_count; int i,j,k; #ifndef OPENSSL_NO_RSA unsigned rsa_num; - long rsa_count; #endif unsigned char md[EVP_MAX_MD_SIZE]; #ifndef OPENSSL_NO_MD2 diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c index 227b0ce046..f6f2a0daca 100644 --- a/crypto/asn1/x_pubkey.c +++ b/crypto/asn1/x_pubkey.c @@ -212,7 +212,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) long j; int type; unsigned char *p; -#ifndef OPENSSL_NO_DSA +#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) const unsigned char *cp; X509_ALGOR *a; #endif @@ -237,7 +237,9 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) /* the parameters must be extracted before the public key (ECDSA!) */ +#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) a=key->algor; +#endif if (0) ; diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c index 02f9df923f..18b0ce18b3 100644 --- a/crypto/ecdsa/ecdsatest.c +++ b/crypto/ecdsa/ecdsatest.c @@ -56,13 +56,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include #ifdef CLOCKS_PER_SEC /* "To determine the time in seconds, the value returned @@ -81,6 +74,14 @@ int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; } #else +#include +#include +#include +#include +#include +#include +#include + static BIO *bio_err=NULL; static const char rnd_seed[] = "string to make the random number generator think it has entropy"; diff --git a/crypto/engine/engine.h b/crypto/engine/engine.h index 6c8b0437f8..1cd27f8422 100644 --- a/crypto/engine/engine.h +++ b/crypto/engine/engine.h @@ -92,7 +92,7 @@ typedef void DSA_METHOD; #ifdef OPENSSL_NO_DH typedef void DH_METHOD; #endif -#ifdef OPENSS_NO_ECDSA +#ifdef OPENSSL_NO_ECDSA typedef void ECDSA_METHOD; #endif diff --git a/crypto/engine/hw_4758_cca.c b/crypto/engine/hw_4758_cca.c index a42baf0a54..959d8f1a61 100644 --- a/crypto/engine/hw_4758_cca.c +++ b/crypto/engine/hw_4758_cca.c @@ -62,8 +62,8 @@ #include #include -#ifndef NO_HW -#ifndef NO_HW_4758_CCA +#ifndef OPENSSL_NO_HW +#ifndef OPENSSL_NO_HW_4758_CCA #ifdef FLAT_INC #include "hw_4758_cca.h" @@ -946,5 +946,5 @@ IMPLEMENT_DYNAMIC_CHECK_FN() IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) #endif /* ENGINE_DYNAMIC_SUPPORT */ -#endif /* !NO_HW_4758_CCA */ -#endif /* !NO_HW */ +#endif /* !OPENSSL_NO_HW_4758_CCA */ +#endif /* !OPENSSL_NO_HW */ diff --git a/crypto/engine/hw_sureware.c b/crypto/engine/hw_sureware.c index 3d2ff36033..8ef473c8d3 100644 --- a/crypto/engine/hw_sureware.c +++ b/crypto/engine/hw_sureware.c @@ -59,8 +59,8 @@ #include "engine.h" #include -#ifndef NO_HW -#ifndef NO_HW_SUREWARE +#ifndef OPENSSL_NO_HW +#ifndef OPENSSL_NO_HW_SUREWARE #ifdef FLAT_INC #include "sureware.h" @@ -962,5 +962,5 @@ static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, } return ret; } -#endif /* !NO_HW_SureWare */ -#endif /* !NO_HW */ +#endif /* !OPENSSL_NO_HW_SureWare */ +#endif /* !OPENSSL_NO_HW */ diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c index 15d4d66721..3577837fa9 100644 --- a/crypto/evp/evp_pkey.c +++ b/crypto/evp/evp_pkey.c @@ -83,7 +83,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) #ifndef OPENSSL_NO_ECDSA ECDSA *ecdsa = NULL; #endif -#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_ECDSA) +#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) ASN1_INTEGER *privkey; ASN1_TYPE *t1, *t2, *param = NULL; STACK_OF(ASN1_TYPE) *n_stack = NULL; @@ -92,9 +92,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) #endif X509_ALGOR *a; unsigned char *p; -#ifndef OPENSSL_NO_RSA const unsigned char *cp; -#endif int pkeylen; int nid; char obj_tmp[80]; @@ -126,7 +124,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) EVP_PKEY_assign_RSA (pkey, rsa); break; #endif -#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_ECDSA) +#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) case NID_ecdsa_with_SHA1: case NID_dsa: /* PKCS#8 DSA/ECDSA is weird: you just get a private key integer @@ -279,8 +277,12 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) err: if (ctx) BN_CTX_free(ctx); sk_ASN1_TYPE_pop_free(n_stack, ASN1_TYPE_free); +#ifndef OPENSSL_NO_DSA if (dsa) DSA_free(dsa); +#endif +#ifndef OPENSSL_NO_ECDSA if (ecdsa) ECDSA_free(ecdsa); +#endif if (pkey) EVP_PKEY_free(pkey); return NULL; break; -- 2.25.1