File indexing completed on 2025-01-18 10:05:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef OPENSSL_CONF_H
0016 # define OPENSSL_CONF_H
0017 # pragma once
0018
0019 # include <openssl/macros.h>
0020 # ifndef OPENSSL_NO_DEPRECATED_3_0
0021 # define HEADER_CONF_H
0022 # endif
0023
0024 # include <openssl/bio.h>
0025 # include <openssl/lhash.h>
0026 # include <openssl/safestack.h>
0027 # include <openssl/e_os2.h>
0028 # include <openssl/types.h>
0029 # include <openssl/conferr.h>
0030 # ifndef OPENSSL_NO_STDIO
0031 # include <stdio.h>
0032 # endif
0033
0034 #ifdef __cplusplus
0035 extern "C" {
0036 #endif
0037
0038 typedef struct {
0039 char *section;
0040 char *name;
0041 char *value;
0042 } CONF_VALUE;
0043
0044 SKM_DEFINE_STACK_OF_INTERNAL(CONF_VALUE, CONF_VALUE, CONF_VALUE)
0045 #define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
0046 #define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx)))
0047 #define sk_CONF_VALUE_new(cmp) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new(ossl_check_CONF_VALUE_compfunc_type(cmp)))
0048 #define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
0049 #define sk_CONF_VALUE_new_reserve(cmp, n) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_CONF_VALUE_compfunc_type(cmp), (n)))
0050 #define sk_CONF_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CONF_VALUE_sk_type(sk), (n))
0051 #define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk))
0052 #define sk_CONF_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_CONF_VALUE_sk_type(sk))
0053 #define sk_CONF_VALUE_delete(sk, i) ((CONF_VALUE *)OPENSSL_sk_delete(ossl_check_CONF_VALUE_sk_type(sk), (i)))
0054 #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)))
0055 #define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
0056 #define sk_CONF_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
0057 #define sk_CONF_VALUE_pop(sk) ((CONF_VALUE *)OPENSSL_sk_pop(ossl_check_CONF_VALUE_sk_type(sk)))
0058 #define sk_CONF_VALUE_shift(sk) ((CONF_VALUE *)OPENSSL_sk_shift(ossl_check_CONF_VALUE_sk_type(sk)))
0059 #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))
0060 #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))
0061 #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)))
0062 #define sk_CONF_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
0063 #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))
0064 #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)
0065 #define sk_CONF_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_CONF_VALUE_sk_type(sk))
0066 #define sk_CONF_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CONF_VALUE_sk_type(sk))
0067 #define sk_CONF_VALUE_dup(sk) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_dup(ossl_check_const_CONF_VALUE_sk_type(sk)))
0068 #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)))
0069 #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)))
0070 DEFINE_LHASH_OF_INTERNAL(CONF_VALUE);
0071 #define lh_CONF_VALUE_new(hfn, cmp) ((LHASH_OF(CONF_VALUE) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_CONF_VALUE_lh_hashfunc_type(hfn), ossl_check_CONF_VALUE_lh_compfunc_type(cmp)), lh_CONF_VALUE_hash_thunk, lh_CONF_VALUE_comp_thunk, lh_CONF_VALUE_doall_thunk, lh_CONF_VALUE_doall_arg_thunk))
0072 #define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh))
0073 #define lh_CONF_VALUE_flush(lh) OPENSSL_LH_flush(ossl_check_CONF_VALUE_lh_type(lh))
0074 #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)))
0075 #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)))
0076 #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)))
0077 #define lh_CONF_VALUE_error(lh) OPENSSL_LH_error(ossl_check_CONF_VALUE_lh_type(lh))
0078 #define lh_CONF_VALUE_num_items(lh) OPENSSL_LH_num_items(ossl_check_CONF_VALUE_lh_type(lh))
0079 #define lh_CONF_VALUE_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
0080 #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)
0081 #define lh_CONF_VALUE_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
0082 #define lh_CONF_VALUE_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_CONF_VALUE_lh_type(lh))
0083 #define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl)
0084 #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))
0085
0086
0087 struct conf_st;
0088 struct conf_method_st;
0089 typedef struct conf_method_st CONF_METHOD;
0090
0091 # ifndef OPENSSL_NO_DEPRECATED_3_0
0092 # include <openssl/conftypes.h>
0093 # endif
0094
0095
0096 typedef struct conf_imodule_st CONF_IMODULE;
0097 typedef struct conf_module_st CONF_MODULE;
0098
0099 STACK_OF(CONF_MODULE);
0100 STACK_OF(CONF_IMODULE);
0101
0102
0103 typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
0104 typedef void conf_finish_func (CONF_IMODULE *md);
0105
0106 # define CONF_MFLAGS_IGNORE_ERRORS 0x1
0107 # define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
0108 # define CONF_MFLAGS_SILENT 0x4
0109 # define CONF_MFLAGS_NO_DSO 0x8
0110 # define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
0111 # define CONF_MFLAGS_DEFAULT_SECTION 0x20
0112
0113 int CONF_set_default_method(CONF_METHOD *meth);
0114 void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
0115 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
0116 long *eline);
0117 # ifndef OPENSSL_NO_STDIO
0118 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
0119 long *eline);
0120 # endif
0121 LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
0122 long *eline);
0123 STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
0124 const char *section);
0125 char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
0126 const char *name);
0127 long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
0128 const char *name);
0129 void CONF_free(LHASH_OF(CONF_VALUE) *conf);
0130 #ifndef OPENSSL_NO_STDIO
0131 int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
0132 #endif
0133 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
0134 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0135 OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name);
0136 #endif
0137
0138 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0139 # define OPENSSL_no_config() \
0140 OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
0141 #endif
0142
0143
0144
0145
0146
0147
0148 CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
0149 OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
0150 CONF *NCONF_new(CONF_METHOD *meth);
0151 CONF_METHOD *NCONF_default(void);
0152 #ifndef OPENSSL_NO_DEPRECATED_3_0
0153 OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void);
0154 #endif
0155 void NCONF_free(CONF *conf);
0156 void NCONF_free_data(CONF *conf);
0157
0158 int NCONF_load(CONF *conf, const char *file, long *eline);
0159 # ifndef OPENSSL_NO_STDIO
0160 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
0161 # endif
0162 int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
0163 STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
0164 STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
0165 const char *section);
0166 char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
0167 int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
0168 long *result);
0169 #ifndef OPENSSL_NO_STDIO
0170 int NCONF_dump_fp(const CONF *conf, FILE *out);
0171 #endif
0172 int NCONF_dump_bio(const CONF *conf, BIO *out);
0173
0174 #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
0175
0176
0177
0178 int CONF_modules_load(const CONF *cnf, const char *appname,
0179 unsigned long flags);
0180 int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
0181 const char *appname, unsigned long flags);
0182 int CONF_modules_load_file(const char *filename, const char *appname,
0183 unsigned long flags);
0184 void CONF_modules_unload(int all);
0185 void CONF_modules_finish(void);
0186 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0187 # define CONF_modules_free() while(0) continue
0188 #endif
0189 int CONF_module_add(const char *name, conf_init_func *ifunc,
0190 conf_finish_func *ffunc);
0191
0192 const char *CONF_imodule_get_name(const CONF_IMODULE *md);
0193 const char *CONF_imodule_get_value(const CONF_IMODULE *md);
0194 void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
0195 void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
0196 CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
0197 unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
0198 void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
0199 void *CONF_module_get_usr_data(CONF_MODULE *pmod);
0200 void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
0201
0202 char *CONF_get1_default_config_file(void);
0203
0204 int CONF_parse_list(const char *list, int sep, int nospc,
0205 int (*list_cb) (const char *elem, int len, void *usr),
0206 void *arg);
0207
0208 void OPENSSL_load_builtin_modules(void);
0209
0210
0211 # ifdef __cplusplus
0212 }
0213 # endif
0214 #endif