2 * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 #include <openssl/crypto.h>
12 #include "internal/cryptlib.h"
13 #include "internal/conf.h"
14 #include "conf_local.h"
15 #include <openssl/x509.h>
16 #include <openssl/asn1.h>
17 #include <openssl/engine.h>
19 #if defined(_WIN32) && !defined(__BORLANDC__)
20 # define strdup _strdup
24 * This is the automatic configuration loader: it is called automatically by
25 * OpenSSL when any of a number of standard initialisation functions are
26 * called, unless this is overridden by calling OPENSSL_no_config()
29 static int openssl_configured = 0;
31 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
32 void OPENSSL_config(const char *appname)
34 OPENSSL_INIT_SETTINGS settings;
36 memset(&settings, 0, sizeof(settings));
38 settings.appname = strdup(appname);
39 settings.flags = DEFAULT_CONF_MFLAGS;
40 OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
44 int ossl_config_int(const OPENSSL_INIT_SETTINGS *settings)
51 if (openssl_configured)
54 filename = settings ? settings->filename : NULL;
55 appname = settings ? settings->appname : NULL;
56 flags = settings ? settings->flags : DEFAULT_CONF_MFLAGS;
58 #ifdef OPENSSL_INIT_DEBUG
59 fprintf(stderr, "OPENSSL_INIT: ossl_config_int(%s, %s, %lu)\n",
60 filename, appname, flags);
63 #ifndef OPENSSL_SYS_UEFI
64 ret = CONF_modules_load_file(filename, appname, flags);
66 openssl_configured = 1;
70 void ossl_no_config_int(void)
72 openssl_configured = 1;