Fix a variety of warnings generated by some elevated compiler-fascism,
authorGeoff Thorpe <geoff@openssl.org>
Sun, 16 Mar 2008 21:05:46 +0000 (21:05 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Sun, 16 Mar 2008 21:05:46 +0000 (21:05 +0000)
OPENSSL_NO_DEPRECATED, etc. Steve, please double-check the CMS stuff...

33 files changed:
apps/ocsp.c
apps/s_client.c
apps/ts.c
crypto/asn1/a_object.c
crypto/bio/bss_mem.c
crypto/cms/cms_asn1.c
crypto/cms/cms_dd.c
crypto/cms/cms_enc.c
crypto/cms/cms_env.c
crypto/cms/cms_lib.c
crypto/cms/cms_sd.c
crypto/dh/dh_ameth.c
crypto/dh/dh_pmeth.c
crypto/dsa/dsa_ameth.c
crypto/dsa/dsa_pmeth.c
crypto/ec/ec_ameth.c
crypto/ec/eck_prn.c
crypto/engine/tb_asnmth.c
crypto/engine/tb_pkmeth.c
crypto/evp/e_rc2.c
crypto/evp/pmeth_gn.c
crypto/objects/obj_dat.c
crypto/pem/pvkfmt.c
crypto/rsa/rsa_ameth.c
crypto/rsa/rsa_pmeth.c
crypto/ts/ts_conf.c
engines/ccgost/gost_ameth.c
engines/ccgost/gost_ctl.c
engines/ccgost/gost_eng.c
ssl/d1_clnt.c
ssl/d1_srvr.c
ssl/t1_lib.c
test/igetest.c

index c436c8b6f390ed174a53e5dd6c5ca6e1e383dfc1..eb38e4da6d2789d56b2e534dd972b879c54ac848 100644 (file)
 #include <time.h>
 #include "apps.h" /* needs to be included before the openssl headers! */
 #include <openssl/e_os2.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
 #include <openssl/ssl.h>
 #include <openssl/evp.h>
+#include <openssl/bn.h>
 
 #if defined(NETWARE_CLIB)
 #  ifdef NETWARE_BSDSOCK
index 0c3545a4ca61a569a66b0aa6e4e2b808974fde45..ad8760cce53ab5e6dd5ad5c07dc346dd15263044 100644 (file)
@@ -162,6 +162,7 @@ typedef unsigned int u_int;
 #include <openssl/pem.h>
 #include <openssl/rand.h>
 #include <openssl/ocsp.h>
+#include <openssl/bn.h>
 #include "s_apps.h"
 #include "timeouts.h"
 
index f0923360a7bfbd7978fd86bd2f795cf6744a2f80..edeab8231801ab2a53ed6a53be0a65ae7bd83edd 100644 (file)
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -65,6 +65,7 @@
 #include <openssl/pem.h>
 #include <openssl/rand.h>
 #include <openssl/ts.h>
+#include <openssl/bn.h>
 
 #undef PROG
 #define PROG   ts_main
index 6e4ae3b0730a89790482ca1744e3f0fcc8102fd1..f1a5a1e31e4a9367c0a657df1b9c782a44f5ed99 100644 (file)
@@ -62,6 +62,7 @@
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
+#include <openssl/bn.h>
 
 int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
        {
index f7dbdf7bfa1174b7af3df43a6b57635aa60d2634..e18f4bc69553cfa3bc0b412dbcd1afaff5ac4039 100644 (file)
@@ -100,7 +100,7 @@ BIO *BIO_new_mem_buf(void *buf, int len)
                BIOerr(BIO_F_BIO_NEW_MEM_BUF,BIO_R_NULL_PARAMETER);
                return NULL;
        }
-       sz = (len<0) ? strlen(buf) : len;
+       sz = (len<0) ? strlen(buf) : (size_t)len;
        if(!(ret = BIO_new(BIO_s_mem())) ) return NULL;
        b = (BUF_MEM *)ret->ptr;
        b->data = buf;
index d6363deb377e55bfeb6ca6335d1dc5f1b85067a1..e5af9a0686d3b3f9d78c72dcf5f181aca1d1952b 100644 (file)
@@ -306,7 +306,7 @@ static int cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                                                        void *exarg)
        {
        ASN1_STREAM_ARG *sarg = exarg;
-       CMS_ContentInfo *cms;
+       CMS_ContentInfo *cms = NULL;
        if (pval)
                cms = (CMS_ContentInfo *)*pval;
        else
index a927caad8e5bfb1cf705151ae7fa097eb5b3dcc4..e3da7555b7e3189fd624e7662ce86919e85cbc43 100644 (file)
@@ -121,7 +121,7 @@ int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
 
        if (verify)
                {
-               if (mdlen != dd->digest->length)
+               if (mdlen != (unsigned int)dd->digest->length)
                        {
                        CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL,
                                CMS_R_MESSAGEDIGEST_WRONG_LENGTH);
index f96c46f4e6cab070d78fabeadd5946242a484dca..fad756e37a55071c8c47d913c68d6312e7540861 100644 (file)
@@ -151,7 +151,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
                        goto err;
                keep_key = 1;
                }
-       else if (ec->keylen != EVP_CIPHER_CTX_key_length(ctx))
+       else if (ec->keylen != (unsigned int)EVP_CIPHER_CTX_key_length(ctx))
                {
                /* If necessary set key length */
                if (EVP_CIPHER_CTX_set_key_length(ctx, ec->keylen) <= 0)
@@ -200,7 +200,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
        return NULL;
        }
 
-int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, 
+static int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, 
                                const EVP_CIPHER *cipher,
                                const unsigned char *key, size_t keylen)
        {
index 39ebe5a0f137b18970859527bf15a1166de482aa..796b0d37563f8dbdd0bb666b65fe9be5c78f33fc 100644 (file)
@@ -118,7 +118,7 @@ int CMS_RecipientInfo_type(CMS_RecipientInfo *ri)
 /* Add a recipient certificate. For now only handle key transport.
  * If we ever handle key agreement will need updating.
  */
-
+#if 0 /* currently unused/undeclared */
 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
                                        X509 *recip, unsigned int flags)
        {
@@ -208,6 +208,7 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
        return NULL;
 
        }
