/* apk_openssl.h - Alpine Package Keeper (APK) * * Copyright (C) 2005-2008 Natanael Copa * Copyright (C) 2008-2011 Timo Teräs * All rights reserved. * * SPDX-License-Identifier: GPL-2.0-only */ #ifndef APK_SSL_COMPAT_H #define APK_SSL_COMPAT_H #include #include #include #ifndef OPENSSL_NO_ENGINE #include #endif #if OPENSSL_VERSION_NUMBER < 0x1010000fL || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) static inline EVP_MD_CTX *EVP_MD_CTX_new(void) { return EVP_MD_CTX_create(); } static inline void EVP_MD_CTX_free(EVP_MD_CTX *mdctx) { return EVP_MD_CTX_destroy(mdctx); } static inline void apk_openssl_cleanup(void) { EVP_cleanup(); #ifndef OPENSSL_NO_ENGINE ENGINE_cleanup(); #endif CRYPTO_cleanup_all_ex_data(); } static inline void apk_openssl_init(void) { atexit(apk_openssl_cleanup); OpenSSL_add_all_algorithms(); #ifndef OPENSSL_NO_ENGINE ENGINE_load_builtin_engines(); ENGINE_register_all_complete(); #endif } #else static inline void apk_openssl_init(void) {} #endif #endif