From: tb Date: Sun, 16 Apr 2023 12:08:03 +0000 (+0000) Subject: Shuffle ext_cmp() and ext_list_free() up a bit X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6183e74083956135c6c7260937dcde476ba2a29c;p=openbsd Shuffle ext_cmp() and ext_list_free() up a bit --- diff --git a/lib/libcrypto/x509/x509_lib.c b/lib/libcrypto/x509/x509_lib.c index 57b2b2cb420..cd97b33207c 100644 --- a/lib/libcrypto/x509/x509_lib.c +++ b/lib/libcrypto/x509/x509_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lib.c,v 1.11 2023/04/16 12:05:31 tb Exp $ */ +/* $OpenBSD: x509_lib.c,v 1.12 2023/04/16 12:08:03 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -67,10 +67,6 @@ static STACK_OF(X509V3_EXT_METHOD) *ext_list = NULL; -static int ext_cmp(const X509V3_EXT_METHOD * const *a, - const X509V3_EXT_METHOD * const *b); -static void ext_list_free(X509V3_EXT_METHOD *ext); - extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; @@ -147,6 +143,12 @@ static const X509V3_EXT_METHOD *standard_exts[] = { #define STANDARD_EXTENSION_COUNT (sizeof(standard_exts) / sizeof(standard_exts[0])) +static int +ext_cmp(const X509V3_EXT_METHOD * const *a, const X509V3_EXT_METHOD * const *b) +{ + return ((*a)->ext_nid - (*b)->ext_nid); +} + int X509V3_EXT_add(X509V3_EXT_METHOD *ext) { @@ -162,12 +164,6 @@ X509V3_EXT_add(X509V3_EXT_METHOD *ext) } LCRYPTO_ALIAS(X509V3_EXT_add); -static int -ext_cmp(const X509V3_EXT_METHOD * const *a, const X509V3_EXT_METHOD * const *b) -{ - return ((*a)->ext_nid - (*b)->ext_nid); -} - static int ext_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { @@ -252,6 +248,13 @@ X509V3_EXT_add_alias(int nid_to, int nid_from) } LCRYPTO_ALIAS(X509V3_EXT_add_alias); +static void +ext_list_free(X509V3_EXT_METHOD *ext) +{ + if (ext->ext_flags & X509V3_EXT_DYNAMIC) + free(ext); +} + void X509V3_EXT_cleanup(void) { @@ -260,13 +263,6 @@ X509V3_EXT_cleanup(void) } LCRYPTO_ALIAS(X509V3_EXT_cleanup); -static void -ext_list_free(X509V3_EXT_METHOD *ext) -{ - if (ext->ext_flags & X509V3_EXT_DYNAMIC) - free(ext); -} - int X509V3_add_standard_extensions(void) {