+#endif
 
 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
                                        EVP_PKEY **pk, X509 **recip,
index 7b118b8d989de820c8098df772b5748569a90297..a8cefd06b76d4b1bfa0774cb0f4321c05a3599ff 100644 (file)
@@ -414,7 +414,7 @@ int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
                }
        }
 
-STACK_OF(CMS_CertificateChoices) **cms_get0_certificate_choices(CMS_ContentInfo *cms)
+static STACK_OF(CMS_CertificateChoices) **cms_get0_certificate_choices(CMS_ContentInfo *cms)
        {
        switch (OBJ_obj2nid(cms->contentType))
                {
@@ -492,7 +492,7 @@ int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert)
        return r;
        }
 
-STACK_OF(CMS_RevocationInfoChoice) **cms_get0_revocation_choices(CMS_ContentInfo *cms)
+static STACK_OF(CMS_RevocationInfoChoice) **cms_get0_revocation_choices(CMS_ContentInfo *cms)
        {
        switch (OBJ_obj2nid(cms->contentType))
                {
index dc8e896e7149fda556575fae692e47dd605430bf..4483593f8638eafe6291a2868637a2a3187b6704 100644 (file)
@@ -451,7 +451,7 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
 
        }
 
-int CMS_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t)
+static int cms_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t)
        {
        ASN1_TIME *tt;
        int r = 0;
@@ -608,7 +608,7 @@ void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
                *psig = si->signatureAlgorithm;
        }
 
-int cms_SignerInfo_content_sign(CMS_SignerInfo *si, BIO *chain)
+static int cms_SignerInfo_content_sign(CMS_SignerInfo *si, BIO *chain)
        {
        EVP_MD_CTX mctx;
        int r = 0;
@@ -699,7 +699,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si)
 
        if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0)
                {
-               if (!CMS_add1_signingTime(si, NULL))
+               if (!cms_add1_signingTime(si, NULL))
                        goto err;
                }
 
@@ -856,7 +856,7 @@ int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain)
                                CMS_R_UNABLE_TO_FINALIZE_CONTEXT);
                        goto err;
                        }
-               if (mlen != os->length)
+               if (mlen != (unsigned int)os->length)
                        {
                        CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT,
                                CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH);
index 420cfcda34b83987e5c2d499458d95c4b226422e..b56edda44faa565a1f9ac2753703033fdc25e037 100644 (file)
@@ -60,6 +60,7 @@
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
 #include <openssl/dh.h>
+#include <openssl/bn.h>
 #include "asn1_locl.h"
 
 static void int_dh_free(EVP_PKEY *pkey)
index 5803b1d7114b5e03bf6b0ff59b1117ebf73580d9..d4155750fcd76c07775339b5c83b6d4a86a0b399 100644 (file)
@@ -61,6 +61,8 @@
 #include <openssl/x509.h>
 #include <openssl/rsa.h>
 #include <openssl/evp.h>
+#include <openssl/dh.h>
+#include <openssl/bn.h>
 #include "evp_locl.h"
 
 /* DH pkey context structure */
