gcc 4.2 fixes to avoid use or function pointer casts in OpenSSL.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 6 Sep 2007 12:43:54 +0000 (12:43 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 6 Sep 2007 12:43:54 +0000 (12:43 +0000)
Fix various "computed value not used" warnings too.

21 files changed:
CHANGES
apps/pkcs12.c
crypto/asn1/asn1.h
crypto/asn1/tasn_dec.c
crypto/asn1/tasn_enc.c
crypto/asn1/x_crl.c
crypto/conf/conf_api.c
crypto/conf/conf_mod.c
crypto/cryptlib.c
crypto/engine/eng_table.c
crypto/ex_data.c
crypto/ocsp/ocsp.h
crypto/pem/pem.h
crypto/x509/x509_vfy.c
crypto/x509/x509_vpm.c
crypto/x509v3/pcy_tree.c
engines/e_ubsec.c
ssl/s2_clnt.c
ssl/s2_srvr.c
ssl/ssl_cert.c
ssl/ssl_ciph.c

diff --git a/CHANGES b/CHANGES
index 0dd61f1cf91d6d5ef70ccedf59a5ccac0e081657..8c26ac0bca40dd08d6b9d317fb101597e7aba2b5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,10 @@
  _______________
 
  Changes between 0.9.8e and 0.9.8f  [xx XXX xxxx]
+
+  *) Changes to avoid need for function casts in OpenSSL: some compilers
+     (gcc 4.2 and later) reject their use.NB: safestack not reimplemented yet.
+     [Kurt Roeckx <kurt@roeckx.be>, Peter Hartley <pdh@utter.chaos.org.uk>]
   
   *) Add RFC4507 support to OpenSSL. This includes the corrections in
      RFC4507bis. The encrypted ticket format is an encrypted encoded
index 762f317efbecfee291705eee27bd586ccf7a1129..7c71b1a88fb29e17783204fb994f4e44f1a742d7 100644 (file)
@@ -477,7 +477,7 @@ int MAIN(int argc, char **argv)
                                        X509_keyid_set1(ucert, NULL, 0);
                                        X509_alias_set1(ucert, NULL, 0);
                                        /* Remove from list */
-                                       sk_X509_delete(certs, i);
+                                       (void)sk_X509_delete(certs, i);
                                        break;
                                        }
                                }
index 30f1eecd5b90bb47ecea31573be97a20bdbe6643..f15131ea3e1c89c13cb226179fd4c702e7260687 100644 (file)
@@ -322,6 +322,17 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 #define I2D_OF(type) int (*)(type *,unsigned char **)
 #define I2D_OF_const(type) int (*)(const type *,unsigned char **)
 
+#define CHECKED_D2I_OF(type, d2i) \
+    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
+#define CHECKED_I2D_OF(type, i2d) \
+    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
+#define CHECKED_NEW_OF(type, xnew) \
+    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
+#define CHECKED_PTR_OF(type, p) \
+    ((void*) (1 ? p : (type*)0))
+#define CHECKED_PPTR_OF(type, p) \
+    ((void**) (1 ? p : (type**)0))
+
 #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
 #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
 #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
@@ -902,23 +913,41 @@ int ASN1_object_size(int constructed, int length, int tag);
 
 /* Used to implement other functions */
 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
+
 #define ASN1_dup_of(type,i2d,d2i,x) \
-       ((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
+    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
+                    CHECKED_D2I_OF(type, d2i), \
+                    CHECKED_PTR_OF(type, x)))
+
 #define ASN1_dup_of_const(type,i2d,d2i,x) \
-       ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
+    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
+                    CHECKED_D2I_OF(type, d2i), \
+                    CHECKED_PTR_OF(const type, x)))
 
 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
 
 #ifndef OPENSSL_NO_FP_API
 void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
+
 #define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
-       ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
+    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
+                       CHECKED_D2I_OF(type, d2i), \
+                       in, \
+                       CHECKED_PPTR_OF(type, x)))
+
 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
 int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
+
 #define ASN1_i2d_fp_of(type,i2d,out,x) \
-       ((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
+    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
+                out, \
+                CHECKED_PTR_OF(type, x)))
+
 #define ASN1_i2d_fp_of_const(type,i2d,out,x) \
-       ((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
+    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
+                out, \
+                CHECKED_PTR_OF(const type, x)))
+
 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 #endif
@@ -927,14 +956,26 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
 
 #ifndef OPENSSL_NO_BIO
 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
+
 #define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
-       ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
+    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
+                         CHECKED_D2I_OF(type, d2i), \
+                         in, \
+                         CHECKED_PPTR_OF(type, x)))
+
 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
 int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
+
 #define ASN1_i2d_bio_of(type,i2d,out,x) \
