From: tb Date: Sun, 24 Oct 2021 09:27:48 +0000 (+0000) Subject: Prepare to provide X509_OBJECT_{new,free}() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5254ff7771d91250fdccd3c8c75de2e0eb6a8bea;p=openbsd Prepare to provide X509_OBJECT_{new,free}() ok beck inoguchi jsing --- diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index d567dea29b4..cd1c807f504 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.33 2021/10/21 16:55:25 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.34 2021/10/24 09:27:48 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -232,9 +232,27 @@ err: return NULL; } -static void +X509_OBJECT * +X509_OBJECT_new(void) +{ + X509_OBJECT *ret; + + if ((ret = calloc(1, sizeof(*ret))) == NULL) { + X509error(ERR_R_MALLOC_FAILURE); + return NULL; + } + + ret->type = 0; + + return ret; +} + +void X509_OBJECT_free(X509_OBJECT *a) { + if (a == NULL) + return; + X509_OBJECT_free_contents(a); free(a); } diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index ab41426505e..e80e7de45eb 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.34 2021/10/23 16:18:20 tb Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.35 2021/10/24 09:27:48 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -421,6 +421,10 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | X509_V_FLAG_INHIBIT_ANY \ | X509_V_FLAG_INHIBIT_MAP) +#if defined(LIBRESSL_NEW_API) +X509_OBJECT *X509_OBJECT_new(void); +void X509_OBJECT_free(X509_OBJECT *a); +#endif int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name); X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);