index a39f4ceac83bd57f365c3c23222c3c68ed6e5b1a..52290f8d619b025c5a27c5679484ed213e36c4df 100644 (file)
@@ -60,6 +60,7 @@
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
 #include <openssl/dsa.h>
+#include <openssl/bn.h>
 #ifndef OPENSSL_NO_CMS
 #include <openssl/cms.h>
 #endif
index 73db6d2122aa615b8923b7b98bbfbde0cbeae477..3f7638c803b7f144b4b9531df43c70a169a7f71b 100644 (file)
@@ -60,6 +60,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/evp.h>
+#include <openssl/bn.h>
 #include "evp_locl.h"
 #include "dsa_locl.h"
 
index b10e944d3ea52795b6176a7a260a1041a0cafa4d..c1deea852e0cb82dd2110920171bcbb1321a055c 100644 (file)
@@ -59,6 +59,7 @@
 #include "cryptlib.h"
 #include <openssl/x509.h>
 #include <openssl/ec.h>
+#include <openssl/bn.h>
 #ifndef OPENSSL_NO_CMS
 #include <openssl/cms.h>
 #endif
index 3a523c0451f28a69988cadf848a285638ac927b7..7d3e175ae756ba183ca9a1021b7c607e6d2981c1 100644 (file)
@@ -65,6 +65,7 @@
 #include "cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/ec.h>
+#include <openssl/bn.h>
 
 #ifndef OPENSSL_NO_FP_API
 int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
index 0972813a0251fa1c4b68bda4745da57aafad9822..75090339f7a2f762887056be58c56d2c9c20657c 100644 (file)
@@ -54,6 +54,7 @@
 
 #include "eng_int.h"
 #include "asn1_locl.h"
+#include <openssl/evp.h>
 
 /* If this symbol is defined then ENGINE_get_pkey_asn1_meth_engine(), the
  * function that is used by EVP to hook in pkey_asn1_meth code and cache
index 999fc0ac41ebc8409bfcf636d9fd5d080183788d..1cdb967f25366300aedd438fee629ef5351aa3ab 100644 (file)
@@ -53,6 +53,7 @@
  */
 
 #include "eng_int.h"
+#include <openssl/evp.h>
 
 /* If this symbol is defined then ENGINE_get_pkey_meth_engine(), the function
  * that is used by EVP to hook in pkey_meth code and cache defaults (etc), will
index 4fd8c41bccf6c2d0c9b33208af0736d384107d59..f78d78112913f3c6a21e19265848af344bc7d56d 100644 (file)
@@ -223,7 +223,7 @@ static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
                        return 1;
                        }
                return 0;
-#if PBE_PRF_TEST
+#ifdef PBE_PRF_TEST
        case EVP_CTRL_PBE_PRF_NID:
                *(int *)ptr = NID_hmacWithMD5;
                return 1;
index 17e0d5473a561545e8bdf493b35a3f713eac725e..30f8b059530dddcb4cae1f9225a7e99c4cb0b399 100644 (file)
@@ -61,6 +61,7 @@
 #include "cryptlib.h"
 #include <openssl/objects.h>
 #include <openssl/evp.h>
+#include <openssl/bn.h>
 #include "evp_locl.h"
 
 int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx)
index 818eda5dff100fed8dbdcc166967e317473f7cce..fa4496c736507415c4fc4cf90b5058172257d79a 100644 (file)
@@ -63,6 +63,7 @@
 #include <openssl/lhash.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
+#include <openssl/bn.h>
 
 /* obj_dat.h is generated from objects.h by obj_dat.pl */
 #ifndef OPENSSL_NO_OBJECT
index 58a7f246ef97391bcc6741e122fd62605cdff21c..b6942420d0675ad2e66988dc9d44176a774fd09a 100644 (file)
@@ -62,6 +62,9 @@
 #include "cryptlib.h"
 #include <openssl/pem.h>
 #include <openssl/rand.h>