-       ((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
+    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
+                 out, \
+                 CHECKED_PTR_OF(type, x)))
+
 #define ASN1_i2d_bio_of_const(type,i2d,out,x) \
-       ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
+    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
+                 out, \
+                 CHECKED_PTR_OF(const type, x)))
+
 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
@@ -977,8 +1018,12 @@ void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
                              ASN1_OCTET_STRING **oct);
+
 #define ASN1_pack_string_of(type,obj,i2d,oct) \
-       ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
+    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
+                     CHECKED_I2D_OF(type, i2d), \
+                     oct))
+
 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 
 void ASN1_STRING_set_default_mask(unsigned long mask);
index 66d229b08b39bae6fc34d42eae013a6eb0a8fab4..c4a3abe4f62743b479e3ec2b9813bb47902257b5 100644 (file)
@@ -130,7 +130,7 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
        ASN1_VALUE *ptmpval = NULL;
        if (!pval)
                pval = &ptmpval;
-       asn1_tlc_clear(&c);
+       c.valid = 0;
        if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) 
                return *pval;
        return NULL;
@@ -140,7 +140,7 @@ int ASN1_template_d2i(ASN1_VALUE **pval,
                const unsigned char **in, long len, const ASN1_TEMPLATE *tt)
        {
        ASN1_TLC c;
-       asn1_tlc_clear(&c);
+       c.valid = 0;
        return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
        }
 
index 25c94aa1d95a078c3db63a94ad793cc040d0b128..ed892e2cb2f58e86653b50d6ce9aaa95cc46688b 100644 (file)
@@ -494,7 +494,7 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
                {
                for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk);
                                                        i++, tder++)
-                       sk_ASN1_VALUE_set(sk, i, tder->field);
+                       (void)sk_ASN1_VALUE_set(sk, i, tder->field);
                }
        OPENSSL_free(derlst);
        OPENSSL_free(tmpdat);
index b99f8fc522c1e2a6b25f72a61b3ffb0cf3a67ecb..70d56a67f26a28a116fe912887f7d02ec3512c73 100644 (file)
@@ -84,7 +84,7 @@ static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
                 * would affect the output of X509_CRL_print().
                 */
                case ASN1_OP_D2I_POST:
-               sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
+               (void)sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
                break;
        }
        return 1;
index 0032baa7119b2e250ec08b4bbc0db66a4b2cce8d..909d72b4b89af917f02cf17fa2f438c3adedff4d 100644 (file)
@@ -121,7 +121,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
        v = (CONF_VALUE *)lh_insert(conf->data, value);
        if (v != NULL)
                {
-               sk_CONF_VALUE_delete_ptr(ts,v);
+               (void)sk_CONF_VALUE_delete_ptr(ts,v);
                OPENSSL_free(v->name);
                OPENSSL_free(v->value);
                OPENSSL_free(v);
index 1373d46a4ebd11538b5a0ed2a7eaaaa7668b77ca..628e8333a6d60f4d11eba7ef1d803baa4be80917 100644 (file)
@@ -432,7 +432,7 @@ void CONF_modules_unload(int all)
                if (((md->links > 0) || !md->dso) && !all)
                        continue;
                /* Since we're working in reverse this is OK */
-               sk_CONF_MODULE_delete(supported_modules, i);
+               (void)sk_CONF_MODULE_delete(supported_modules, i);
                module_free(md);
                }
        if (sk_CONF_MODULE_num(supported_modules) == 0)
index 86af760d381384a4dbf17d34a789fdb34438057e..8c686238286c7ecbbe7d5c773240fe932372f3fd 100644 (file)
@@ -277,7 +277,7 @@ int CRYPTO_get_new_dynlockid(void)
        else
                /* If we found a place with a NULL pointer, put our pointer
                   in it.  */
-               sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
+               (void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
        CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
 
        if (i == -1)
@@ -319,7 +319,7 @@ void CRYPTO_destroy_dynlockid(int i)
 #endif
                        if (pointer->references <= 0)
                                {
-                               sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
+                               (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
                                }
                        else
                                pointer = NULL;
index a83c3899ee111f02304a9af6bb0263f2a0a3ba8d..0c1656168d50d60ed45a8bfdd6889eb4e089f6f4 100644 (file)
@@ -147,7 +147,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
                        lh_insert(&(*table)->piles, fnd);
                        }
                /* A registration shouldn't add duplciate entries */
-               sk_ENGINE_delete_ptr(fnd->sk, e);
+               (void)sk_ENGINE_delete_ptr(fnd->sk, e);
                /* if 'setdefault', this ENGINE goes to the head of the list */
                if(!sk_ENGINE_push(fnd->sk, e))
                        goto end;
@@ -178,7 +178,7 @@ static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e)
        /* Iterate the 'c->sk' stack removing any occurance of 'e' */
        while((n = sk_ENGINE_find(pile->sk, e)) >= 0)
                {
-               sk_ENGINE_delete(pile->sk, n);
+               (void)sk_ENGINE_delete(pile->sk, n);
                /* "touch" this ENGINE_CIPHER */
                pile->uptodate = 1;
                }
