From: tb Date: Sat, 31 Aug 2024 09:50:52 +0000 (+0000) Subject: Remove more CONF_* functions that are no longer needed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=904647e4cf107ebb262581dd88a8415cc907f2b5;p=openbsd 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 --- diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 290850eebce..d76ab68db62 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -589,12 +589,7 @@ CMS_unsigned_get_attr_by_OBJ CMS_unsigned_get_attr_count CMS_verify CMS_verify_receipt -CONF_free CONF_get1_default_config_file -CONF_get_number -CONF_get_section -CONF_get_string -CONF_load CONF_modules_finish CONF_modules_free CONF_modules_load diff --git a/lib/libcrypto/conf/conf.h b/lib/libcrypto/conf/conf.h index 28b5f9d5836..5796ee29acf 100644 --- a/lib/libcrypto/conf/conf.h +++ b/lib/libcrypto/conf/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.24 2024/08/31 09:44:00 tb Exp $ */ +/* $OpenBSD: conf.h,v 1.25 2024/08/31 09:50:52 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -104,20 +104,7 @@ typedef void conf_finish_func(CONF_IMODULE *md); #define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 #define CONF_MFLAGS_DEFAULT_SECTION 0x20 -int CONF_set_default_method(CONF_METHOD *meth); void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); -LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, - long *eline); -LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, - long *eline); -LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, - const char *section); -char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -void CONF_free(LHASH_OF(CONF_VALUE) *conf); void OPENSSL_config(const char *config_name); void OPENSSL_no_config(void); diff --git a/lib/libcrypto/conf/conf_lib.c b/lib/libcrypto/conf/conf_lib.c index 4440cfe6fde..7d426d56b20 100644 --- a/lib/libcrypto/conf/conf_lib.c +++ b/lib/libcrypto/conf/conf_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf_lib.c,v 1.23 2024/08/31 09:41:53 tb Exp $ */ +/* $OpenBSD: conf_lib.c,v 1.24 2024/08/31 09:50:52 tb Exp $ */ /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL * project 2000. */ @@ -77,130 +77,6 @@ CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) conf->data = hash; } -/* The following section contains the "CONF classic" functions, - rewritten in terms of the new CONF interface. */ - -int -CONF_set_default_method(CONF_METHOD *meth) -{ - default_CONF_method = meth; - return 1; -} - -LHASH_OF(CONF_VALUE) * -CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline) -{ - LHASH_OF(CONF_VALUE) *ltmp; - BIO *in = NULL; - - in = BIO_new_file(file, "rb"); - if (in == NULL) { - CONFerror(ERR_R_SYS_LIB); - return NULL; - } - - ltmp = CONF_load_bio(conf, in, eline); - BIO_free(in); - - return ltmp; -} -LCRYPTO_ALIAS(CONF_load); - -LHASH_OF(CONF_VALUE) * -CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline) -{ - BIO *btmp; - LHASH_OF(CONF_VALUE) *ltmp; - - if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { - CONFerror(ERR_R_BUF_LIB); - return NULL; - } - ltmp = CONF_load_bio(conf, btmp, eline); - BIO_free(btmp); - return ltmp; -} - -LHASH_OF(CONF_VALUE) * -CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline) -{ - CONF ctmp; - int ret; - - CONF_set_nconf(&ctmp, conf); - - ret = NCONF_load_bio(&ctmp, bp, eline); - if (ret) - return ctmp.data; - return NULL; -} - -STACK_OF(CONF_VALUE) * -CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section) -{ - if (conf == NULL) { - return NULL; - } else { - CONF ctmp; - CONF_set_nconf(&ctmp, conf); - return NCONF_get_section(&ctmp, section); - } -} -LCRYPTO_ALIAS(CONF_get_section); - -char * -CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name) -{ - if (conf == NULL) { - return NCONF_get_string(NULL, group, name); - } else { - CONF ctmp; - CONF_set_nconf(&ctmp, conf); - return NCONF_get_string(&ctmp, group, name); - } -} -LCRYPTO_ALIAS(CONF_get_string); - -long -CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name) -{ - int status; - long result = 0; - - if (conf == NULL) { - status = NCONF_get_number_e(NULL, group, name, &result); - } else { - CONF ctmp; - CONF_set_nconf(&ctmp, conf); - status = NCONF_get_number_e(&ctmp, group, name, &result); - } - - if (status == 0) { - /* This function does not believe in errors... */ - ERR_clear_error(); - } - return result; -} -LCRYPTO_ALIAS(CONF_get_number); - -void -CONF_free(LHASH_OF(CONF_VALUE) *conf) -{ - CONF ctmp; - - CONF_set_nconf(&ctmp, conf); - ctmp.meth->destroy_data(&ctmp); -} -LCRYPTO_ALIAS(CONF_free); - -/* The following section contains the "New CONF" functions. They are - completely centralised around a new CONF structure that may contain - basically anything, but at least a method pointer and a table of data. - These functions are also written in terms of the bridge functions used - by the "CONF classic" functions, for consistency. */ - CONF * NCONF_new(const CONF_METHOD *meth) { diff --git a/lib/libcrypto/hidden/openssl/conf.h b/lib/libcrypto/hidden/openssl/conf.h index 346fba1c4b4..adb9b38548c 100644 --- a/lib/libcrypto/hidden/openssl/conf.h +++ b/lib/libcrypto/hidden/openssl/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.6 2024/08/31 09:44:00 tb Exp $ */ +/* $OpenBSD: conf.h,v 1.7 2024/08/31 09:50:52 tb Exp $ */ /* * Copyright (c) 2024 Bob Beck * @@ -25,15 +25,7 @@ #endif #include "crypto_namespace.h" -LCRYPTO_USED(CONF_set_default_method); LCRYPTO_USED(CONF_set_nconf); -LCRYPTO_USED(CONF_load); -LCRYPTO_USED(CONF_load_fp); -LCRYPTO_USED(CONF_load_bio); -LCRYPTO_USED(CONF_get_section); -LCRYPTO_USED(CONF_get_string); -LCRYPTO_USED(CONF_get_number); -LCRYPTO_USED(CONF_free); LCRYPTO_USED(OPENSSL_config); LCRYPTO_USED(OPENSSL_no_config); LCRYPTO_USED(NCONF_new);