提交 65cbf983 编写于 作者: D Dr. Stephen Henson

Add X509_CRL_up_ref function

Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 a7e974c7
......@@ -517,7 +517,7 @@ int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl)
int r;
r = CMS_add0_crl(cms, crl);
if (r > 0)
CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(crl);
return r;
}
......@@ -570,7 +570,7 @@ STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms)
sk_X509_CRL_pop_free(crls, X509_CRL_free);
return NULL;
}
CRYPTO_add(&rch->d.crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(rch->d.crl);
}
}
return crls;
......
......@@ -341,7 +341,7 @@ int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
return 0;
}
CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(crl);
if (!sk_X509_CRL_push(*sk, crl)) {
X509_CRL_free(crl);
return 0;
......
......@@ -821,7 +821,7 @@ X509_CRL *STORE_generate_crl(STORE *s, OPENSSL_ITEM attributes[],
STOREerr(STORE_F_STORE_GENERATE_CRL, STORE_R_FAILED_GENERATING_CRL);
return 0;
}
CRYPTO_add(&object->data.crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(object->data.crl);
#ifdef REF_PRINT
REF_PRINT("X509_CRL", data);
#endif
......@@ -845,7 +845,7 @@ X509_CRL *STORE_get_crl(STORE *s, OPENSSL_ITEM attributes[],
STOREerr(STORE_F_STORE_GET_CRL, STORE_R_FAILED_GETTING_KEY);
return 0;
}
CRYPTO_add(&object->data.crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(object->data.crl);
#ifdef REF_PRINT
REF_PRINT("X509_CRL", data);
#endif
......@@ -869,7 +869,7 @@ int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[],
return 0;
}
CRYPTO_add(&data->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(data);
#ifdef REF_PRINT
REF_PRINT("X509_CRL", data);
#endif
......@@ -950,7 +950,7 @@ X509_CRL *STORE_list_crl_next(STORE *s, void *handle)
STOREerr(STORE_F_STORE_LIST_CRL_NEXT, STORE_R_FAILED_LISTING_KEYS);
return 0;
}
CRYPTO_add(&object->data.crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(object->data.crl);
#ifdef REF_PRINT
REF_PRINT("X509_CRL", data);
#endif
......
......@@ -409,7 +409,7 @@ void X509_OBJECT_up_ref_count(X509_OBJECT *a)
CRYPTO_add(&a->data.x509->references, 1, CRYPTO_LOCK_X509);
break;
case X509_LU_CRL:
CRYPTO_add(&a->data.crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(a->data.crl);
break;
}
}
......@@ -565,7 +565,7 @@ STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
for (i = 0; i < cnt; i++, idx++) {
obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
x = obj->data.crl;
CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(x);
if (!sk_X509_CRL_push(sk, x)) {
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
X509_CRL_free(x);
......
......@@ -1025,7 +1025,7 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
*pissuer = best_crl_issuer;
*pscore = best_score;
*preasons = best_reasons;
CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(best_crl);
X509_CRL_free(*pdcrl);
*pdcrl = NULL;
get_delta_sk(ctx, pdcrl, pscore, best_crl, crls);
......@@ -1123,7 +1123,7 @@ static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore,
if (check_delta_base(delta, base)) {
if (check_crl_time(ctx, delta, 0))
*pscore |= CRL_SCORE_TIME_DELTA;
CRYPTO_add(&delta->references, 1, CRYPTO_LOCK_X509_CRL);
X509_CRL_up_ref(delta);
*dcrl = delta;
return;
}
......
......@@ -132,6 +132,11 @@ int X509_CRL_sort(X509_CRL *c)
return 1;
}
void X509_CRL_up_ref(X509_CRL *crl)
{
CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
}
int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm)
{
ASN1_TIME *in;
......
......@@ -837,6 +837,7 @@ int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
int X509_CRL_sort(X509_CRL *crl);
void X509_CRL_up_ref(X509_CRL *crl);
int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册