index 8914218fe8f9c00430d9ab66af4be84e11c376d0..3b11e7a55613ce80be92183f298bb1907fed295e 100644 (file)
@@ -354,7 +354,7 @@ static int def_add_index(EX_CLASS_ITEM *item, long argl, void *argp,
                        }
                }
        toret = item->meth_num++;
-       sk_CRYPTO_EX_DATA_FUNCS_set(item->meth, toret, a);
+       (void)sk_CRYPTO_EX_DATA_FUNCS_set(item->meth, toret, a);
 err:
        CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA);
        return toret;
index 53f3364af0c403e0aebda6697ad8321f74466b24..8163411c9223c230a865104aa78b4aa0ad5ac0f1 100644 (file)
@@ -469,7 +469,7 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
 ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
                                void *data, STACK_OF(ASN1_OBJECT) *sk);
 #define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
-((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk)
+       ASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk)
 
 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
 
index c28706ddc033118872cb1b6344c24333b51c90b1..4e24cc5b5228119cdb95e8df6ce3d01fc1525fa4 100644 (file)
@@ -220,19 +220,28 @@ typedef struct pem_ctx_st
 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
 { \
-return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \
+    return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \
+                               str, fp, \
+                               CHECKED_PPTR_OF(type, x), \
+                               cb, u); \
 } 
 
 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, type *x) \
 { \
-return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
+    return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
+                         str, fp, \
+                         CHECKED_PTR_OF(type, x), \
+                         NULL, NULL, 0, NULL, NULL); \
 }
 
 #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, const type *x) \
 { \
-return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
+    return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
+                         str, fp, \
+                         CHECKED_PTR_OF(const type, x), \
+                         NULL, NULL, 0, NULL, NULL); \
 }
 
 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
@@ -240,7 +249,10 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, \
                  void *u) \
        { \
-       return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
+           return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
+                                 str, fp, \
+                                 CHECKED_PTR_OF(type, x), \
+                                 enc, kstr, klen, cb, u); \
        }
 
 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
@@ -248,7 +260,10 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, \
                  void *u) \
        { \
-       return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
+           return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
+                                 str, fp, \
+                                 CHECKED_PTR_OF(const type, x), \
+                                 enc, kstr, klen, cb, u); \
        }
 
 #endif
@@ -256,33 +271,48 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
 #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
 { \
-return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i_##asn1, str,bp,x,cb,u)); \
+    return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \
+                                   str, bp, \
+                                   CHECKED_PPTR_OF(type, x), \
+                                   cb, u); \
 }
 
 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x) \
 { \
-return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
+    return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
+                             str, bp, \
+                             CHECKED_PTR_OF(type, x), \
+                             NULL, NULL, 0, NULL, NULL); \
 }
 
 #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, const type *x) \
 { \
-return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
+    return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
+                             str, bp, \
+                             CHECKED_PTR_OF(const type, x), \
+                             NULL, NULL, 0, NULL, NULL); \
 }
 
 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
        { \
-       return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
+           return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
+                                     str, bp, \
+                                     CHECKED_PTR_OF(type, x), \
+                                     enc, kstr, klen, cb, u); \
        }
 
 #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
        { \
-       return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
+           return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
+                                     str, bp, \
+                                     CHECKED_PTR_OF(const type, x), \
+                                     enc, kstr, klen, cb, u); \
        }
 
 #define IMPLEMENT_PEM_write(name, type, str, asn1) \
@@ -545,13 +575,22 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char
             pem_password_cb *cb, void *u);
 void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
                          void **x, pem_password_cb *cb, void *u);
+
 #define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
-((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u)
+    ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \
+                             name, bp,                 \
+                             CHECKED_PPTR_OF(type, x), \
+                             cb, u))
+
 int    PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
                           const EVP_CIPHER *enc,unsigned char *kstr,int klen,
                           pem_password_cb *cb, void *u);
+
 #define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
-       ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
+    (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \
+                       name, bp,                  \
+                       CHECKED_PTR_OF(type, x), \
+                       enc, kstr, klen, cb, u))
 
 STACK_OF(X509_INFO) *  PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
 int    PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
index 07df21f6b975a0e921f291dae166d4df7ab347d5..9a62ebcf679e5349532294b8cbbfdc974d2c99c8 100644 (file)
@@ -164,7 +164,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
                                        goto end;
                                        }
                                CRYPTO_add(&xtmp->references,1,CRYPTO_LOCK_X509);
-                               sk_X509_delete_ptr(sktmp,xtmp);
+                               (void)sk_X509_delete_ptr(sktmp,xtmp);
                                ctx->last_untrusted++;
                                x=xtmp;
                                num++;
