mirror of https://github.com/openssl/openssl.git
RT4562: Fix misleading doc on OPENSSL_config
Also changed the code to use "appname" not "filename" Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
parent
036e61b166
commit
cda3ae5bd0
|
@ -340,19 +340,19 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void)
|
||||||
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_STDIO
|
#ifndef OPENSSL_NO_STDIO
|
||||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||||
const char *config_file)
|
const char *appname)
|
||||||
{
|
{
|
||||||
char *new_config_file = NULL;
|
char *newappname = NULL;
|
||||||
|
|
||||||
if (config_file != NULL) {
|
if (appname != NULL) {
|
||||||
new_config_file = strdup(config_file);
|
newappname = strdup(appname);
|
||||||
if (new_config_file == NULL)
|
if (newappname == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(settings->config_name);
|
free(settings->appname);
|
||||||
settings->config_name = new_config_file;
|
settings->appname = newappname;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -360,6 +360,6 @@ int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
||||||
|
|
||||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings)
|
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings)
|
||||||
{
|
{
|
||||||
free(settings->config_name);
|
free(settings->appname);
|
||||||
free(settings);
|
free(settings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,18 +24,18 @@
|
||||||
static int openssl_configured = 0;
|
static int openssl_configured = 0;
|
||||||
|
|
||||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
void OPENSSL_config(const char *config_name)
|
void OPENSSL_config(const char *appname)
|
||||||
{
|
{
|
||||||
OPENSSL_INIT_SETTINGS settings;
|
OPENSSL_INIT_SETTINGS settings;
|
||||||
|
|
||||||
memset(&settings, 0, sizeof(settings));
|
memset(&settings, 0, sizeof(settings));
|
||||||
if (config_name != NULL)
|
if (appname != NULL)
|
||||||
settings.config_name = strdup(config_name);
|
settings.appname = strdup(appname);
|
||||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
|
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void openssl_config_int(const char *config_name)
|
void openssl_config_int(const char *appname)
|
||||||
{
|
{
|
||||||
if (openssl_configured)
|
if (openssl_configured)
|
||||||
return;
|
return;
|
||||||
|
@ -47,7 +47,7 @@ void openssl_config_int(const char *config_name)
|
||||||
#endif
|
#endif
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
#ifndef OPENSSL_SYS_UEFI
|
#ifndef OPENSSL_SYS_UEFI
|
||||||
CONF_modules_load_file(NULL, config_name,
|
CONF_modules_load_file(NULL, appname,
|
||||||
CONF_MFLAGS_DEFAULT_SECTION |
|
CONF_MFLAGS_DEFAULT_SECTION |
|
||||||
CONF_MFLAGS_IGNORE_MISSING_FILE);
|
CONF_MFLAGS_IGNORE_MISSING_FILE);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -153,15 +153,15 @@ static void ossl_init_no_add_algs(void)
|
||||||
|
|
||||||
static CRYPTO_ONCE config = CRYPTO_ONCE_STATIC_INIT;
|
static CRYPTO_ONCE config = CRYPTO_ONCE_STATIC_INIT;
|
||||||
static int config_inited = 0;
|
static int config_inited = 0;
|
||||||
static const char *config_filename;
|
static const char *appname;
|
||||||
static void ossl_init_config(void)
|
static void ossl_init_config(void)
|
||||||
{
|
{
|
||||||
#ifdef OPENSSL_INIT_DEBUG
|
#ifdef OPENSSL_INIT_DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"OPENSSL_INIT: ossl_init_config: openssl_config(%s)\n",
|
"OPENSSL_INIT: ossl_init_config: openssl_config(%s)\n",
|
||||||
config_filename==NULL?"NULL":config_filename);
|
appname == NULL ? "NULL" : appname);
|
||||||
#endif
|
#endif
|
||||||
openssl_config_int(config_filename);
|
openssl_config_int(appname);
|
||||||
config_inited = 1;
|
config_inited = 1;
|
||||||
}
|
}
|
||||||
static void ossl_init_no_config(void)
|
static void ossl_init_no_config(void)
|
||||||
|
@ -512,7 +512,7 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
|
||||||
if (opts & OPENSSL_INIT_LOAD_CONFIG) {
|
if (opts & OPENSSL_INIT_LOAD_CONFIG) {
|
||||||
int ret;
|
int ret;
|
||||||
CRYPTO_THREAD_write_lock(init_lock);
|
CRYPTO_THREAD_write_lock(init_lock);
|
||||||
config_filename = (settings == NULL) ? NULL : settings->config_name;
|
appname = (settings == NULL) ? NULL : settings->appname;
|
||||||
ret = CRYPTO_THREAD_run_once(&config, ossl_init_config);
|
ret = CRYPTO_THREAD_run_once(&config, ossl_init_config);
|
||||||
CRYPTO_THREAD_unlock(init_lock);
|
CRYPTO_THREAD_unlock(init_lock);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -8,15 +8,16 @@ OPENSSL_config, OPENSSL_no_config - simple OpenSSL configuration functions
|
||||||
|
|
||||||
#include <openssl/conf.h>
|
#include <openssl/conf.h>
|
||||||
|
|
||||||
void OPENSSL_config(const char *config_name);
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
|
void OPENSSL_config(const char *appname);
|
||||||
void OPENSSL_no_config(void);
|
void OPENSSL_no_config(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
OPENSSL_config() configures OpenSSL using the standard B<openssl.cnf>
|
OPENSSL_config() configures OpenSSL using the standard B<openssl.cnf> and
|
||||||
configuration file name using B<config_name>. If B<config_name> is NULL then
|
reads from the application section B<appname>. If B<appname> is NULL then
|
||||||
the file specified in the environment variable B<OPENSSL_CONF> will be used,
|
the default section, B<openssl_conf>, will be used.
|
||||||
and if that is not set then a system default location is used.
|
|
||||||
Errors are silently ignored.
|
Errors are silently ignored.
|
||||||
Multiple calls have no effect.
|
Multiple calls have no effect.
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ initialisation and deinitialisation functions
|
||||||
void OPENSSL_thread_stop(void);
|
void OPENSSL_thread_stop(void);
|
||||||
|
|
||||||
OPENSSL_INIT_SETTINGS *OPENSSL_init_new(void);
|
OPENSSL_INIT_SETTINGS *OPENSSL_init_new(void);
|
||||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *init,
|
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *init,
|
||||||
const char* name);
|
const char* name);
|
||||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *init);
|
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *init);
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ described in the NOTES section below.
|
||||||
The B<OPENSSL_INIT_LOAD_CONFIG> flag will load a default configuration
|
The B<OPENSSL_INIT_LOAD_CONFIG> flag will load a default configuration
|
||||||
file. To specify a different file, an B<OPENSSL_INIT_SETTINGS> must
|
file. To specify a different file, an B<OPENSSL_INIT_SETTINGS> must
|
||||||
be created and used. The routines
|
be created and used. The routines
|
||||||
OPENSSL_init_new() and OPENSSL_INIT_set_config_filename() can be used to
|
OPENSSL_init_new() and OPENSSL_INIT_set_config_appname() can be used to
|
||||||
allocate the object and set the configuration filename, and then the
|
allocate the object and set the application name, and then the
|
||||||
object can be released with OPENSSL_INIT_free() when done.
|
object can be released with OPENSSL_INIT_free() when done.
|
||||||
|
|
||||||
=head1 NOTES
|
=head1 NOTES
|
||||||
|
@ -220,7 +220,7 @@ call should use the RTLD_NODELETE flag (where available on the platform).
|
||||||
=head1 RETURN VALUES
|
=head1 RETURN VALUES
|
||||||
|
|
||||||
The functions OPENSSL_init_crypto, OPENSSL_atexit() and
|
The functions OPENSSL_init_crypto, OPENSSL_atexit() and
|
||||||
OPENSSL_INIT_set_config_filename() return 1 on success or 0 on error.
|
OPENSSL_INIT_set_config_appname() return 1 on success or 0 on error.
|
||||||
|
|
||||||
=head1 SEE ALSO
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ L<OPENSSL_init_ssl(3)>
|
||||||
=head1 HISTORY
|
=head1 HISTORY
|
||||||
|
|
||||||
The OPENSSL_init_crypto(), OPENSSL_cleanup(), OPENSSL_atexit(),
|
The OPENSSL_init_crypto(), OPENSSL_cleanup(), OPENSSL_atexit(),
|
||||||
OPENSSL_thread_stop(), OPENSSL_init_new(), OPENSSL_INIT_set_config_filename()
|
OPENSSL_thread_stop(), OPENSSL_init_new(), OPENSSL_INIT_set_config_appname()
|
||||||
and OPENSSL_INIT_free() functions were added in OpenSSL 1.1.0.
|
and OPENSSL_INIT_free() functions were added in OpenSSL 1.1.0.
|
||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
|
@ -18,10 +18,10 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
struct ossl_init_settings_st {
|
struct ossl_init_settings_st {
|
||||||
char *config_name;
|
char *appname;
|
||||||
};
|
};
|
||||||
|
|
||||||
void openssl_config_int(const char *config_name);
|
void openssl_config_int(const char *appname);
|
||||||
void openssl_no_config_int(void);
|
void openssl_no_config_int(void);
|
||||||
void conf_modules_free_int(void);
|
void conf_modules_free_int(void);
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ void OPENSSL_thread_stop(void);
|
||||||
/* Low-level control of initialization */
|
/* Low-level control of initialization */
|
||||||
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||||
#ifndef OPENSSL_NO_STDIO
|
#ifndef OPENSSL_NO_STDIO
|
||||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||||
const char *config_file);
|
const char *config_file);
|
||||||
#endif
|
#endif
|
||||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||||
|
|
|
@ -1126,7 +1126,7 @@ i2d_X509_EXTENSIONS 1116 1_1_0 EXIST::FUNCTION:
|
||||||
X509_STORE_CTX_get0_store 1117 1_1_0 EXIST::FUNCTION:
|
X509_STORE_CTX_get0_store 1117 1_1_0 EXIST::FUNCTION:
|
||||||
PKCS12_pack_p7data 1118 1_1_0 EXIST::FUNCTION:
|
PKCS12_pack_p7data 1118 1_1_0 EXIST::FUNCTION:
|
||||||
RSA_print_fp 1119 1_1_0 EXIST::FUNCTION:RSA,STDIO
|
RSA_print_fp 1119 1_1_0 EXIST::FUNCTION:RSA,STDIO
|
||||||
OPENSSL_INIT_set_config_filename 1120 1_1_0 EXIST::FUNCTION:STDIO
|
OPENSSL_INIT_set_config_appname 1120 1_1_0 EXIST::FUNCTION:STDIO
|
||||||
EC_KEY_print_fp 1121 1_1_0 EXIST::FUNCTION:EC,STDIO
|
EC_KEY_print_fp 1121 1_1_0 EXIST::FUNCTION:EC,STDIO
|
||||||
BIO_dup_chain 1122 1_1_0 EXIST::FUNCTION:
|
BIO_dup_chain 1122 1_1_0 EXIST::FUNCTION:
|
||||||
PKCS8_PRIV_KEY_INFO_it 1123 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
PKCS8_PRIV_KEY_INFO_it 1123 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
||||||
|
|
Loading…
Reference in New Issue