I have a C++ code which uses Openssl 1.1.1a. When this c++ code is executed in gcc4.4 there is link error
undefined reference to `EVP_CIPHER_CTX_init'
undefined reference to `EVP_CIPHER_CTX_cleanup'
The same c++ code is building file with windows.
It uses EVP_CIPHER_CTX_init() & EVP_CIPHER_CTX_cleanup() from evp.h of openssl.
In evp.h these macros are defined as below.
# if OPENSSL_API_COMPAT < 0x10100000L
# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c)
# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c)
# endif
Somewhere in opensslconf.h the following is declared
#ifndef OPENSSL_MIN_API
# define OPENSSL_MIN_API 0
#endif
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
# undef OPENSSL_API_COMPAT
# define OPENSSL_API_COMPAT OPENSSL_MIN_API
#endif
So ideally OPENSSL_API_COMPAT should be initialized to 0 which would have defined the two functions which are linked by the C++ code.
Somehow these two functions are not defined while building in gcc4.4.
I tried defining the OPENSSL_API_COMPAT to 0 while building using -DOPENSSL_API_COMPAT=0 but still no luck
Ideally these functions should be defined when the macro OPENSSL_API_COMPAT is set to 0. No where else this macro is manipulated in c++ code or other library.
What and where could the macro be altered ? Would be of great help if any openssl expert give some insight here.