1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 22:53:37 +02:00

ima-evm-utils: limit OPENSSL_init_crypto calls

OPENSSL_init_crypto() was introduced in version 1.1.  When using an
older version of openssl, don't call OPENSSL_init_crypto.  Partially
revert commit 782224f33cd7 ("ima-evm-utils: Rework openssl init").

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Mimi Zohar 2019-07-29 08:34:27 -04:00
parent d8e7d63feb
commit bd8b503206
2 changed files with 9 additions and 0 deletions

View File

@ -1943,11 +1943,13 @@ int main(int argc, char *argv[])
int err = 0, c, lind; int err = 0, c, lind;
ENGINE *eng = NULL; ENGINE *eng = NULL;
#if !(OPENSSL_VERSION_NUMBER < 0x10100000)
OPENSSL_init_crypto( OPENSSL_init_crypto(
#ifndef DISABLE_OPENSSL_CONF #ifndef DISABLE_OPENSSL_CONF
OPENSSL_INIT_LOAD_CONFIG | OPENSSL_INIT_LOAD_CONFIG |
#endif #endif
OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL); OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL);
#endif
g_argv = argv; g_argv = argv;
g_argc = argc; g_argc = argc;

View File

@ -979,7 +979,14 @@ int sign_hash(const char *hashalgo, const unsigned char *hash, int size, const c
static void libinit() static void libinit()
{ {
#if OPENSSL_VERSION_NUMBER < 0x10100000
OpenSSL_add_all_algorithms();
OPENSSL_add_all_algorithms_conf();
#else
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS |
OPENSSL_INIT_ADD_ALL_DIGESTS, NULL); OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
ERR_load_crypto_strings(); ERR_load_crypto_strings();
#endif
} }