summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/conf/conf_lib.c
diff options
context:
space:
mode:
authortb <>2024-08-31 09:50:52 +0000
committertb <>2024-08-31 09:50:52 +0000
commit47d8e9d63b0c4faada5cbf609df1dd05bc3ffa5a (patch)
tree529b0e697861f5284b0451f23478abbf56fcf742 /src/lib/libcrypto/conf/conf_lib.c
parentaf86cb620ed97ba6a9aaccee083551eb8285963a (diff)
downloadopenbsd-47d8e9d63b0c4faada5cbf609df1dd05bc3ffa5a.tar.gz
openbsd-47d8e9d63b0c4faada5cbf609df1dd05bc3ffa5a.tar.bz2
openbsd-47d8e9d63b0c4faada5cbf609df1dd05bc3ffa5a.zip
Remove more CONF_* functions that are no longer needed
This is the next layer of unused cruft that can now go. The code lovingly called it 'the "CONF classic" functions'. No tear was shed. Don't worry, we still have the "New CONF" functions! ok beck jsing
Diffstat (limited to 'src/lib/libcrypto/conf/conf_lib.c')
-rw-r--r--src/lib/libcrypto/conf/conf_lib.c126
1 files changed, 1 insertions, 125 deletions
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c
index 4440cfe6fd..7d426d56b2 100644
--- a/src/lib/libcrypto/conf/conf_lib.c
+++ b/src/lib/libcrypto/conf/conf_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_lib.c,v 1.23 2024/08/31 09:41:53 tb Exp $ */ 1/* $OpenBSD: conf_lib.c,v 1.24 2024/08/31 09:50:52 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -77,130 +77,6 @@ CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash)
77 conf->data = hash; 77 conf->data = hash;
78} 78}
79 79
80/* The following section contains the "CONF classic" functions,
81 rewritten in terms of the new CONF interface. */
82
83int
84CONF_set_default_method(CONF_METHOD *meth)
85{
86 default_CONF_method = meth;
87 return 1;
88}
89
90LHASH_OF(CONF_VALUE) *
91CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline)
92{
93 LHASH_OF(CONF_VALUE) *ltmp;
94 BIO *in = NULL;
95
96 in = BIO_new_file(file, "rb");
97 if (in == NULL) {
98 CONFerror(ERR_R_SYS_LIB);
99 return NULL;
100 }
101
102 ltmp = CONF_load_bio(conf, in, eline);
103 BIO_free(in);
104
105 return ltmp;
106}
107LCRYPTO_ALIAS(CONF_load);
108
109LHASH_OF(CONF_VALUE) *
110CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline)
111{
112 BIO *btmp;
113 LHASH_OF(CONF_VALUE) *ltmp;
114
115 if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) {
116 CONFerror(ERR_R_BUF_LIB);
117 return NULL;
118 }
119 ltmp = CONF_load_bio(conf, btmp, eline);
120 BIO_free(btmp);
121 return ltmp;
122}
123
124LHASH_OF(CONF_VALUE) *
125CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline)
126{
127 CONF ctmp;
128 int ret;
129
130 CONF_set_nconf(&ctmp, conf);
131
132 ret = NCONF_load_bio(&ctmp, bp, eline);
133 if (ret)
134 return ctmp.data;
135 return NULL;
136}
137
138STACK_OF(CONF_VALUE) *
139CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section)
140{
141 if (conf == NULL) {
142 return NULL;
143 } else {
144 CONF ctmp;
145 CONF_set_nconf(&ctmp, conf);
146 return NCONF_get_section(&ctmp, section);
147 }
148}
149LCRYPTO_ALIAS(CONF_get_section);
150
151char *
152CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
153 const char *name)
154{
155 if (conf == NULL) {
156 return NCONF_get_string(NULL, group, name);
157 } else {
158 CONF ctmp;
159 CONF_set_nconf(&ctmp, conf);
160 return NCONF_get_string(&ctmp, group, name);
161 }
162}
163LCRYPTO_ALIAS(CONF_get_string);
164
165long
166CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
167 const char *name)
168{
169 int status;
170 long result = 0;
171
172 if (conf == NULL) {
173 status = NCONF_get_number_e(NULL, group, name, &result);
174 } else {
175 CONF ctmp;
176 CONF_set_nconf(&ctmp, conf);
177 status = NCONF_get_number_e(&ctmp, group, name, &result);
178 }
179
180 if (status == 0) {
181 /* This function does not believe in errors... */
182 ERR_clear_error();
183 }
184 return result;
185}
186LCRYPTO_ALIAS(CONF_get_number);
187
188void
189CONF_free(LHASH_OF(CONF_VALUE) *conf)
190{
191 CONF ctmp;
192
193 CONF_set_nconf(&ctmp, conf);
194 ctmp.meth->destroy_data(&ctmp);
195}
196LCRYPTO_ALIAS(CONF_free);
197
198/* The following section contains the "New CONF" functions. They are
199 completely centralised around a new CONF structure that may contain
200 basically anything, but at least a method pointer and a table of data.
201 These functions are also written in terms of the bridge functions used
202 by the "CONF classic" functions, for consistency. */
203
204CONF * 80CONF *
205NCONF_new(const CONF_METHOD *meth) 81NCONF_new(const CONF_METHOD *meth)
206{ 82{