mirror of
https://github.com/openssl/openssl.git
synced 2025-03-01 19:28:10 +08:00
Previously, the API version limit was indicated with a numeric version number. This was "natural" in the pre-3.0.0 because the version was this simple number. With 3.0.0, the version is divided into three separate numbers, and it's only the major number that counts, but we still need to be able to support pre-3.0.0 version limits. Therefore, we allow OPENSSL_API_COMPAT to be defined with a pre-3.0.0 style numeric version number or with a simple major number, i.e. can be defined like this for any application: -D OPENSSL_API_COMPAT=0x10100000L -D OPENSSL_API_COMPAT=3 Since the pre-3.0.0 numerical version numbers are high, it's easy to distinguish between a simple major number and a pre-3.0.0 numerical version number and to thereby support both forms at the same time. Internally, we define the following macros depending on the value of OPENSSL_API_COMPAT: OPENSSL_API_0_9_8 OPENSSL_API_1_0_0 OPENSSL_API_1_1_0 OPENSSL_API_3 They indicate that functions marked for deprecation in the corresponding major release shall not be built if defined. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7724)
65 lines
1.6 KiB
C
65 lines
1.6 KiB
C
/*
|
|
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
*
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
* in the file LICENSE in the source distribution or at
|
|
* https://www.openssl.org/source/license.html
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <openssl/crypto.h>
|
|
#include "internal/cryptlib.h"
|
|
#include "internal/conf.h"
|
|
#include <openssl/x509.h>
|
|
#include <openssl/asn1.h>
|
|
#include <openssl/engine.h>
|
|
|
|
#ifdef _WIN32
|
|
# define strdup _strdup
|
|
#endif
|
|
|
|
/*
|
|
* This is the automatic configuration loader: it is called automatically by
|
|
* OpenSSL when any of a number of standard initialisation functions are
|
|
* called, unless this is overridden by calling OPENSSL_no_config()
|
|
*/
|
|
|
|
static int openssl_configured = 0;
|
|
|
|
#if !OPENSSL_API_1_1_0
|
|
void OPENSSL_config(const char *appname)
|
|
{
|
|
OPENSSL_INIT_SETTINGS settings;
|
|
|
|
memset(&settings, 0, sizeof(settings));
|
|
if (appname != NULL)
|
|
settings.appname = strdup(appname);
|
|
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
|
|
}
|
|
#endif
|
|
|
|
void openssl_config_int(const char *appname)
|
|
{
|
|
if (openssl_configured)
|
|
return;
|
|
|
|
OPENSSL_load_builtin_modules();
|
|
#ifndef OPENSSL_NO_ENGINE
|
|
/* Need to load ENGINEs */
|
|
ENGINE_load_builtin_engines();
|
|
#endif
|
|
ERR_clear_error();
|
|
#ifndef OPENSSL_SYS_UEFI
|
|
CONF_modules_load_file(NULL, appname,
|
|
CONF_MFLAGS_DEFAULT_SECTION |
|
|
CONF_MFLAGS_IGNORE_MISSING_FILE);
|
|
#endif
|
|
openssl_configured = 1;
|
|
}
|
|
|
|
void openssl_no_config_int(void)
|
|
{
|
|
openssl_configured = 1;
|
|
}
|