From 7253fd550c768979ecd3df8f4dbbedd6e9dd76b0 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Wed, 10 Feb 2016 09:55:48 -0500 Subject: Hide OPENSSL_INIT_SETTINGS. Make OPENSSL_INIT_SETTINGS an opaque structure. Reviewed-by: Richard Levitte --- crypto/conf/conf_lib.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'crypto/conf/conf_lib.c') diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index 849b670e10..29357b26ad 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -57,6 +57,8 @@ */ #include +#include +#include #include #include #include @@ -370,3 +372,29 @@ int NCONF_dump_bio(const CONF *conf, BIO *out) return conf->meth->dump(conf, out); } + +/* + * These routines call the C malloc/free, to avoid intermixing with + * OpenSSL function pointers before the library is initialized. + */ +OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void) +{ + OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret)); + + memset(ret, 0, sizeof(*ret)); + return ret; +} + + +void OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, + const char *config_file) +{ + free(settings->config_name); + settings->config_name = config_file == NULL ? NULL : strdup(config_file); +} + +void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings) +{ + free(settings->config_name); + free(settings); +} -- cgit v1.2.3