Fix various warnings.
diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h
index ff68bc0..43fa855 100644
--- a/crypto/dsa/dsa.h
+++ b/crypto/dsa/dsa.h
@@ -118,7 +118,7 @@
 	int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
 								BIGNUM **rp);
 	int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
-							DSA_SIG *sig, DSA *dsa);
+			     DSA_SIG *sig, DSA *dsa);
 	int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
 			BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
 			BN_MONT_CTX *in_mont);
diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c
index 2fab8dc..36220a6 100644
--- a/crypto/dsa/dsa_ossl.c
+++ b/crypto/dsa/dsa_ossl.c
@@ -68,7 +68,7 @@
 static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
 static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
 static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
-		  DSA *dsa);
+			 DSA *dsa);
 static int dsa_init(DSA *dsa);
 static int dsa_finish(DSA *dsa);
 
@@ -291,7 +291,7 @@
 	}
 
 static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
-		  DSA *dsa)
+			 DSA *dsa)
 	{
 	BN_CTX *ctx;
 	BIGNUM u1,u2,t1;
diff --git a/crypto/evp/names.c b/crypto/evp/names.c
index 3245f61..feaf80d 100644
--- a/crypto/evp/names.c
+++ b/crypto/evp/names.c
@@ -62,9 +62,6 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 
-extern int obj_cleanup_defer;
-extern void check_defer(int nid);
-
 int EVP_add_cipher(const EVP_CIPHER *c)
 	{
 	int r;
diff --git a/engines/ccgost/gost2001_keyx.c b/engines/ccgost/gost2001_keyx.c
index 7b81c23..1929dbd 100644
--- a/engines/ccgost/gost2001_keyx.c
+++ b/engines/ccgost/gost2001_keyx.c
@@ -16,6 +16,7 @@
 #include "e_gost_err.h"
 #include "gost_keywrap.h"
 #include "gost_lcl.h"
+#include "gost2001_keyx.h"
 
 /* Transform ECDH shared key into little endian as required by Cryptocom
  * key exchange */
diff --git a/engines/ccgost/gost2001_keyx.h b/engines/ccgost/gost2001_keyx.h
new file mode 100644
index 0000000..a014d9c
--- /dev/null
+++ b/engines/ccgost/gost2001_keyx.h
@@ -0,0 +1,10 @@
+GOST_KEY_TRANSPORT *
+make_rfc4490_keytransport_2001(EVP_PKEY *pubk, BIGNUM *eph_key,
+                               const unsigned char *key, size_t keylen,
+                               unsigned char *ukm, size_t ukm_len);
+
+int decrypt_rfc4490_shared_key_2001(EVP_PKEY *priv,
+                                    GOST_KEY_TRANSPORT *gkt,
+                                    unsigned char *key_buf,
+                                    int key_buf_len) ;
+
diff --git a/engines/ccgost/gost89.c b/engines/ccgost/gost89.c
index 7439c3e..c44143d 100644
--- a/engines/ccgost/gost89.c
+++ b/engines/ccgost/gost89.c
@@ -114,7 +114,7 @@
     0xC0, 0x86, 0xDC, 0xC2,   0xEF, 0x4C, 0xA9, 0x2B
 	};	
 /* Initialization of gost_ctx subst blocks*/
-void kboxinit(gost_ctx *c, const gost_subst_block *b)
+static void kboxinit(gost_ctx *c, const gost_subst_block *b)
 	{ 
 	int i; 
 	
diff --git a/engines/ccgost/gost_ameth.c b/engines/ccgost/gost_ameth.c
index 4885ca4..06f8c1e 100644
--- a/engines/ccgost/gost_ameth.c
+++ b/engines/ccgost/gost_ameth.c
@@ -98,11 +98,13 @@
 	ASN1_OBJECT *palg_obj =NULL;
 	int ptype = V_ASN1_UNDEF;
 	int pkey_nid = NID_undef,param_nid = NID_undef;
+        void *_pval;
 	ASN1_STRING *pval = NULL;
 	const unsigned char  *p;
 	GOST_KEY_PARAMS *gkp = NULL;
 
-	X509_ALGOR_get0(&palg_obj, &ptype, (void **) (&pval), palg);
+	X509_ALGOR_get0(&palg_obj, &ptype, &_pval, palg);
+        pval = _pval;
 	if (ptype != V_ASN1_SEQUENCE) 
 		{
 		GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS,
diff --git a/engines/ccgost/gost_crypt.c b/engines/ccgost/gost_crypt.c
index 4d0442e..7a8e8fd 100644
--- a/engines/ccgost/gost_crypt.c
+++ b/engines/ccgost/gost_crypt.c
@@ -197,7 +197,7 @@
 	}
 
 /* Sets cipher param from paramset NID. */
-int gost_cipher_set_param(struct ossl_gost_cipher_ctx *c,int nid)
+static int gost_cipher_set_param(struct ossl_gost_cipher_ctx *c,int nid)
 	{
 	const struct gost_cipher_info *param;
 	param=get_encryption_params((nid==NID_undef?NULL:OBJ_nid2obj(nid)));
@@ -226,8 +226,9 @@
 	return 1;
 	}	
 
+#ifdef USE_SSL
 /* Initializes EVP_CIPHER_CTX with fixed cryptopro A paramset */
-int gost_cipher_init_cpa(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+static int gost_cipher_init_cpa(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 	const unsigned char *iv, int enc)
 	{
 	struct ossl_gost_cipher_ctx *c=ctx->cipher_data;
@@ -241,7 +242,7 @@
 	}
 
 /* Initializes EVP_CIPHER_CTX with fixed vizir paramset */
-int gost_cipher_init_vizir(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+static int gost_cipher_init_vizir(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 	const unsigned char *iv, int enc)
 	{
 	struct ossl_gost_cipher_ctx *c=ctx->cipher_data;
@@ -254,6 +255,7 @@
 	memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
 	return 1;
 	}	
+#endif  /* def USE_SSL */
 
 /* Initializes EVP_CIPHER_CTX with default values */
 int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
@@ -275,6 +277,7 @@
 	c->count+=8;
 	}
 
+#ifdef USE_SSL
 static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *buf)
 	{
 	struct ossl_gost_cipher_ctx *c = ctx;
@@ -305,6 +308,7 @@
 	gostcrypt(&(c->cctx),buf1,buf);
 	c->count +=8;
 	}
+#endif  /* def USE_SSL */
 
 /* GOST encryption in CFB mode */
 int	gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out,
@@ -369,7 +373,8 @@
 	return 1;
 	}
 
-int	gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out,
+#if USE_SSL
+static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out,
 	const unsigned char *in, unsigned int inl)
 	{
 	const unsigned char *in_ptr=in;
@@ -422,6 +427,7 @@
 		}	
 	return 1;
 	}
+#endif  /* def USE_SSL */
 
 /* Cleaning up of EVP_CIPHER_CTX */
 int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx) 
diff --git a/engines/ccgost/gost_eng.c b/engines/ccgost/gost_eng.c
index df5d787..68bf485 100644
--- a/engines/ccgost/gost_eng.c
+++ b/engines/ccgost/gost_eng.c
@@ -141,8 +141,10 @@
 	return ret;
 	}	
 
+#ifdef ENGINE_DYNAMIC_SUPPORT
 IMPLEMENT_DYNAMIC_BIND_FN(bind_gost)
 IMPLEMENT_DYNAMIC_CHECK_FN()
+#endif  /* def ENGINE_DYNAMIC_SUPPORT */
 
 static int gost_digests(ENGINE *e, const EVP_MD **digest,
 	const int **nids, int nid)