From 338826280562cba94ac633378fc75cc1c3951ae4 Mon Sep 17 00:00:00 2001 From: tb <> Date: Thu, 6 Mar 2025 07:20:01 +0000 Subject: Rename X509V3_get_section() to X509V3_get0_section() This makes it clear for those fluent in OpenSSL API gibberish that nothing needs to be freed here. This is because it returns something hanging off a hash entry owned by cnf. ok jsing --- src/lib/libcrypto/asn1/asn1_gen.c | 4 ++-- src/lib/libcrypto/x509/x509_alt.c | 4 ++-- src/lib/libcrypto/x509/x509_conf.c | 4 ++-- src/lib/libcrypto/x509/x509_cpols.c | 6 +++--- src/lib/libcrypto/x509/x509_crld.c | 8 ++++---- src/lib/libcrypto/x509/x509_local.h | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c index f74cf9ae74..d9da305ef7 100644 --- a/src/lib/libcrypto/asn1/asn1_gen.c +++ b/src/lib/libcrypto/asn1/asn1_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_gen.c,v 1.25 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: asn1_gen.c,v 1.26 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2002. */ @@ -448,7 +448,7 @@ asn1_multi(int utype, const char *section, X509V3_CTX *cnf) if (section) { if (!cnf) goto bad; - sect = X509V3_get_section(cnf, (char *)section); + sect = X509V3_get0_section(cnf, (char *)section); if (!sect) goto bad; for (i = 0; i < sk_CONF_VALUE_num(sect); i++) { diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c index e19a49ca86..34734a55bd 100644 --- a/src/lib/libcrypto/x509/x509_alt.c +++ b/src/lib/libcrypto/x509/x509_alt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_alt.c,v 1.18 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: x509_alt.c,v 1.19 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -782,7 +782,7 @@ do_dirname(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx) if (!(nm = X509_NAME_new())) return 0; - sk = X509V3_get_section(ctx, value); + sk = X509V3_get0_section(ctx, value); if (!sk) { X509V3error(X509V3_R_SECTION_NOT_FOUND); ERR_asprintf_error_data("section=%s", value); diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c index 1047540a88..e5b18c2f77 100644 --- a/src/lib/libcrypto/x509/x509_conf.c +++ b/src/lib/libcrypto/x509/x509_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_conf.c,v 1.28 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: x509_conf.c,v 1.29 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -405,7 +405,7 @@ X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, LCRYPTO_ALIAS(X509V3_EXT_REQ_add_nconf); STACK_OF(CONF_VALUE) * -X509V3_get_section(X509V3_CTX *ctx, const char *section) +X509V3_get0_section(X509V3_CTX *ctx, const char *section) { if (ctx->db == NULL) { X509V3error(X509V3_R_OPERATION_NOT_DEFINED); diff --git a/src/lib/libcrypto/x509/x509_cpols.c b/src/lib/libcrypto/x509/x509_cpols.c index a8aa9a3eb6..6bae2a0482 100644 --- a/src/lib/libcrypto/x509/x509_cpols.c +++ b/src/lib/libcrypto/x509/x509_cpols.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_cpols.c,v 1.14 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: x509_cpols.c,v 1.15 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -461,7 +461,7 @@ r2i_certpol(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *value) continue; } else if (*pstr == '@') { STACK_OF(CONF_VALUE) *polsect; - polsect = X509V3_get_section(ctx, pstr + 1); + polsect = X509V3_get0_section(ctx, pstr + 1); if (!polsect) { X509V3error(X509V3_R_INVALID_SECTION); X509V3_conf_err(cnf); @@ -543,7 +543,7 @@ policy_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *polstrs, int ia5org) X509V3_conf_err(cnf); goto err; } - unot = X509V3_get_section(ctx, cnf->value + 1); + unot = X509V3_get0_section(ctx, cnf->value + 1); if (unot == NULL) { X509V3error(X509V3_R_INVALID_SECTION); X509V3_conf_err(cnf); diff --git a/src/lib/libcrypto/x509/x509_crld.c b/src/lib/libcrypto/x509/x509_crld.c index 1510576e83..81f2010df5 100644 --- a/src/lib/libcrypto/x509/x509_crld.c +++ b/src/lib/libcrypto/x509/x509_crld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_crld.c,v 1.8 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: x509_crld.c,v 1.9 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -125,7 +125,7 @@ gnames_from_sectname(X509V3_CTX *ctx, char *sect) STACK_OF(GENERAL_NAME) *gens; if (*sect == '@') - gnsect = X509V3_get_section(ctx, sect + 1); + gnsect = X509V3_get0_section(ctx, sect + 1); else gnsect = X509V3_parse_list(sect); if (!gnsect) { @@ -155,7 +155,7 @@ set_dist_point_name(DIST_POINT_NAME **pdp, X509V3_CTX *ctx, CONF_VALUE *cnf) nm = X509_NAME_new(); if (!nm) return -1; - dnsect = X509V3_get_section(ctx, cnf->value); + dnsect = X509V3_get0_section(ctx, cnf->value); if (!dnsect) { X509V3error(X509V3_R_SECTION_NOT_FOUND); X509_NAME_free(nm); @@ -330,7 +330,7 @@ v2i_crld(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, cnf = sk_CONF_VALUE_value(nval, i); if (!cnf->value) { STACK_OF(CONF_VALUE) *dpsect; - dpsect = X509V3_get_section(ctx, cnf->name); + dpsect = X509V3_get0_section(ctx, cnf->name); if (!dpsect) goto err; point = crldp_from_section(ctx, dpsect); diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h index f055bb3446..796a2ee718 100644 --- a/src/lib/libcrypto/x509/x509_local.h +++ b/src/lib/libcrypto/x509/x509_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_local.h,v 1.37 2025/03/06 07:17:45 tb Exp $ */ +/* $OpenBSD: x509_local.h,v 1.38 2025/03/06 07:20:01 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2013. */ @@ -453,7 +453,7 @@ int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); -STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); +STACK_OF(CONF_VALUE) *X509V3_get0_section(X509V3_CTX *ctx, const char *section); const X509V3_EXT_METHOD *x509v3_ext_method_authority_key_identifier(void); const X509V3_EXT_METHOD *x509v3_ext_method_basic_constraints(void); -- cgit v1.2.3-55-g6feb