16# define OPENSSL_CONF_H
19# include <openssl/macros.h>
20# ifndef OPENSSL_NO_DEPRECATED_3_0
24# include <openssl/bio.h>
25# include <openssl/lhash.h>
26# include <openssl/safestack.h>
27# include <openssl/e_os2.h>
28# include <openssl/types.h>
29# include <openssl/conferr.h>
42#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
43#define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx)))
44#define sk_CONF_VALUE_new(cmp) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new(ossl_check_CONF_VALUE_compfunc_type(cmp)))
45#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
46#define sk_CONF_VALUE_new_reserve(cmp, n) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_CONF_VALUE_compfunc_type(cmp), (n)))
47#define sk_CONF_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CONF_VALUE_sk_type(sk), (n))
48#define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk))
49#define sk_CONF_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_CONF_VALUE_sk_type(sk))
50#define sk_CONF_VALUE_delete(sk, i) ((CONF_VALUE *)OPENSSL_sk_delete(ossl_check_CONF_VALUE_sk_type(sk), (i)))
51#define sk_CONF_VALUE_delete_ptr(sk, ptr) ((CONF_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)))
52#define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
53#define sk_CONF_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
54#define sk_CONF_VALUE_pop(sk) ((CONF_VALUE *)OPENSSL_sk_pop(ossl_check_CONF_VALUE_sk_type(sk)))
55#define sk_CONF_VALUE_shift(sk) ((CONF_VALUE *)OPENSSL_sk_shift(ossl_check_CONF_VALUE_sk_type(sk)))
56#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
57#define sk_CONF_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), (idx))
58#define sk_CONF_VALUE_set(sk, idx, ptr) ((CONF_VALUE *)OPENSSL_sk_set(ossl_check_CONF_VALUE_sk_type(sk), (idx), ossl_check_CONF_VALUE_type(ptr)))
59#define sk_CONF_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
60#define sk_CONF_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
61#define sk_CONF_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), pnum)
62#define sk_CONF_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_CONF_VALUE_sk_type(sk))
63#define sk_CONF_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CONF_VALUE_sk_type(sk))
64#define sk_CONF_VALUE_dup(sk) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_dup(ossl_check_const_CONF_VALUE_sk_type(sk)))
65#define sk_CONF_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_copyfunc_type(copyfunc), ossl_check_CONF_VALUE_freefunc_type(freefunc)))
66#define sk_CONF_VALUE_set_cmp_func(sk, cmp) ((sk_CONF_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_compfunc_type(cmp)))
68#define lh_CONF_VALUE_new(hfn, cmp) ((LHASH_OF(CONF_VALUE) *)OPENSSL_LH_new(ossl_check_CONF_VALUE_lh_hashfunc_type(hfn), ossl_check_CONF_VALUE_lh_compfunc_type(cmp)))
69#define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh))
70#define lh_CONF_VALUE_flush(lh) OPENSSL_LH_flush(ossl_check_CONF_VALUE_lh_type(lh))
71#define lh_CONF_VALUE_insert(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_insert(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_plain_type(ptr)))
72#define lh_CONF_VALUE_delete(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_delete(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
73#define lh_CONF_VALUE_retrieve(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_retrieve(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
74#define lh_CONF_VALUE_error(lh) OPENSSL_LH_error(ossl_check_CONF_VALUE_lh_type(lh))
75#define lh_CONF_VALUE_num_items(lh) OPENSSL_LH_num_items(ossl_check_CONF_VALUE_lh_type(lh))
76#define lh_CONF_VALUE_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
77#define lh_CONF_VALUE_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
78#define lh_CONF_VALUE_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
79#define lh_CONF_VALUE_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_CONF_VALUE_lh_type(lh))
80#define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl)
81#define lh_CONF_VALUE_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_doallfunc_type(dfn))
86typedef struct conf_method_st CONF_METHOD;
88# ifndef OPENSSL_NO_DEPRECATED_3_0
89# include <openssl/conftypes.h>
93typedef struct conf_imodule_st CONF_IMODULE;
94typedef struct conf_module_st CONF_MODULE;
97STACK_OF(CONF_IMODULE);
100typedef int conf_init_func (CONF_IMODULE *md,
const CONF *cnf);
101typedef void conf_finish_func (CONF_IMODULE *md);
103# define CONF_MFLAGS_IGNORE_ERRORS 0x1
104# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
105# define CONF_MFLAGS_SILENT 0x4
106# define CONF_MFLAGS_NO_DSO 0x8
107# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
108# define CONF_MFLAGS_DEFAULT_SECTION 0x20
110int CONF_set_default_method(CONF_METHOD *meth);
111void CONF_set_nconf(CONF *conf, LHASH_OF(
CONF_VALUE) *hash);
114# ifndef OPENSSL_NO_STDIO
121 const char *section);
122char *CONF_get_string(LHASH_OF(
CONF_VALUE) *conf,
const char *group,
124long CONF_get_number(LHASH_OF(
CONF_VALUE) *conf,
const char *group,
127#ifndef OPENSSL_NO_STDIO
128int CONF_dump_fp(LHASH_OF(
CONF_VALUE) *conf, FILE *out);
130int CONF_dump_bio(LHASH_OF(
CONF_VALUE) *conf, BIO *out);
131#ifndef OPENSSL_NO_DEPRECATED_1_1_0
132OSSL_DEPRECATEDIN_1_1_0
void OPENSSL_config(
const char *config_name);
135#ifndef OPENSSL_NO_DEPRECATED_1_1_0
136# define OPENSSL_no_config() \
137 OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
145CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
146OSSL_LIB_CTX *NCONF_get0_libctx(
const CONF *conf);
147CONF *NCONF_new(CONF_METHOD *meth);
148CONF_METHOD *NCONF_default(
void);
149#ifndef OPENSSL_NO_DEPRECATED_3_0
150OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(
void);
152void NCONF_free(CONF *conf);
153void NCONF_free_data(CONF *conf);
155int NCONF_load(CONF *conf,
const char *file,
long *eline);
156# ifndef OPENSSL_NO_STDIO
157int NCONF_load_fp(CONF *conf, FILE *fp,
long *eline);
159int NCONF_load_bio(CONF *conf, BIO *bp,
long *eline);
160STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(
const CONF *conf);
161STACK_OF(
CONF_VALUE) *NCONF_get_section(
const CONF *conf,
162 const char *section);
163char *NCONF_get_string(
const CONF *conf,
const char *group,
const char *name);
164int NCONF_get_number_e(
const CONF *conf,
const char *group,
const char *name,
166#ifndef OPENSSL_NO_STDIO
167int NCONF_dump_fp(
const CONF *conf, FILE *out);
169int NCONF_dump_bio(
const CONF *conf, BIO *out);
171#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
175int CONF_modules_load(
const CONF *cnf,
const char *appname,
176 unsigned long flags);
177int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx,
const char *filename,
178 const char *appname,
unsigned long flags);
179int CONF_modules_load_file(
const char *filename,
const char *appname,
180 unsigned long flags);
181void CONF_modules_unload(
int all);
182void CONF_modules_finish(
void);
183#ifndef OPENSSL_NO_DEPRECATED_1_1_0
184# define CONF_modules_free() while(0) continue
186int CONF_module_add(
const char *name, conf_init_func *ifunc,
187 conf_finish_func *ffunc);
189const char *CONF_imodule_get_name(
const CONF_IMODULE *md);
190const char *CONF_imodule_get_value(
const CONF_IMODULE *md);
191void *CONF_imodule_get_usr_data(
const CONF_IMODULE *md);
192void CONF_imodule_set_usr_data(CONF_IMODULE *md,
void *usr_data);
193CONF_MODULE *CONF_imodule_get_module(
const CONF_IMODULE *md);
194unsigned long CONF_imodule_get_flags(
const CONF_IMODULE *md);
195void CONF_imodule_set_flags(CONF_IMODULE *md,
unsigned long flags);
196void *CONF_module_get_usr_data(CONF_MODULE *pmod);
197void CONF_module_set_usr_data(CONF_MODULE *pmod,
void *usr_data);
199char *CONF_get1_default_config_file(
void);
201int CONF_parse_list(
const char *list,
int sep,
int nospc,
202 int (*list_cb) (
const char *elem,
int len,
void *usr),
205void OPENSSL_load_builtin_modules(
void);