From: tb Date: Fri, 14 Jan 2022 07:53:45 +0000 (+0000) Subject: Remove X509_OBJECT_free_contents X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=75395eaa26971a1023af6094b2d97017e866b75d;p=openbsd Remove X509_OBJECT_free_contents Inline X509_OBJECT_free_contents() in X509_OBJECT_free() and remove this dangerous API. It was left over when x509_vfy.h was made opaque. ok inoguchi jsing --- diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index 9400aec320b..90d75497dd5 100644 --- a/lib/libcrypto/x509/x509_lu.c +++ b/lib/libcrypto/x509/x509_lu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lu.c,v 1.54 2022/01/05 20:18:19 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.55 2022/01/14 07:53:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -230,7 +230,15 @@ X509_OBJECT_free(X509_OBJECT *a) if (a == NULL) return; - X509_OBJECT_free_contents(a); + switch (a->type) { + case X509_LU_X509: + X509_free(a->data.x509); + break; + case X509_LU_CRL: + X509_CRL_free(a->data.crl); + break; + } + free(a); } @@ -440,21 +448,6 @@ X509_OBJECT_get_type(const X509_OBJECT *a) return a->type; } -void -X509_OBJECT_free_contents(X509_OBJECT *a) -{ - switch (a->type) { - case X509_LU_X509: - X509_free(a->data.x509); - break; - case X509_LU_CRL: - X509_CRL_free(a->data.crl); - break; - } - memset(a, 0, sizeof(*a)); - a->type = X509_LU_NONE; -} - static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, X509_NAME *name, int *pnmatch) diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index c50624a603d..9a649cbbad2 100644 --- a/lib/libcrypto/x509/x509_vfy.h +++ b/lib/libcrypto/x509/x509_vfy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.h,v 1.49 2022/01/14 07:49:49 tb Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.50 2022/01/14 07:53:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -274,7 +274,6 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); int X509_OBJECT_up_ref_count(X509_OBJECT *a); X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); -void X509_OBJECT_free_contents(X509_OBJECT *a); X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo);