ports/sysutils/barrier/files/extra-patch-src_lib_net_SecureUtils.cpp
Hiroki Tagato 6d297011f9 sysutils/barrier: unbreak build on non-OpenSSL 3 systems (12 and 13)
Builds of barrier started failing on non-OpenSSL 3 systems after
commit 29ba81195ab384a6b4de7c953cb6ac8ca2fff557 with the following
error:

/wrkdirs/usr/ports/sysutils/barrier/work/barrier-2.4.0/src/lib/net/SecureUtils.cpp:163:25: error: use of undeclared identifier 'EVP_RSA_gen'
    auto* private_key = EVP_RSA_gen(2048);
                        ^
1 warning and 1 error generated.

Applying the patch in commit 29ba81195ab384a6b4de7c953cb6ac8ca2fff557
conditionally solves the issue.

Approved by:	portmgr (build fix blanket)
2023-07-25 11:11:35 +09:00

22 lines
748 B
C++

--- src/lib/net/SecureUtils.cpp.orig 2023-07-21 23:37:03 UTC
+++ src/lib/net/SecureUtils.cpp
@@ -160,17 +160,11 @@ void generate_pem_self_signed_cert(const std::string&
{
auto expiration_days = 365;
- auto* private_key = EVP_PKEY_new();
+ auto* private_key = EVP_RSA_gen(2048);
if (!private_key) {
throw std::runtime_error("Could not allocate private key for certificate");
}
auto private_key_free = finally([private_key](){ EVP_PKEY_free(private_key); });
-
- auto* rsa = RSA_generate_key(2048, RSA_F4, nullptr, nullptr);
- if (!rsa) {
- throw std::runtime_error("Failed to generate RSA key");
- }
- EVP_PKEY_assign_RSA(private_key, rsa);
auto* cert = X509_new();
if (!cert) {