+#include <openssl/bn.h>
+#include <openssl/dsa.h>
+#include <openssl/rsa.h>
 
 /* Utility function: read a DWORD (4 byte unsigned integer) in little endian
  * format
index e705f16cb97dc548f3e890aec8c433c0211e7bbe..53e29c65f6d58ae8c9b0148bcd3702d9196837cd 100644 (file)
@@ -61,6 +61,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/rsa.h>
+#include <openssl/bn.h>
 #ifndef OPENSSL_NO_CMS
 #include <openssl/cms.h>
 #endif
index 7d6fef822ad0bcf9f11a0ce52265e5e57b6895c4..9dd0d4c7c708faac0527cf170b2d81a0626a860d 100644 (file)
@@ -61,6 +61,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/rsa.h>
+#include <openssl/bn.h>
 #include <openssl/evp.h>
 #include "evp_locl.h"
 #include "rsa_locl.h"
index fef8eeef324a50d3c0d3cbc58f0551bceed19816..fbd294b4ba5cf320ff9fc032341c66147621ce6e 100644 (file)
@@ -58,6 +58,8 @@
 
 #include <string.h>
 
+#include <openssl/crypto.h>
+#include "cryptlib.h"
 #include <openssl/pem.h>
 #include <openssl/engine.h>
 #include <openssl/ts.h>
index 1236d5e7637416acf4cc6d54ebb26eac38054861..0a896039df831468de0bc7fc0e3102428cdc5454 100644 (file)
@@ -7,10 +7,12 @@
  *       for OpenSSL                                                  *
  *          Requires OpenSSL 0.9.9 for compilation                    *
  **********************************************************************/
+#include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
 #include <openssl/engine.h>
 #include <openssl/evp.h>
 #include <openssl/asn1.h>
-#include <string.h>
 #include "gost_params.h"
 #include "gost_lcl.h"
 #include "e_gost_err.h"
index 85c2a0f2a4409490a1f58862376cc3b91713caeb..d3cd171818a89d27066936ce86cf39bd4935225c 100644 (file)
@@ -8,6 +8,8 @@
  **********************************************************************/            
 #include <stdlib.h>
 #include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
 #include <openssl/engine.h>
 #include <openssl/buffer.h>
 #include "gost_lcl.h"
index 6acc5088327f5f607d1d92017bdccadd86c7aa92..d2cbe3b83140c496f1bef7baab8d31cc855df4c4 100644 (file)
@@ -8,6 +8,8 @@
  *          Requires OpenSSL 0.9.9 for compilation                    *
  **********************************************************************/
 #include <string.h>
+#include <openssl/crypto.h>
+#include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/engine.h>
 #include <openssl/obj_mac.h>
index 1623a2abd5fa0df7c3913b9741e10a9465de54cf..322c017f76371879a1d5149097256f8dfaa3054a 100644 (file)
 #include <openssl/objects.h>
 #include <openssl/evp.h>
 #include <openssl/md5.h>
+#include <openssl/bn.h>
 #ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
 #endif
index 940110500298962f8312244c18d0bef855aa9cd4..c6f98a832be4252321e55594aa2e07a3201fee15 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/md5.h>
+#include <openssl/bn.h>
 #ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
 #endif
index 615a1c4f54d244da6efc92bd07d78b89d59cbb22..170b45d3366884e4b90398407f1bf00581d5a023 100644 (file)
@@ -196,7 +196,9 @@ static int nid_list[] =
 int tls1_ec_curve_id2nid(int curve_id)
        {
        /* ECC curves from draft-ietf-tls-ecc-12.txt (Oct. 17, 2005) */
-       if ((curve_id < 1) || (curve_id > sizeof(nid_list)/sizeof(nid_list[0]))) return 0;
+       if ((curve_id < 1) || ((unsigned int)curve_id >
+                               sizeof(nid_list)/sizeof(nid_list[0])))
+               return 0;
        return nid_list[curve_id-1];
        }
 
@@ -1058,7 +1060,8 @@ int ssl_prepare_clienthello_tlsext(SSL *s)
                        SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT,ERR_R_MALLOC_FAILURE);
                        return -1;
                        }
-               for (i = 1, j = s->tlsext_ellipticcurvelist; i <= sizeof(nid_list)/sizeof(nid_list[0]); i++)
+               for (i = 1, j = s->tlsext_ellipticcurvelist; (unsigned int)i <=
+                               sizeof(nid_list)/sizeof(nid_list[0]); i++)
                        s2n(i,j);
                }
 #endif /* OPENSSL_NO_EC */
index 527c6c7f917eb9fa26e236d67cc9a3f9adfcf154..1ba900244ded184f5b6ae371462f0d89e63f433a 100644 (file)
@@ -190,7 +190,7 @@ static struct bi_ige_test const bi_ige_test_vectors[] = {
 
 static int run_test_vectors(void)
        {
-       int n;
+       unsigned int n;
        int errs = 0;
 
        for(n=0 ; n < sizeof(ige_test_vectors)/sizeof(ige_test_vectors[0]) ; ++n)
@@ -292,7 +292,7 @@ int main(int argc, char **argv)
        unsigned char iv[AES_BLOCK_SIZE*4];
        unsigned char saved_iv[AES_BLOCK_SIZE*4];
        int err = 0;
-       int n;
+       unsigned int n;
        unsigned matches;
 
        assert(BIG_TEST_SIZE >= TEST_SIZE);