@@ -214,7 +214,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
                                 */
                                X509_free(x);
                                x = xtmp;
-                               sk_X509_set(ctx->chain, i - 1, x);
+                               (void)sk_X509_set(ctx->chain, i - 1, x);
                                ctx->last_untrusted=0;
                                }
                        }
index 5e69259a7934b40c9656a84f475c3c5118a1abc7..e9db6d62a74984ca0ac241af2b7f13e350d02392 100644 (file)
@@ -385,7 +385,7 @@ int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param)
                        {
                        ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
                        X509_VERIFY_PARAM_free(ptmp);
-                       sk_X509_VERIFY_PARAM_delete(param_table, idx);
+                       (void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
                        }
                }
        if (!sk_X509_VERIFY_PARAM_push(param_table, param))
index 27d29f25a84e7733f94a3b08b01300f6c9943f4d..4fda1d419af6da9488b7a952eedd60920265e8c1 100644 (file)
@@ -345,7 +345,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr)
                        {
                        node->parent->nchild--;
                        OPENSSL_free(node);
-                       sk_X509_POLICY_NODE_delete(curr->nodes, i);
+                       (void)sk_X509_POLICY_NODE_delete(curr->nodes, i);
                        }
                }
 
@@ -358,7 +358,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr)
                                {
                                node->parent->nchild--;
                                OPENSSL_free(node);
-                               sk_X509_POLICY_NODE_delete(curr->nodes, i);
+                               (void)sk_X509_POLICY_NODE_delete(curr->nodes, i);
                                }
                        }
                if (curr->anyPolicy && !curr->anyPolicy->nchild)
index 8b6c98bafa20b47ef09928450ddc2b2d5bc6c451..e8389de6a1f85ed8b5ca1d65a5a75049e3bc0fd1 100644 (file)
@@ -822,11 +822,11 @@ static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len,
        int v_len, d_len;
        int to_return = 0;
        int fd;
-       BIGNUM v;
+       BIGNUM v, *pv = &v;
 
        BN_init(&v);
 
-       if(!bn_wexpand(&v, dsa->p->top)) {
+       if(!bn_wexpand(pv, dsa->p->top)) {
                UBSECerr(UBSEC_F_UBSEC_DSA_VERIFY, UBSEC_R_BN_EXPAND_FAIL);
                goto err;
        }
index ce60de630a7a8425224abbc1094fba0ba304df7b..e2a90a3ca26b923b5045e8844d351c963d12fb28 100644 (file)
@@ -466,11 +466,11 @@ static int get_server_hello(SSL *s)
                        return(-1);
                        }
 
-               sk_SSL_CIPHER_set_cmp_func(sk,ssl_cipher_ptr_id_cmp);
+               (void)sk_SSL_CIPHER_set_cmp_func(sk,ssl_cipher_ptr_id_cmp);
 
                /* get the array of ciphers we will accept */
                cl=SSL_get_ciphers(s);
-               sk_SSL_CIPHER_set_cmp_func(cl,ssl_cipher_ptr_id_cmp);
+               (void)sk_SSL_CIPHER_set_cmp_func(cl,ssl_cipher_ptr_id_cmp);
 
                /*
                 * If server preference flag set, choose the first
index eeedc16a25166ec0f0ba3f1bdc1d1d96ca7f25ad..0daf2b129df3cc36785ad51975cab60a338e08a9 100644 (file)
@@ -657,7 +657,7 @@ static int get_client_hello(SSL *s)
                        {
                        if (sk_SSL_CIPHER_find(allow,sk_SSL_CIPHER_value(prio,z)) < 0)
                                {
-                               sk_SSL_CIPHER_delete(prio,z);
+                               (void)sk_SSL_CIPHER_delete(prio,z);
                                z--;
                                }
                        }
index fb080093e550d1b3444fb1edb61525271e3076d7..a32b2d4446452851f3dca5802688830fd89d65fb 100644 (file)
@@ -762,7 +762,7 @@ err:
        if(x != NULL)
                X509_free(x);
        
-       sk_X509_NAME_set_cmp_func(stack,oldcmp);
+       (void)sk_X509_NAME_set_cmp_func(stack,oldcmp);
 
        return ret;
        }
index 8b69beaa13d77b32355e5218d1518a6ec5d66d63..725f7f3c1ff2f1610308ad5fb4e9cc43985b3332 100644 (file)
@@ -1076,7 +1076,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
        if (*cipher_list_by_id != NULL)
                sk_SSL_CIPHER_free(*cipher_list_by_id);
        *cipher_list_by_id = tmp_cipher_list;
-       sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,ssl_cipher_ptr_id_cmp);
+       (void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,ssl_cipher_ptr_id_cmp);
 
        return(cipherstack);
        }