NCONF_NEW_EX(3ossl)
π NCONF_NEW_EX (3ossl) β the OpenSSL config-file glow-up
okay bestie, this is the 3ossl manual page for the NCONF_new_ex crew, and it's literally all about loading and parsing configuration files manually β like, you're the one driving, no autopilot. buckle up π
β¨ SYNOPSIS β¨
#include <openssl/conf.h>
typedef struct {
char *section;
char *name;
char *value;
} CONF_VALUE;
CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
CONF *NCONF_new(CONF_METHOD *meth);
void NCONF_free(CONF *conf);
CONF_METHOD *NCONF_default(void);
int NCONF_load(CONF *conf, const char *file, long *eline);
OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);
STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
that CONF_VALUE struct is giving main character energy btw β section, name, value, all three char *, iconic π
πΈ DESCRIPTION πΈ
NCONF_new_ex()β makes a brand-newCONFobject in heap memory π«Ά and assigns to it a contextlibctxthat can be used during loading. if the method tablemethis set toNULL, then the default value ofNCONF_default()is used. no cap.NCONF_new()β basicallyNCONF_new_ex()'s sibling, except it sets thelibctxtoNULL. same vibe, less context πNCONF_free()β frees the data associated withconfand then frees theconfobject itself. and if the argument isNULL? nothing is done. it just... sits there. respectfully πNCONF_load()β parses the file named filename and adds the values found toconf. if an error occurs,fileandelinelist the file and line that the load failed on β but only if they are notNULL. lowkey the most useful debug info ever βNCONF_default()β gets the default method table for processing a configuration file. the blueprint, the moment, the whole thing πNCONF_get0_libctx()β gets the library context associated with theconfparameter. simple. clean. slay.NCONF_get_section_names()β gets the names of the sections associated with theconfasSTACK_OF(OPENSSL_CSTRING)strings. the individual strings are associated with theconfand will be invalid afterconfis freed. the returned stack must be freed withsk_OPENSSL_CSTRING_free(). ok that part is important, don't skip it π«ΆNCONF_get_section()β gets the config values associated with theconffrom the config section name asSTACK_OF(CONF_VALUE)structures. the returned stack is associated with theconfand will be invalid afterconfis freed. it must not be freed by the caller. so like... look, don't touch π
π¨ bestie warning, fr fr: those twogetfunctions hand you stacks that are borrowed, not yours.NCONF_get_section_names()'s stack you free withsk_OPENSSL_CSTRING_free(), butNCONF_get_section()'s stack you do not free. and both go poof the secondconfis freed. remember that and you'll be fine π
π¦ RETURN VALUES π¦
NCONF_load()returns1on success or0on error. that's it. binary. no nuance πNCONF_new_ex()andNCONF_new()return a newly createdCONFobject orNULLif an error occurs. so always vibe check that pointer β¨
π SEE ALSO π
π HISTORY π
NCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were added in OpenSSL 3.0. so if you're on something older... π¬ not me telling you to upgrade, but like, upgrade π§
π COPYRIGHT π
Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page, periodt π this was version 3.5.0, dated 2026-09-25, and it's the NCONF_NEW_EX(3ossl) page β go forth and parse those config files manually, you absolute icon ππ
β¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms