Fails to build with OpenSSL 3.0
Open
Nobody has claimed this yet.
refactor
- Dominant language
- C++
- Stars
- 16.2k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 80
Description
Operating System
Debian experimental
OpenRCT2 build
Current develop branch (fea9254)
Describe the issue
Debian has OpenSSL 3.0 staged in experimental, and it was found that OpenRCT2 fails to build:
[snip]
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "3.0.1", minimum required is "1.0.0")
[snip]
[ 23%] Building CXX object CMakeFiles/libopenrct2.dir/src/openrct2/core/File.cpp.o
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp: In member function ‘void OpenSSLRsaKey::SetKey(std::string_view, bool)’:
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:191:58: error: ‘RSA* PEM_read_bio_RSAPrivateKey(BIO*, RSA**, int (*)(char*, int, int, void*), void*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
191 | auto rsa = isPrivate ? PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, nullptr)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/pem.h:447:1: note: declared here
447 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, RSAPrivateKey, RSA)
| ^~~~~~~~~~~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:192:57: error: ‘RSA* PEM_read_bio_RSAPublicKey(BIO*, RSA**, int (*)(char*, int, int, void*), void*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
192 | : PEM_read_bio_RSAPublicKey(bio, nullptr, nullptr, nullptr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/pem.h:448:1: note: declared here
448 | DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, RSAPublicKey, RSA)
| ^~~~~~~~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:201:40: error: ‘int RSA_check_key(const RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
201 | if (isPrivate && !RSA_check_key(rsa))
| ~~~~~~~~~~~~~^~~~~
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/pem.h:23,
from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/rsa.h:278:27: note: declared here
278 | OSSL_DEPRECATEDIN_3_0 int RSA_check_key(const RSA *);
| ^~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:203:21: error: ‘void RSA_free(RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
203 | RSA_free(rsa);
| ~~~~~~~~^~~~~
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/pem.h:23,
from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/rsa.h:293:28: note: declared here
293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
| ^~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:210:26: error: ‘int EVP_PKEY_set1_RSA(EVP_PKEY*, rsa_st*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
210 | EVP_PKEY_set1_RSA(_evpKey, rsa);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:14:
/usr/include/openssl/evp.h:1344:5: note: declared here
1344 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
| ^~~~~~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:211:17: error: ‘void RSA_free(RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
211 | RSA_free(rsa);
| ~~~~~~~~^~~~~
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/pem.h:23,
from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/rsa.h:293:28: note: declared here
293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
| ^~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp: In member function ‘std::string OpenSSLRsaKey::GetKey(bool)’:
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:221:37: error: ‘rsa_st* EVP_PKEY_get1_RSA(EVP_PKEY*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
221 | auto rsa = EVP_PKEY_get1_RSA(_evpKey);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:14:
/usr/include/openssl/evp.h:1348:16: note: declared here
1348 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
| ^~~~~~~~~~~~~~~~~
[ 23%] Building CXX object CMakeFiles/libopenrct2.dir/src/openrct2/core/FileScanner.cpp.o
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:233:62: error: ‘int PEM_write_bio_RSAPrivateKey(BIO*, const RSA*, const EVP_CIPHER*, const unsigned char*, int, int (*)(char*, int, int, void*), void*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
233 | auto status = isPrivate ? PEM_write_bio_RSAPrivateKey(bio, rsa, nullptr, nullptr, 0, nullptr, nullptr)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/pem.h:447:1: note: declared here
447 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, RSAPrivateKey, RSA)
| ^~~~~~~~~~~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:234:61: error: ‘int PEM_write_bio_RSAPublicKey(BIO*, const RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
234 | : PEM_write_bio_RSAPublicKey(bio, rsa);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/pem.h:448:1: note: declared here
448 | DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, RSAPublicKey, RSA)
| ^~~~~~~~~~~~~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:238:21: error: ‘void RSA_free(RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
238 | RSA_free(rsa);
| ~~~~~~~~^~~~~
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/pem.h:23,
from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/rsa.h:293:28: note: declared here
293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
| ^~~~~~~~
/home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:241:17: error: ‘void RSA_free(RSA*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
241 | RSA_free(rsa);
| ~~~~~~~~^~~~~
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/pem.h:23,
from /home/gibmat/build/OpenRCT2-develop/src/openrct2/core/Crypt.OpenSSL.cpp:15:
/usr/include/openssl/rsa.h:293:28: note: declared here
293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
| ^~~~~~~~
The OpenSSL project has a migration guide that may be useful: https://www.openssl.org/docs/man3.0/man7/migration_guide.html
Area(s) with issue?
Building the game
Steps to reproduce
- Build the current develop branch on a system with OpenSSL 3.0 installed.
Attachments
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/openrct2/core/Crypt.OpenSSL.cpp and reproduce the develop-branch build on Debian experimental with OpenSSL 3.0. Read the OpenSSL 3.0 migration guide alongside the reported deprecated calls. Done means OpenRCT2 builds successfully with OpenSSL 3.0 without these errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100