From: Geoff Thorpe Date: Sun, 16 Mar 2008 21:05:46 +0000 (+0000) Subject: Fix a variety of warnings generated by some elevated compiler-fascism, X-Git-Tag: OpenSSL_0_9_8k^2~516 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=1e26a8baedbc74036ada80deb16296e7d4eedb18 Fix a variety of warnings generated by some elevated compiler-fascism, OPENSSL_NO_DEPRECATED, etc. Steve, please double-check the CMS stuff... --- diff --git a/apps/ocsp.c b/apps/ocsp.c index c436c8b6f3..eb38e4da6d 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -63,8 +63,11 @@ #include #include "apps.h" /* needs to be included before the openssl headers! */ #include +#include +#include #include #include +#include #if defined(NETWARE_CLIB) # ifdef NETWARE_BSDSOCK diff --git a/apps/s_client.c b/apps/s_client.c index 0c3545a4ca..ad8760cce5 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -162,6 +162,7 @@ typedef unsigned int u_int; #include #include #include +#include #include "s_apps.h" #include "timeouts.h" diff --git a/apps/ts.c b/apps/ts.c index f0923360a7..edeab82318 100644 --- a/apps/ts.c +++ b/apps/ts.c @@ -65,6 +65,7 @@ #include #include #include +#include #undef PROG #define PROG ts_main diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index 6e4ae3b073..f1a5a1e31e 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -62,6 +62,7 @@ #include #include #include +#include int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp) { diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index f7dbdf7bfa..e18f4bc695 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -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; diff --git a/crypto/cms/cms_asn1.c b/crypto/cms/cms_asn1.c index d6363deb37..e5af9a0686 100644 --- a/crypto/cms/cms_asn1.c +++ b/crypto/cms/cms_asn1.c @@ -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 diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c index a927caad8e..e3da7555b7 100644 --- a/crypto/cms/cms_dd.c +++ b/crypto/cms/cms_dd.c @@ -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); diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index f96c46f4e6..fad756e37a 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -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) { diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 39ebe5a0f1..796b0d3756 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -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, diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c index 7b118b8d98..a8cefd06b7 100644 --- a/crypto/cms/cms_lib.c +++ b/crypto/cms/cms_lib.c @@ -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)) { diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index dc8e896e71..4483593f86 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -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); diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index 420cfcda34..b56edda44f 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -60,6 +60,7 @@ #include #include #include +#include #include "asn1_locl.h" static void int_dh_free(EVP_PKEY *pkey) diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 5803b1d711..d4155750fc 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include "evp_locl.h" /* DH pkey context structure */ diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index a39f4ceac8..52290f8d61 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -60,6 +60,7 @@ #include #include #include +#include #ifndef OPENSSL_NO_CMS #include #endif diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c index 73db6d2122..3f7638c803 100644 --- a/crypto/dsa/dsa_pmeth.c +++ b/crypto/dsa/dsa_pmeth.c @@ -60,6 +60,7 @@ #include #include #include +#include #include "evp_locl.h" #include "dsa_locl.h" diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index b10e944d3e..c1deea852e 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -59,6 +59,7 @@ #include "cryptlib.h" #include #include +#include #ifndef OPENSSL_NO_CMS #include #endif diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c index 3a523c0451..7d3e175ae7 100644 --- a/crypto/ec/eck_prn.c +++ b/crypto/ec/eck_prn.c @@ -65,6 +65,7 @@ #include "cryptlib.h" #include #include +#include #ifndef OPENSSL_NO_FP_API int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off) diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index 0972813a02..75090339f7 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -54,6 +54,7 @@ #include "eng_int.h" #include "asn1_locl.h" +#include /* 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 diff --git a/crypto/engine/tb_pkmeth.c b/crypto/engine/tb_pkmeth.c index 999fc0ac41..1cdb967f25 100644 --- a/crypto/engine/tb_pkmeth.c +++ b/crypto/engine/tb_pkmeth.c @@ -53,6 +53,7 @@ */ #include "eng_int.h" +#include /* 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 diff --git a/crypto/evp/e_rc2.c b/crypto/evp/e_rc2.c index 4fd8c41bcc..f78d781129 100644 --- a/crypto/evp/e_rc2.c +++ b/crypto/evp/e_rc2.c @@ -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; diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c index 17e0d5473a..30f8b05953 100644 --- a/crypto/evp/pmeth_gn.c +++ b/crypto/evp/pmeth_gn.c @@ -61,6 +61,7 @@ #include "cryptlib.h" #include #include +#include #include "evp_locl.h" int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx) diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 818eda5dff..fa4496c736 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -63,6 +63,7 @@ #include #include #include +#include /* obj_dat.h is generated from objects.h by obj_dat.pl */ #ifndef OPENSSL_NO_OBJECT diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 58a7f246ef..b6942420d0 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -62,6 +62,9 @@ #include "cryptlib.h" #include #include +#include +#include +#include /* Utility function: read a DWORD (4 byte unsigned integer) in little endian * format diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index e705f16cb9..53e29c65f6 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -61,6 +61,7 @@ #include #include #include +#include #ifndef OPENSSL_NO_CMS #include #endif diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 7d6fef822a..9dd0d4c7c7 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -61,6 +61,7 @@ #include #include #include +#include #include #include "evp_locl.h" #include "rsa_locl.h" diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c index fef8eeef32..fbd294b4ba 100644 --- a/crypto/ts/ts_conf.c +++ b/crypto/ts/ts_conf.c @@ -58,6 +58,8 @@ #include +#include +#include "cryptlib.h" #include #include #include diff --git a/engines/ccgost/gost_ameth.c b/engines/ccgost/gost_ameth.c index 1236d5e763..0a896039df 100644 --- a/engines/ccgost/gost_ameth.c +++ b/engines/ccgost/gost_ameth.c @@ -7,10 +7,12 @@ * for OpenSSL * * Requires OpenSSL 0.9.9 for compilation * **********************************************************************/ +#include +#include +#include #include #include #include -#include #include "gost_params.h" #include "gost_lcl.h" #include "e_gost_err.h" diff --git a/engines/ccgost/gost_ctl.c b/engines/ccgost/gost_ctl.c index 85c2a0f2a4..d3cd171818 100644 --- a/engines/ccgost/gost_ctl.c +++ b/engines/ccgost/gost_ctl.c @@ -8,6 +8,8 @@ **********************************************************************/ #include #include +#include +#include #include #include #include "gost_lcl.h" diff --git a/engines/ccgost/gost_eng.c b/engines/ccgost/gost_eng.c index 6acc508832..d2cbe3b831 100644 --- a/engines/ccgost/gost_eng.c +++ b/engines/ccgost/gost_eng.c @@ -8,6 +8,8 @@ * Requires OpenSSL 0.9.9 for compilation * **********************************************************************/ #include +#include +#include #include #include #include diff --git a/ssl/d1_clnt.c b/ssl/d1_clnt.c index 1623a2abd5..322c017f76 100644 --- a/ssl/d1_clnt.c +++ b/ssl/d1_clnt.c @@ -120,6 +120,7 @@ #include #include #include +#include #ifndef OPENSSL_NO_DH #include #endif diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c index 9401105002..c6f98a832b 100644 --- a/ssl/d1_srvr.c +++ b/ssl/d1_srvr.c @@ -121,6 +121,7 @@ #include #include #include +#include #ifndef OPENSSL_NO_DH #include #endif diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 615a1c4f54..170b45d336 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -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 */ diff --git a/test/igetest.c b/test/igetest.c index 527c6c7f91..1ba900244d 100644 --- a/test/igetest.c +++ b/test/igetest.c @@ -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);