kill REF_PRINT/REF_CHECK debugging framework noone would use
authorderaadt <deraadt@openbsd.org>
Thu, 17 Apr 2014 21:32:37 +0000 (21:32 +0000)
committerderaadt <deraadt@openbsd.org>
Thu, 17 Apr 2014 21:32:37 +0000 (21:32 +0000)
ok miod

37 files changed:
lib/libcrypto/asn1/tasn_utl.c
lib/libcrypto/asn1/x_info.c
lib/libcrypto/asn1/x_pkey.c
lib/libcrypto/bio/bio_lib.c
lib/libcrypto/cryptlib.c
lib/libcrypto/dh/dh_lib.c
lib/libcrypto/dsa/dsa_lib.c
lib/libcrypto/dso/dso_lib.c
lib/libcrypto/ec/ec_key.c
lib/libcrypto/engine/eng_init.c
lib/libcrypto/engine/eng_lib.c
lib/libcrypto/err/err.c
lib/libcrypto/evp/p_lib.c
lib/libcrypto/rsa/rsa_lib.c
lib/libcrypto/store/str_lib.c
lib/libssl/src/crypto/asn1/tasn_utl.c
lib/libssl/src/crypto/asn1/x_info.c
lib/libssl/src/crypto/asn1/x_pkey.c
lib/libssl/src/crypto/bio/bio_lib.c
lib/libssl/src/crypto/cryptlib.c
lib/libssl/src/crypto/dh/dh_lib.c
lib/libssl/src/crypto/dsa/dsa_lib.c
lib/libssl/src/crypto/dso/dso_lib.c
lib/libssl/src/crypto/ec/ec_key.c
lib/libssl/src/crypto/engine/eng_init.c
lib/libssl/src/crypto/engine/eng_lib.c
lib/libssl/src/crypto/err/err.c
lib/libssl/src/crypto/evp/p_lib.c
lib/libssl/src/crypto/rsa/rsa_lib.c
lib/libssl/src/crypto/store/str_lib.c
lib/libssl/src/e_os.h
lib/libssl/src/ssl/ssl_cert.c
lib/libssl/src/ssl/ssl_lib.c
lib/libssl/src/ssl/ssl_sess.c
lib/libssl/ssl_cert.c
lib/libssl/ssl_lib.c
lib/libssl/ssl_sess.c

index dfa63fb..ab4989b 100644 (file)
@@ -115,13 +115,6 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
                return 1;
                }
        ret = CRYPTO_add(lck, op, aux->ref_lock);
-#ifdef REF_PRINT
-       fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck);
-#endif
-#ifdef REF_CHECK
-       if (ret < 0) 
-               fprintf(stderr, "%s, bad reference count\n", it->sname);
-#endif
        return ret;
        }
 
