diff options
-rw-r--r-- | lib/libcrypto/asn1/tasn_utl.c | 7 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_info.c | 10 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_pkey.c | 10 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio_lib.c | 9 | ||||
-rw-r--r-- | lib/libcrypto/cryptlib.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/dh/dh_lib.c | 20 | ||||
-rw-r--r-- | lib/libcrypto/dsa/dsa_lib.c | 20 | ||||
-rw-r--r-- | lib/libcrypto/dso/dso_lib.c | 10 | ||||
-rw-r--r-- | lib/libcrypto/ec/ec_key.c | 20 | ||||
-rw-r--r-- | lib/libcrypto/engine/eng_init.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/engine/eng_lib.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/err/err.c | 12 | ||||
-rw-r--r-- | lib/libcrypto/evp/p_lib.c | 11 | ||||
-rw-r--r-- | lib/libcrypto/rsa/rsa_lib.c | 20 | ||||
-rw-r--r-- | lib/libcrypto/store/str_lib.c | 42 | ||||
-rw-r--r-- | lib/libssl/ssl_cert.c | 18 | ||||
-rw-r--r-- | lib/libssl/ssl_lib.c | 24 | ||||
-rw-r--r-- | lib/libssl/ssl_sess.c | 9 |
18 files changed, 4 insertions, 260 deletions
diff --git a/lib/libcrypto/asn1/tasn_utl.c b/lib/libcrypto/asn1/tasn_utl.c index dfa63fb2bc4..ab4989b6cea 100644 --- a/lib/libcrypto/asn1/tasn_utl.c +++ b/lib/libcrypto/asn1/tasn_utl.c @@ -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; } diff --git a/lib/libcrypto/asn1/x_info.c b/lib/libcrypto/asn1/x_info.c index c13fad056f2..cb5b6634a18 100644 --- a/lib/libcrypto/asn1/x_info.c +++ b/lib/libcrypto/asn1/x_info.c @@ -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); diff --git a/lib/libcrypto/asn1/x_pkey.c b/lib/libcrypto/asn1/x_pkey.c index 3bf2f5e915b..c37f207e338 100644 --- a/lib/libcrypto/asn1/x_pkey.c +++ b/lib/libcrypto/asn1/x_pkey.c @@ -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); diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index 485374931b0..47ab0c8a455 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -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); diff --git a/lib/libcrypto/cryptlib.c b/lib/libcrypto/cryptlib.c index ca583d59a93..1024dec09e0 100644 --- a/lib/libcrypto/cryptlib.c +++ b/lib/libcrypto/cryptlib.c @@ -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 diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index 4e3d25b7e5e..e09c5fdd21c 100644 --- a/lib/libcrypto/dh/dh_lib.c +++ b/lib/libcrypto/dh/dh_lib.c @@ -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); } diff --git a/lib/libcrypto/dsa/dsa_lib.c b/lib/libcrypto/dsa/dsa_lib.c index 27a4c666183..7c7cd608834 100644 --- a/lib/libcrypto/dsa/dsa_lib.c +++ b/lib/libcrypto/dsa/dsa_lib.c @@ -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); } diff --git a/lib/libcrypto/dso/dso_lib.c b/lib/libcrypto/dso/dso_lib.c index 68f5430ea8e..00e65938b91 100644 --- a/lib/libcrypto/dso/dso_lib.c +++ b/lib/libcrypto/dso/dso_lib.c @@ -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)) { diff --git a/lib/libcrypto/ec/ec_key.c b/lib/libcrypto/ec/ec_key.c index 4375514ef5b..4f0559591ed 100644 --- a/lib/libcrypto/ec/ec_key.c +++ b/lib/libcrypto/ec/ec_key.c @@ -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); } diff --git a/lib/libcrypto/engine/eng_init.c b/lib/libcrypto/engine/eng_init.c index 7633cf5f1d0..870c4566687 100644 --- a/lib/libcrypto/engine/eng_init.c +++ b/lib/libcrypto/engine/eng_init.c @@ -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)) { diff --git a/lib/libcrypto/engine/eng_lib.c b/lib/libcrypto/engine/eng_lib.c index 126bc022966..5ced58c86e0 100644 --- a/lib/libcrypto/engine/eng_lib.c +++ b/lib/libcrypto/engine/eng_lib.c @@ -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); diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 93ed1da943c..afc3130d08a 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -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; } diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c index 7a9da3487a8..5f5f5e328da 100644 --- a/lib/libcrypto/evp/p_lib.c +++ b/lib/libcrypto/evp/p_lib.c @@ -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); diff --git a/lib/libcrypto/rsa/rsa_lib.c b/lib/libcrypto/rsa/rsa_lib.c index e99a3627dc7..a618d70f92c 100644 --- a/lib/libcrypto/rsa/rsa_lib.c +++ b/lib/libcrypto/rsa/rsa_lib.c @@ -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); } diff --git a/lib/libcrypto/store/str_lib.c b/lib/libcrypto/store/str_lib.c index a451e9cb743..197f19e769b 100644 --- a/lib/libcrypto/store/str_lib.c +++ b/lib/libcrypto/store/str_lib.c @@ -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; diff --git a/lib/libssl/ssl_cert.c b/lib/libssl/ssl_cert.c index 87dc80be20f..cf5cfb97f62 100644 --- a/lib/libssl/ssl_cert.c +++ b/lib/libssl/ssl_cert.c @@ -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) diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 589bd625bb4..3ab652a6a49 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -142,9 +142,6 @@ * 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; diff --git a/lib/libssl/ssl_sess.c b/lib/libssl/ssl_sess.c index f9f6ee5ecbf..cbfff0b3982 100644 --- a/lib/libssl/ssl_sess.c +++ b/lib/libssl/ssl_sess.c @@ -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); |