]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/conf/conf_sap.c
Copyright consolidation 04/10
[thirdparty/openssl.git] / crypto / conf / conf_sap.c
CommitLineData
0f113f3e 1/*
62867571 2 * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
e84be9b4 3 *
62867571
RS
4 * Licensed under the OpenSSL license (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
e84be9b4
DSH
8 */
9
10#include <stdio.h>
11#include <openssl/crypto.h>
b39fc560 12#include "internal/cryptlib.h"
7b9f8f7f 13#include <internal/conf.h>
e84be9b4
DSH
14#include <openssl/x509.h>
15#include <openssl/asn1.h>
3c27208f 16#include <openssl/engine.h>
e84be9b4 17
0f113f3e
MC
18/*
19 * This is the automatic configuration loader: it is called automatically by
20 * OpenSSL when any of a number of standard initialisation functions are
21 * called, unless this is overridden by calling OPENSSL_no_config()
e84be9b4
DSH
22 */
23
24static int openssl_configured = 0;
25
31305cdf 26#if OPENSSL_API_COMPAT < 0x10100000L
e84be9b4 27void OPENSSL_config(const char *config_name)
7b9f8f7f 28{
7253fd55 29 OPENSSL_INIT_SETTINGS settings;
dfbfd067 30
7253fd55 31 memset(&settings, 0, sizeof(settings));
4015adf0
RP
32 if (config_name != NULL)
33 settings.config_name = strdup(config_name);
7253fd55 34 OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
7b9f8f7f 35}
31305cdf 36#endif
7b9f8f7f 37
b3599dbb 38void openssl_config_int(const char *config_name)
0f113f3e
MC
39{
40 if (openssl_configured)
41 return;
e84be9b4 42
0f113f3e 43 OPENSSL_load_builtin_modules();
0b13e9f0 44#ifndef OPENSSL_NO_ENGINE
0f113f3e
MC
45 /* Need to load ENGINEs */
46 ENGINE_load_builtin_engines();
0b13e9f0 47#endif
0f113f3e 48 ERR_clear_error();
984d6c60 49#ifndef OPENSSL_SYS_UEFI
abdd6771 50 CONF_modules_load_file(NULL, config_name,
0f113f3e 51 CONF_MFLAGS_DEFAULT_SECTION |
abdd6771 52 CONF_MFLAGS_IGNORE_MISSING_FILE);
984d6c60 53#endif
434b5845 54 openssl_configured = 1;
0f113f3e 55}
e84be9b4 56
b3599dbb 57void openssl_no_config_int(void)
0f113f3e
MC
58{
59 openssl_configured = 1;
60}