index c13fad0..cb5b663 100644 (file)
@@ -91,17 +91,7 @@ void X509_INFO_free(X509_INFO *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_INFO);
-#ifdef REF_PRINT
-       REF_PRINT("X509_INFO",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"X509_INFO_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (x->x509 != NULL) X509_free(x->x509);
        if (x->crl != NULL) X509_CRL_free(x->crl);
index 3bf2f5e..c37f207 100644 (file)
@@ -131,17 +131,7 @@ void X509_PKEY_free(X509_PKEY *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("X509_PKEY",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"X509_PKEY_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
        if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
index 4853749..47ab0c8 100644 (file)
@@ -116,17 +116,8 @@ BIO_free(BIO *a)
                return (0);
 
        i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_BIO);
-#ifdef REF_PRINT
-       REF_PRINT("BIO", a);
-#endif
        if (i > 0)
                return (1);
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "BIO_free, bad reference count\n");
-               abort();
-       }
-#endif
        if ((a->callback != NULL) &&
            ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
                return (i);
index ca583d5..1024dec 100644 (file)
@@ -293,12 +293,6 @@ CRYPTO_destroy_dynlockid(int i)
        pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
        if (pointer != NULL) {
                --pointer->references;
-#ifdef REF_CHECK
-               if (pointer->references < 0) {
-                       fprintf(stderr, "CRYPTO_destroy_dynlockid, bad reference count\n");
-                       abort();
-               } else
-#endif
                if (pointer->references <= 0) {
                        (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
                } else
index 4e3d25b..e09c5fd 100644 (file)
@@ -178,17 +178,7 @@ void DH_free(DH *r)
        int i;
        if(r == NULL) return;
        i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH);
-#ifdef REF_PRINT
-       REF_PRINT("DH",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"DH_free, bad reference count\n");
-               abort();
-       }
-#endif
 
        if (r->meth->finish)
                r->meth->finish(r);
@@ -213,16 +203,6 @@ void DH_free(DH *r)
 int DH_up_ref(DH *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH);
-#ifdef REF_PRINT
-       REF_PRINT("DH",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "DH_up, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 27a4c66..7c7cd60 100644 (file)
@@ -188,17 +188,7 @@ void DSA_free(DSA *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_DSA);
-#ifdef REF_PRINT
-       REF_PRINT("DSA",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"DSA_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if(r->meth->finish)
                r->meth->finish(r);
@@ -222,16 +212,6 @@ void DSA_free(DSA *r)
 int DSA_up_ref(DSA *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
-#ifdef REF_PRINT
-       REF_PRINT("DSA",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "DSA_up_ref, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 68f5430..00e6593 100644 (file)
@@ -139,17 +139,7 @@ int DSO_free(DSO *dso)
                }
  
        i=CRYPTO_add(&dso->references,-1,CRYPTO_LOCK_DSO);
-#ifdef REF_PRINT
-       REF_PRINT("DSO",dso);
-#endif
        if(i > 0) return(1);
-#ifdef REF_CHECK
-       if(i < 0)
-               {
-               fprintf(stderr,"DSO_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso))
                {
index 4375514..4f05595 100644 (file)
@@ -109,17 +109,7 @@ void EC_KEY_free(EC_KEY *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_EC);
-#ifdef REF_PRINT
-       REF_PRINT("EC_KEY",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"EC_KEY_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (r->group    != NULL) 
                EC_GROUP_free(r->group);
@@ -218,16 +208,6 @@ EC_KEY *EC_KEY_dup(const EC_KEY *ec_key)
 int EC_KEY_up_ref(EC_KEY *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC);
-#ifdef REF_PRINT
-       REF_PRINT("EC_KEY",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "EC_KEY_up, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 7633cf5..870c456 100644 (file)
@@ -101,13 +101,7 @@ int engine_unlocked_finish(ENGINE *e, int unlock_for_handlers)
                if(!to_return)
                        return 0;
                }
-#ifdef REF_CHECK
-       if(e->funct_ref < 0)
-               {
-               fprintf(stderr,"ENGINE_finish, bad functional reference count\n");
-               abort();
-               }
-#endif
+
        /* Release the structural reference too */
        if(!engine_free_util(e, 0))
                {
index 126bc02..5ced58c 100644 (file)
@@ -118,13 +118,7 @@ int engine_free_util(ENGINE *e, int locked)
                i = --e->struct_ref;
        engine_ref_debug(e, 0, -1)
        if (i > 0) return 1;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"ENGINE_free, bad structural reference count\n");
-               abort();
-               }
-#endif
+
        /* Free up any dynamically allocated public key methods */
        engine_pkey_meths_free(e);
        engine_pkey_asn1_meths_free(e);
index 93ed1da..afc3130 100644 (file)
@@ -467,18 +467,8 @@ static void int_thread_release(LHASH_OF(ERR_STATE) **hash)
                return;
 
        i = CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR);
-
-#ifdef REF_PRINT
-       fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR");
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"int_thread_release, bad reference count\n");
-               abort(); /* ok */
-               }
-#endif
+
        *hash = NULL;
        }
 
index 7a9da34..5f5f5e3 100644 (file)
@@ -391,17 +391,8 @@ void EVP_PKEY_free(EVP_PKEY *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"EVP_PKEY_free, bad reference count\n");
-               abort();
-               }
-#endif
+
        EVP_PKEY_free_it(x);
        if (x->attributes)
                sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
index e99a362..a618d70 100644 (file)
@@ -208,17 +208,7 @@ void RSA_free(RSA *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
-       REF_PRINT("RSA",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"RSA_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (r->meth->finish)
                r->meth->finish(r);
@@ -246,16 +236,6 @@ void RSA_free(RSA *r)
 int RSA_up_ref(RSA *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
-       REF_PRINT("RSA",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "RSA_up_ref, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index a451e9c..197f19e 100644 (file)
@@ -269,9 +269,6 @@ X509 *STORE_get_certificate(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        x = object->data.x509.certificate;
        STORE_OBJECT_free(object);
        return x;
@@ -295,9 +292,6 @@ int STORE_store_certificate(STORE *s, X509 *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        object->data.x509.certificate = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
@@ -399,9 +393,6 @@ X509 *STORE_list_certificate_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        x = object->data.x509.certificate;
        STORE_OBJECT_free(object);
        return x;
@@ -453,9 +444,6 @@ EVP_PKEY *STORE_generate_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -479,9 +467,6 @@ EVP_PKEY *STORE_get_private_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -512,9 +497,6 @@ int STORE_store_private_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        object->data.key = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, object,
@@ -620,9 +602,6 @@ EVP_PKEY *STORE_list_private_key_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -674,9 +653,6 @@ EVP_PKEY *STORE_get_public_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -707,9 +683,6 @@ int STORE_store_public_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        object->data.key = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, object,
@@ -815,9 +788,6 @@ EVP_PKEY *STORE_list_public_key_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -869,9 +839,6 @@ X509_CRL *STORE_generate_crl(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
@@ -895,9 +862,6 @@ X509_CRL *STORE_get_crl(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
@@ -921,9 +885,6 @@ int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        object->data.crl = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CRL, object,
@@ -1009,9 +970,6 @@ X509_CRL *STORE_list_crl_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
index dfa63fb..ab4989b 100644 (file)
@@ -115,13 +115,6 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
                return 1;
                }
        ret = CRYPTO_add(lck, op, aux->ref_lock);
-#ifdef REF_PRINT
-       fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck);
-#endif
-#ifdef REF_CHECK
-       if (ret < 0) 
-               fprintf(stderr, "%s, bad reference count\n", it->sname);
-#endif
        return ret;
        }
 
index c13fad0..cb5b663 100644 (file)
@@ -91,17 +91,7 @@ void X509_INFO_free(X509_INFO *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_INFO);
-#ifdef REF_PRINT
-       REF_PRINT("X509_INFO",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"X509_INFO_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (x->x509 != NULL) X509_free(x->x509);
        if (x->crl != NULL) X509_CRL_free(x->crl);
index 3bf2f5e..c37f207 100644 (file)
@@ -131,17 +131,7 @@ void X509_PKEY_free(X509_PKEY *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("X509_PKEY",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"X509_PKEY_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
        if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
index 4853749..47ab0c8 100644 (file)
@@ -116,17 +116,8 @@ BIO_free(BIO *a)
                return (0);
 
        i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_BIO);
-#ifdef REF_PRINT
-       REF_PRINT("BIO", a);
-#endif
        if (i > 0)
                return (1);
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "BIO_free, bad reference count\n");
-               abort();
-       }
-#endif
        if ((a->callback != NULL) &&
            ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
                return (i);
index ca583d5..1024dec 100644 (file)
@@ -293,12 +293,6 @@ CRYPTO_destroy_dynlockid(int i)
        pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
        if (pointer != NULL) {
                --pointer->references;
-#ifdef REF_CHECK
-               if (pointer->references < 0) {
-                       fprintf(stderr, "CRYPTO_destroy_dynlockid, bad reference count\n");
-                       abort();
-               } else
-#endif
                if (pointer->references <= 0) {
                        (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL);
                } else
index 4e3d25b..e09c5fd 100644 (file)
@@ -178,17 +178,7 @@ void DH_free(DH *r)
        int i;
        if(r == NULL) return;
        i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH);
-#ifdef REF_PRINT
-       REF_PRINT("DH",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"DH_free, bad reference count\n");
-               abort();
-       }
-#endif
 
        if (r->meth->finish)
                r->meth->finish(r);
@@ -213,16 +203,6 @@ void DH_free(DH *r)
 int DH_up_ref(DH *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH);
-#ifdef REF_PRINT
-       REF_PRINT("DH",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "DH_up, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 27a4c66..7c7cd60 100644 (file)
@@ -188,17 +188,7 @@ void DSA_free(DSA *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_DSA);
-#ifdef REF_PRINT
-       REF_PRINT("DSA",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"DSA_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if(r->meth->finish)
                r->meth->finish(r);
@@ -222,16 +212,6 @@ void DSA_free(DSA *r)
 int DSA_up_ref(DSA *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
-#ifdef REF_PRINT
-       REF_PRINT("DSA",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "DSA_up_ref, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 68f5430..00e6593 100644 (file)
@@ -139,17 +139,7 @@ int DSO_free(DSO *dso)
                }
  
        i=CRYPTO_add(&dso->references,-1,CRYPTO_LOCK_DSO);
-#ifdef REF_PRINT
-       REF_PRINT("DSO",dso);
-#endif
        if(i > 0) return(1);
-#ifdef REF_CHECK
-       if(i < 0)
-               {
-               fprintf(stderr,"DSO_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso))
                {
index 4375514..4f05595 100644 (file)
@@ -109,17 +109,7 @@ void EC_KEY_free(EC_KEY *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_EC);
-#ifdef REF_PRINT
-       REF_PRINT("EC_KEY",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"EC_KEY_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (r->group    != NULL) 
                EC_GROUP_free(r->group);
@@ -218,16 +208,6 @@ EC_KEY *EC_KEY_dup(const EC_KEY *ec_key)
 int EC_KEY_up_ref(EC_KEY *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC);
-#ifdef REF_PRINT
-       REF_PRINT("EC_KEY",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "EC_KEY_up, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index 7633cf5..870c456 100644 (file)
@@ -101,13 +101,7 @@ int engine_unlocked_finish(ENGINE *e, int unlock_for_handlers)
                if(!to_return)
                        return 0;
                }
-#ifdef REF_CHECK
-       if(e->funct_ref < 0)
-               {
-               fprintf(stderr,"ENGINE_finish, bad functional reference count\n");
-               abort();
-               }
-#endif
+
        /* Release the structural reference too */
        if(!engine_free_util(e, 0))
                {
index 126bc02..5ced58c 100644 (file)
@@ -118,13 +118,7 @@ int engine_free_util(ENGINE *e, int locked)
                i = --e->struct_ref;
        engine_ref_debug(e, 0, -1)
        if (i > 0) return 1;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"ENGINE_free, bad structural reference count\n");
-               abort();
-               }
-#endif
+
        /* Free up any dynamically allocated public key methods */
        engine_pkey_meths_free(e);
        engine_pkey_asn1_meths_free(e);
index 93ed1da..afc3130 100644 (file)
@@ -467,18 +467,8 @@ static void int_thread_release(LHASH_OF(ERR_STATE) **hash)
                return;
 
        i = CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR);
-
-#ifdef REF_PRINT
-       fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR");
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"int_thread_release, bad reference count\n");
-               abort(); /* ok */
-               }
-#endif
+
        *hash = NULL;
        }
 
index 7a9da34..5f5f5e3 100644 (file)
@@ -391,17 +391,8 @@ void EVP_PKEY_free(EVP_PKEY *x)
        if (x == NULL) return;
 
        i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",x);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"EVP_PKEY_free, bad reference count\n");
-               abort();
-               }
-#endif
+
        EVP_PKEY_free_it(x);
        if (x->attributes)
                sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
index e99a362..a618d70 100644 (file)
@@ -208,17 +208,7 @@ void RSA_free(RSA *r)
        if (r == NULL) return;
 
        i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
-       REF_PRINT("RSA",r);
-#endif
        if (i > 0) return;
-#ifdef REF_CHECK
-       if (i < 0)
-               {
-               fprintf(stderr,"RSA_free, bad reference count\n");
-               abort();
-               }
-#endif
 
        if (r->meth->finish)
                r->meth->finish(r);
@@ -246,16 +236,6 @@ void RSA_free(RSA *r)
 int RSA_up_ref(RSA *r)
        {
        int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
-       REF_PRINT("RSA",r);
-#endif
-#ifdef REF_CHECK
-       if (i < 2)
-               {
-               fprintf(stderr, "RSA_up_ref, bad reference count\n");
-               abort();
-               }
-#endif
        return ((i > 1) ? 1 : 0);
        }
 
index a451e9c..197f19e 100644 (file)
@@ -269,9 +269,6 @@ X509 *STORE_get_certificate(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        x = object->data.x509.certificate;
        STORE_OBJECT_free(object);
        return x;
@@ -295,9 +292,6 @@ int STORE_store_certificate(STORE *s, X509 *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        object->data.x509.certificate = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
@@ -399,9 +393,6 @@ X509 *STORE_list_certificate_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
-#ifdef REF_PRINT
-       REF_PRINT("X509",data);
-#endif
        x = object->data.x509.certificate;
        STORE_OBJECT_free(object);
        return x;
@@ -453,9 +444,6 @@ EVP_PKEY *STORE_generate_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -479,9 +467,6 @@ EVP_PKEY *STORE_get_private_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -512,9 +497,6 @@ int STORE_store_private_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        object->data.key = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, object,
@@ -620,9 +602,6 @@ EVP_PKEY *STORE_list_private_key_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -674,9 +653,6 @@ EVP_PKEY *STORE_get_public_key(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -707,9 +683,6 @@ int STORE_store_public_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        object->data.key = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, object,
@@ -815,9 +788,6 @@ EVP_PKEY *STORE_list_public_key_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
-#ifdef REF_PRINT
-       REF_PRINT("EVP_PKEY",data);
-#endif
        pkey = object->data.key;
        STORE_OBJECT_free(object);
        return pkey;
@@ -869,9 +839,6 @@ X509_CRL *STORE_generate_crl(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
@@ -895,9 +862,6 @@ X509_CRL *STORE_get_crl(STORE *s, OPENSSL_ITEM attributes[],
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
@@ -921,9 +885,6 @@ int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[],
                }
        
        CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        object->data.crl = data;
 
        i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CRL, object,
@@ -1009,9 +970,6 @@ X509_CRL *STORE_list_crl_next(STORE *s, void *handle)
                return 0;
                }
        CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
-#ifdef REF_PRINT
-       REF_PRINT("X509_CRL",data);
-#endif
        crl = object->data.crl;
        STORE_OBJECT_free(object);
        return crl;
index e661792..8efb7f2 100644 (file)
 extern "C" {
 #endif
 
-/* Used to checking reference counts, most while doing perl5 stuff :-) */
-#ifdef REF_PRINT
-#undef REF_PRINT
-#define REF_PRINT(a,b) fprintf(stderr,"%08X:%4d:%s\n",(int)b,b->references,a)
-#endif
-
 #define OPENSSL_CONF   "openssl.cnf"
 #define RFILE          ".rnd"
 
index 87dc80b..cf5cfb9 100644 (file)
@@ -352,17 +352,8 @@ ssl_cert_free(CERT *c)
                return;
 
        i = CRYPTO_add(&c->references, -1, CRYPTO_LOCK_SSL_CERT);
-#ifdef REF_PRINT
-       REF_PRINT("CERT", c);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "ssl_cert_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
 #ifndef OPENSSL_NO_RSA
        if (c->rsa_tmp)
@@ -444,17 +435,8 @@ ssl_sess_cert_free(SESS_CERT *sc)
                return;
 
        i = CRYPTO_add(&sc->references, -1, CRYPTO_LOCK_SSL_SESS_CERT);
-#ifdef REF_PRINT
-       REF_PRINT("SESS_CERT", sc);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "ssl_sess_cert_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        /* i == 0 */
        if (sc->cert_chain != NULL)
index 589bd62..3ab652a 100644 (file)
  * OTHERWISE.
  */
 
-#ifdef REF_CHECK
-#  include <assert.h>
-#endif
 #include <stdio.h>
 #include "ssl_locl.h"
 #include "kssl_lcl.h"
@@ -503,17 +500,8 @@ SSL_free(SSL *s)
                return;
 
        i = CRYPTO_add(&s->references, -1, CRYPTO_LOCK_SSL);
-#ifdef REF_PRINT
-       REF_PRINT("SSL", s);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        if (s->param)
                X509_VERIFY_PARAM_free(s->param);
@@ -1875,17 +1863,8 @@ SSL_CTX_free(SSL_CTX *a)
                return;
 
        i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_SSL_CTX);
-#ifdef REF_PRINT
-       REF_PRINT("SSL_CTX", a);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_CTX_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        if (a->param)
                X509_VERIFY_PARAM_free(a->param);
@@ -2814,9 +2793,6 @@ ssl_free_wbio_buffer(SSL *s)
        if (s->bbio == s->wbio) {
                /* remove buffering */
                s->wbio = BIO_pop(s->wbio);
-#ifdef REF_CHECK /* not the usual REF_CHECK, but this avoids adding one more preprocessor symbol */
-               assert(s->wbio != NULL);
-#endif
        }
        BIO_free(s->bbio);
        s->bbio = NULL;
index f9f6ee5..cbfff0b 100644 (file)
@@ -694,17 +694,8 @@ SSL_SESSION_free(SSL_SESSION *ss)
                return;
 
        i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION);
-#ifdef REF_PRINT
-       REF_PRINT("SSL_SESSION", ss);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_SESSION_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);
 
index 87dc80b..cf5cfb9 100644 (file)
@@ -352,17 +352,8 @@ ssl_cert_free(CERT *c)
                return;
 
        i = CRYPTO_add(&c->references, -1, CRYPTO_LOCK_SSL_CERT);
-#ifdef REF_PRINT
-       REF_PRINT("CERT", c);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "ssl_cert_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
 #ifndef OPENSSL_NO_RSA
        if (c->rsa_tmp)
@@ -444,17 +435,8 @@ ssl_sess_cert_free(SESS_CERT *sc)
                return;
 
        i = CRYPTO_add(&sc->references, -1, CRYPTO_LOCK_SSL_SESS_CERT);
-#ifdef REF_PRINT
-       REF_PRINT("SESS_CERT", sc);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "ssl_sess_cert_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        /* i == 0 */
        if (sc->cert_chain != NULL)
index 589bd62..3ab652a 100644 (file)
  * OTHERWISE.
  */
 
-#ifdef REF_CHECK
-#  include <assert.h>
-#endif
 #include <stdio.h>
 #include "ssl_locl.h"
 #include "kssl_lcl.h"
@@ -503,17 +500,8 @@ SSL_free(SSL *s)
                return;
 
        i = CRYPTO_add(&s->references, -1, CRYPTO_LOCK_SSL);
-#ifdef REF_PRINT
-       REF_PRINT("SSL", s);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        if (s->param)
                X509_VERIFY_PARAM_free(s->param);
@@ -1875,17 +1863,8 @@ SSL_CTX_free(SSL_CTX *a)
                return;
 
        i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_SSL_CTX);
-#ifdef REF_PRINT
-       REF_PRINT("SSL_CTX", a);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_CTX_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        if (a->param)
                X509_VERIFY_PARAM_free(a->param);
@@ -2814,9 +2793,6 @@ ssl_free_wbio_buffer(SSL *s)
        if (s->bbio == s->wbio) {
                /* remove buffering */
                s->wbio = BIO_pop(s->wbio);
-#ifdef REF_CHECK /* not the usual REF_CHECK, but this avoids adding one more preprocessor symbol */
-               assert(s->wbio != NULL);
-#endif
        }
        BIO_free(s->bbio);
        s->bbio = NULL;
index f9f6ee5..cbfff0b 100644 (file)
@@ -694,17 +694,8 @@ SSL_SESSION_free(SSL_SESSION *ss)
                return;
 
        i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION);
-#ifdef REF_PRINT
-       REF_PRINT("SSL_SESSION", ss);
-#endif
        if (i > 0)
                return;
-#ifdef REF_CHECK
-       if (i < 0) {
-               fprintf(stderr, "SSL_SESSION_free, bad reference count\n");
-               abort(); /* ok */
-       }
-#endif
 
        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data);