]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
e74e562f MC |
2 | * {- join("\n * ", @autowarntext) -} |
3 | * | |
aff636a4 | 4 | * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 5 | * |
48f4ad77 | 6 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
7 | * this file except in compliance with the License. You can obtain a copy |
8 | * in the file LICENSE in the source distribution or at | |
9 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
10 | */ |
11 | ||
e74e562f | 12 | {- |
2ca697ce | 13 | use OpenSSL::stackhash qw(generate_stack_macros generate_lhash_macros); |
e74e562f MC |
14 | -} |
15 | ||
ae4186b0 DMSP |
16 | #ifndef OPENSSL_CONF_H |
17 | # define OPENSSL_CONF_H | |
d86167ec DMSP |
18 | # pragma once |
19 | ||
20 | # include <openssl/macros.h> | |
936c2b9e | 21 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
d86167ec DMSP |
22 | # define HEADER_CONF_H |
23 | # endif | |
d02b48c6 | 24 | |
0f113f3e MC |
25 | # include <openssl/bio.h> |
26 | # include <openssl/lhash.h> | |
af3e5e1b | 27 | # include <openssl/safestack.h> |
0f113f3e | 28 | # include <openssl/e_os2.h> |
50cd4768 | 29 | # include <openssl/types.h> |
52df25cf | 30 | # include <openssl/conferr.h> |
eab9dbbd NS |
31 | # ifndef OPENSSL_NO_STDIO |
32 | # include <stdio.h> | |
33 | # endif | |
9ea1b878 | 34 | |
82271cee RL |
35 | #ifdef __cplusplus |
36 | extern "C" { | |
37 | #endif | |
38 | ||
0f113f3e MC |
39 | typedef struct { |
40 | char *section; | |
41 | char *name; | |
42 | char *value; | |
43 | } CONF_VALUE; | |
d02b48c6 | 44 | |
e74e562f | 45 | {- |
2ca697ce MC |
46 | generate_stack_macros("CONF_VALUE") |
47 | .generate_lhash_macros("CONF_VALUE"); | |
e74e562f | 48 | -} |
852c2ed2 | 49 | |
d86b6915 | 50 | struct conf_st; |
d86b6915 RL |
51 | struct conf_method_st; |
52 | typedef struct conf_method_st CONF_METHOD; | |
53 | ||
ff234c68 RS |
54 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
55 | # include <openssl/conftypes.h> | |
56 | # endif | |
d86b6915 | 57 | |
bc37d996 | 58 | /* Module definitions */ |
bc37d996 DSH |
59 | typedef struct conf_imodule_st CONF_IMODULE; |
60 | typedef struct conf_module_st CONF_MODULE; | |
61 | ||
01659135 | 62 | STACK_OF(CONF_MODULE); |
852c2ed2 | 63 | STACK_OF(CONF_IMODULE); |
de121164 | 64 | |
bc37d996 | 65 | /* DSO module function typedefs */ |
0f113f3e MC |
66 | typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); |
67 | typedef void conf_finish_func (CONF_IMODULE *md); | |
bc37d996 | 68 | |
0f113f3e MC |
69 | # define CONF_MFLAGS_IGNORE_ERRORS 0x1 |
70 | # define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 | |
71 | # define CONF_MFLAGS_SILENT 0x4 | |
72 | # define CONF_MFLAGS_NO_DSO 0x8 | |
73 | # define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 | |
74 | # define CONF_MFLAGS_DEFAULT_SECTION 0x20 | |
bc37d996 | 75 | |
d86b6915 | 76 | int CONF_set_default_method(CONF_METHOD *meth); |
0f113f3e MC |
77 | void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); |
78 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, | |
79 | long *eline); | |
80 | # ifndef OPENSSL_NO_STDIO | |
3c1d6bbc | 81 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, |
0f113f3e MC |
82 | long *eline); |
83 | # endif | |
84 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, | |
85 | long *eline); | |
3c1d6bbc | 86 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, |
0f113f3e MC |
87 | const char *section); |
88 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, | |
89 | const char *name); | |
90 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, | |
91 | const char *name); | |
3c1d6bbc | 92 | void CONF_free(LHASH_OF(CONF_VALUE) *conf); |
984d6c60 | 93 | #ifndef OPENSSL_NO_STDIO |
3c1d6bbc | 94 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); |
984d6c60 | 95 | #endif |
3c1d6bbc | 96 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); |
7f7c856c RL |
97 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
98 | OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name); | |
99 | #endif | |
7253fd55 | 100 | |
00db8c60 | 101 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
f672aee4 RS |
102 | # define OPENSSL_no_config() \ |
103 | OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) | |
104 | #endif | |
cca28b29 | 105 | |
0f113f3e MC |
106 | /* |
107 | * New conf code. The semantics are different from the functions above. If | |
108 | * that wasn't the case, the above functions would have been replaced | |
109 | */ | |
d86b6915 | 110 | |
b4250010 | 111 | CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth); |
b3c2ed70 | 112 | OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf); |
d86b6915 | 113 | CONF *NCONF_new(CONF_METHOD *meth); |
40889b9c | 114 | CONF_METHOD *NCONF_default(void); |
7f7c856c RL |
115 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
116 | OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void); | |
117 | #endif | |
d86b6915 RL |
118 | void NCONF_free(CONF *conf); |
119 | void NCONF_free_data(CONF *conf); | |
120 | ||
0f113f3e MC |
121 | int NCONF_load(CONF *conf, const char *file, long *eline); |
122 | # ifndef OPENSSL_NO_STDIO | |
123 | int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); | |
124 | # endif | |
125 | int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); | |
b3c2ed70 | 126 | STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf); |
0f113f3e MC |
127 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, |
128 | const char *section); | |
129 | char *NCONF_get_string(const CONF *conf, const char *group, const char *name); | |
130 | int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, | |
131 | long *result); | |
984d6c60 | 132 | #ifndef OPENSSL_NO_STDIO |
9dd5ae65 | 133 | int NCONF_dump_fp(const CONF *conf, FILE *out); |
984d6c60 | 134 | #endif |
9dd5ae65 | 135 | int NCONF_dump_bio(const CONF *conf, BIO *out); |
d86b6915 | 136 | |
1a5adcfb | 137 | #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) |
0f113f3e | 138 | |
bc37d996 DSH |
139 | /* Module functions */ |
140 | ||
9dd5ae65 | 141 | int CONF_modules_load(const CONF *cnf, const char *appname, |
0f113f3e | 142 | unsigned long flags); |
b4250010 | 143 | int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename, |
d8652be0 | 144 | const char *appname, unsigned long flags); |
9dd5ae65 | 145 | int CONF_modules_load_file(const char *filename, const char *appname, |
0f113f3e | 146 | unsigned long flags); |
bc37d996 DSH |
147 | void CONF_modules_unload(int all); |
148 | void CONF_modules_finish(void); | |
00db8c60 | 149 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
6457615a | 150 | # define CONF_modules_free() while(0) continue |
cbf6959f | 151 | #endif |
cca28b29 | 152 | int CONF_module_add(const char *name, conf_init_func *ifunc, |
0f113f3e | 153 | conf_finish_func *ffunc); |
bc37d996 | 154 | |
9dd5ae65 BL |
155 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); |
156 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); | |
157 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); | |
bc37d996 | 158 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); |
9dd5ae65 BL |
159 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); |
160 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); | |
bc37d996 DSH |
161 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); |
162 | void *CONF_module_get_usr_data(CONF_MODULE *pmod); | |
163 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); | |
ba404b5e | 164 | |
c9501c22 DSH |
165 | char *CONF_get1_default_config_file(void); |
166 | ||
f78d4a35 | 167 | int CONF_parse_list(const char *list, int sep, int nospc, |
0f113f3e MC |
168 | int (*list_cb) (const char *elem, int len, void *usr), |
169 | void *arg); | |
df5eaa8a | 170 | |
3647bee2 DSH |
171 | void OPENSSL_load_builtin_modules(void); |
172 | ||
957b6db3 | 173 | |
0cd0a820 | 174 | # ifdef __cplusplus |
d02b48c6 | 175 | } |
0cd0a820 | 176 | # endif |
d02b48c6 | 177 | #endif |