PurpleI2P / i2pd

🛡 I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website
BSD 3-Clause "New" or "Revised" License
3.3k stars 424 forks source link

Failed to compile on OpenBSD #2080

Closed daviduhden closed 3 months ago

daviduhden commented 4 months ago

I get the following errors when trying to compile i2pd version 2.53.0 on OpenBSD 7.5 (amd64). I have all the dependencies installed, so I think it is due to some difference between OpenSSL and LibreSSL. I honestly don't have the knowledge to fix it myself.

/usr/local/src/i2pd/libi2pd/NTCP2.cpp:769:53: error: use of undeclared identifier 'EVP_PKEY_SIPHASH'
                EVP_PKEY * sipKey = EVP_PKEY_new_raw_private_key (EVP_PKEY_SIPHASH, nullptr, sendSipKey, 16);
                                                                  ^
/usr/local/src/i2pd/libi2pd/NTCP2.cpp:773:52: error: use of undeclared identifier 'EVP_PKEY_CTRL_SET_DIGEST_SIZE'
                EVP_PKEY_CTX_ctrl (ctx, -1, EVP_PKEY_OP_SIGNCTX, EVP_PKEY_CTRL_SET_DIGEST_SIZE, 8, nullptr);
                                                                 ^
/usr/local/src/i2pd/libi2pd/NTCP2.cpp:776:42: error: use of undeclared identifier 'EVP_PKEY_SIPHASH'
                sipKey = EVP_PKEY_new_raw_private_key (EVP_PKEY_SIPHASH, nullptr, receiveSipKey, 16);
                                                       ^
/usr/local/src/i2pd/libi2pd/NTCP2.cpp:780:52: error: use of undeclared identifier 'EVP_PKEY_CTRL_SET_DIGEST_SIZE'
                EVP_PKEY_CTX_ctrl (ctx, -1, EVP_PKEY_OP_SIGNCTX, EVP_PKEY_CTRL_SET_DIGEST_SIZE, 8, nullptr);
                                                                 ^
4 errors generated.
gmake[2]: *** [CMakeFiles/libi2pd.dir/build.make:398: CMakeFiles/libi2pd.dir/usr/local/src/i2pd/libi2pd/NTCP2.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:89: CMakeFiles/libi2pd.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Note: i2pd version 2.52.0 compiles on OpenBSD without the need to apply any significant patches. In fact, it is available in the official ports tree.

r4sas commented 3 months ago

OpenSSL 1.0.2 support dropped.

daviduhden commented 3 months ago

OpenSSL 1.0.2 support dropped.

I understand that support for OpenSSL 1.0.2 has been removed because it is legacy software and no operating system currently uses this version of OpenSSL. However, this is not the case with LibreSSL. LibreSSL is continuously updated, and there are modern operating systems such as OpenBSD, DragonFlyBSD, and Hyperbola Linux that use it as the default TLS provider.

After posting this issue, I attempted to update the i2pd port in OpenBSD to version 2.53.0 using the OpenSSL libraries. You can find my attempt here. However, I eventually gave up because I don't know how to tell I2Pd to use the OpenSSL libraries instead of LibreSSL. Handling conflicts between these two libraries in OpenBSD is a nightmare.

I don't know what the future holds for I2Pd in OpenBSD. I like both projects, but it seems that this can no longer be reconciled. On the other hand, I don't want to use the Java implementation because it's a inconvenient piece of shit.

Vort commented 3 months ago

OpenSSL 1.0.2 support dropped.

Why do you think it have any relation to problems with LibreSSL? For me it looks like LibreSSL just don't have full compatibility with OpenSSL.

Vort commented 3 months ago

@daviduhden you can try to comment (remove) some of these lines, especially #define OPENSSL_SIPHASH 1 and look if it will help. https://github.com/PurpleI2P/i2pd/blob/fe740249a508b9daa4956ed327a26584938f3769/libi2pd/Crypto.h#L31-L38 Also you can try to look at commit 37d3d9e604f295078659dceb66ff31439378daf4 and recover LibreSSL support without adding OpenSSL 1.0.2 support back.

orignal commented 3 months ago

All you need is define OPENSSL_SIPHASH 0 for libressl

orignal commented 3 months ago

https://github.com/PurpleI2P/i2pd/commit/db4208e2e2d86b7252caab357dc8257d44425137