Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-crypt fails to build with openssl 3.0.0 #232

Open
loqs opened this issue Dec 14, 2021 · 2 comments
Open

git-crypt fails to build with openssl 3.0.0 #232

loqs opened this issue Dec 14, 2021 · 2 comments

Comments

@loqs
Copy link

loqs commented Dec 14, 2021

git-crypt 1c905fa fails to build with openssl 3.0.0 as OPENSSL_API_COMPAT is not defined since 1.
Same result with tag 0.6.0 546664f.
This causes the 1.0 code to be used which relies on functions no longer present in 3.0.0.

Output from build:
make ENABLE_MAN=yes PREFIX=/usr g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o git-crypt.o git-crypt.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o commands.o commands.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o crypto.o crypto.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o gpg.o gpg.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o key.o key.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o util.o util.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o parse_options.o parse_options.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o coprocess.o coprocess.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o fhstream.o fhstream.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o crypto-openssl-10.o crypto-openssl-10.cpp g++ -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c++11 -D_FORTIFY_SOURCE=2 -c -o crypto-openssl-11.o crypto-openssl-11.cpp xsltproc --param man.output.in.separate.dir 1 --stringparam man.output.base.dir man/ --param man.output.subdirs.enabled 1 --param man.authors.section.enabled 1 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl man/git-crypt.xml crypto-openssl-10.cpp: In constructor ‘Aes_ecb_encryptor::Aes_ecb_encryptor(const unsigned char*)’: crypto-openssl-10.cpp:59:32: warning: ‘int AES_set_encrypt_key(const unsigned char*, int, AES_KEY*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 59 | if (AES_set_encrypt_key(raw_key, KEY_LEN * 8, &(impl->key)) != 0) { | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from crypto-openssl-10.cpp:38: /usr/include/openssl/aes.h:51:5: note: declared here 51 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, | ^~~~~~~~~~~~~~~~~~~ crypto-openssl-10.cpp: In member function ‘void Aes_ecb_encryptor::encrypt(const unsigned char*, unsigned char*)’: crypto-openssl-10.cpp:74:20: warning: ‘void AES_encrypt(const unsigned char*, unsigned char*, const AES_KEY*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations] 74 | AES_encrypt(plain, cipher, &(impl->key)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from crypto-openssl-10.cpp:38: /usr/include/openssl/aes.h:57:6: note: declared here 57 | void AES_encrypt(const unsigned char *in, unsigned char *out, | ^~~~~~~~~~~ crypto-openssl-10.cpp: At global scope: crypto-openssl-10.cpp:78:18: error: field ‘ctx’ has incomplete type ‘HMAC_CTX’ {aka ‘hmac_ctx_st’} 78 | HMAC_CTX ctx; | ^~~ In file included from /usr/include/openssl/evp.h:26, from /usr/include/openssl/hmac.h:21, from crypto-openssl-10.cpp:40: /usr/include/openssl/types.h:132:16: note: forward declaration of ‘HMAC_CTX’ {aka ‘struct hmac_ctx_st’} 132 | typedef struct hmac_ctx_st HMAC_CTX; | ^~~~~~~~~~~ crypto-openssl-10.cpp: In destructor ‘Hmac_sha1_state::~Hmac_sha1_state()’: crypto-openssl-10.cpp:92:9: error: ‘HMAC_cleanup’ was not declared in this scope; did you mean ‘EVP_cleanup’? 92 | HMAC_cleanup(&(impl->ctx)); | ^~~~~~~~~~~~ | EVP_cleanup make: *** [<builtin>: crypto-openssl-10.o] Error 1 make: *** Waiting for unfinished jobs.... Note: Writing man/man1/git-crypt.1

Issue can be worked around by defining OPENSSL_API_COMPAT to any valid value e.g. OPENSSL_API_COMPAT=0x30000000L

git-crypt 1c905fa
git-crypt 0.6.0 546664f
openssl 3.0.0 openssl/openssl@89cd17a

loqs added a commit to loqs/PACKAGES-OSSL3 that referenced this issue Feb 24, 2022
OpenSSL 3.0.Y does not define OPENSSL_API_COMPAT so git-crypt uses the 1.0 interface include functions that have been removed.
Fix by defining OPENSSL_API_COMPAT=0x30000000L which allows the build to complete without hiding deprecation warnings.
AGWA/git-crypt#232
@arrfab
Copy link

arrfab commented Mar 28, 2022

Thanks for the report and also workaround : I gave it myself a tried and rebuilt it for CentOS Stream 9 with the different compile flag and seems to be working fine.
For reference : https://bugzilla.redhat.com/show_bug.cgi?id=2022033

@applejag
Copy link

applejag commented Jun 2, 2022

Setting CXXFLAGS environment variable helped, such as setting it only for the make command:

CXXFLAGS='-DOPENSSL_API_COMPAT=0x30000000L' make

loqs added a commit to loqs/PACKAGES-OSSL3 that referenced this issue Aug 29, 2022
Flydiverny added a commit to Flydiverny/setup-git-crypt that referenced this issue Dec 5, 2022
Flydiverny added a commit to Flydiverny/setup-git-crypt that referenced this issue Dec 5, 2022
Flydiverny added a commit to Flydiverny/setup-git-crypt that referenced this issue Dec 5, 2022
archii added a commit to archii/git-crypt that referenced this issue May 1, 2024
add CXXFLAGS to allow git-crypt to build on ubuntu-22.04
See: AGWA#232
archii added a commit to archii/git-crypt that referenced this issue May 1, 2024
add CXXFLAGS to allow git-crypt to build on ubuntu-22.04
See: AGWA#232
aleks-mariusz added a commit to aleks-mariusz/docker-git-crypt that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants