When I try to compile the latest release 2.5.0-beta2 on the Void Linux build system I get the following error.
The code should compile
The compilation aborts with the following error:
-- Build of crashreporter disabled.
647df7bcee5b0f6000fc63590753095e85c0ce6d
-- GIT_SHA1 647df7bcee5b0f6000fc63590753095e85c0ce6d
Compiling without shibboleth
-- Could NOT find INOTIFY (missing: INOTIFY_LIBRARY_DIR)
-- Could NOT find PdfLatex (missing: PDFLATEX_EXECUTABLE)
================> LIBCLOUDPROVIDERS_LIBRARY-NOTFOUND
-- Could NOT find LIBCLOUDPROVIDERS (missing: LIBCLOUDPROVIDERS_INCLUDE_DIR LIBCLOUDPROVIDERS_LIBRARY)
-- Found SQLite3: /usr/lib/libsqlite3.so (Required is at least version "3.8.0")
-- Found SQLite3: /usr/lib/libsqlite3.so;/usr/lib/libsqlite3.so (Required is at least version "3.8.0")
-- Could NOT find KF5KIO (missing: KF5KIO_DIR)
-- Could NOT find KF5KIO: found neither KF5KIOConfig.cmake nor kf5kio-config.cmake
-- Could NOT find KF5 (missing: KIO) (Required is at least version "5.16")
Dolphin plugin disabled: KDE Frameworks 5.16 not found
-- Configuring done
-- Generating done
-- Build files have been written to: /builddir/desktop-2.5.0-beta2/build
[ 1%] Automatic MOC for target ocsync
[ 1%] Built target ocsync_autogen
[ 1%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/checksums.cpp.o
[ 2%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/filesystembase.cpp.o
[ 2%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/ownsql.cpp.o
[ 2%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/syncjournaldb.cpp.o
[ 3%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/syncjournalfilerecord.cpp.o
[ 3%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/utility.cpp.o
[ 4%] Building CXX object src/csync/CMakeFiles/ocsync.dir/__/common/remotepermissions.cpp.o
[ 4%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync.cpp.o
[ 5%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_exclude.cpp.o
[ 5%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_util.cpp.o
[ 6%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_misc.cpp.o
[ 6%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_update.cpp.o
[ 7%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_reconcile.cpp.o
[ 7%] Building CXX object src/csync/CMakeFiles/ocsync.dir/csync_rename.cpp.o
[ 8%] Building CXX object src/csync/CMakeFiles/ocsync.dir/vio/csync_vio.cpp.o
[ 8%] Building C object src/csync/CMakeFiles/ocsync.dir/std/c_alloc.c.o
[ 9%] Building C object src/csync/CMakeFiles/ocsync.dir/std/c_string.c.o
[ 9%] Building C object src/csync/CMakeFiles/ocsync.dir/std/c_time.c.o
[ 10%] Building CXX object src/csync/CMakeFiles/ocsync.dir/std/c_utf8.cpp.o
[ 10%] Building CXX object src/csync/CMakeFiles/ocsync.dir/vio/csync_vio_local_unix.cpp.o
[ 11%] Building CXX object src/csync/CMakeFiles/ocsync.dir/ocsync_autogen/mocs_compilation.cpp.o
[ 11%] Linking CXX shared library libocsync.so
[ 11%] Built target ocsync
[ 12%] Automatic MOC for target nextcloudsync
[ 12%] Built target nextcloudsync_autogen
[ 12%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/account.cpp.o
[ 13%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/wordlist.cpp.o
[ 13%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/bandwidthmanager.cpp.o
[ 14%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/capabilities.cpp.o
[ 14%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/cookiejar.cpp.o
[ 15%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/discoveryphase.cpp.o
[ 15%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/filesystem.cpp.o
[ 16%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/logger.cpp.o
[ 16%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/accessmanager.cpp.o
[ 17%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/configfile.cpp.o
[ 17%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/abstractnetworkjob.cpp.o
[ 18%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/networkjobs.cpp.o
[ 18%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/owncloudpropagator.cpp.o
[ 19%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/nextcloudtheme.cpp.o
[ 19%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/progressdispatcher.cpp.o
[ 20%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagatorjobs.cpp.o
[ 20%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagatedownload.cpp.o
/builddir/desktop-2.5.0-beta2/src/libsync/propagatedownload.cpp: In function 'void OCC::{anonymous}::preserveGroupOwnership(const QString&, const QFileInfo&)':
/builddir/desktop-2.5.0-beta2/src/libsync/propagatedownload.cpp:794:14: warning: ignoring return value of 'int chown(const char*, __uid_t, __gid_t)', declared with attribute warn_unused_result [-Wunused-result]
chown(fileName.toLocal8Bit().constData(), -1, fi.groupId());
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 21%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateupload.cpp.o
In file included from /builddir/desktop-2.5.0-beta2/src/csync/csync_private.h:43,
from /builddir/desktop-2.5.0-beta2/src/csync/csync_util.h:27,
from /builddir/desktop-2.5.0-beta2/src/libsync/owncloudpropagator.h:28,
from /builddir/desktop-2.5.0-beta2/src/libsync/propagateupload.h:16,
from /builddir/desktop-2.5.0-beta2/src/libsync/propagateupload.cpp:16:
/builddir/desktop-2.5.0-beta2/src/common/syncjournaldb.h: In member function 'void OCC::PropagateUploadFileCommon::checkResettingErrors()':
/builddir/desktop-2.5.0-beta2/src/common/syncjournaldb.h:100:12: warning: '<anonymous>.OCC::SyncJournalDb::UploadInfo::_modtime' may be used uninitialized in this function [-Wmaybe-uninitialized]
struct UploadInfo
^~~~~~~~~~
[ 21%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateuploadv1.cpp.o
[ 21%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateuploadng.cpp.o
[ 22%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateremotedelete.cpp.o
[ 22%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateremotedeleteencrypted.cpp.o
[ 23%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateremotemove.cpp.o
[ 23%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateremotemkdir.cpp.o
[ 24%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagateuploadencrypted.cpp.o
[ 24%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/propagatedownloadencrypted.cpp.o
[ 25%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/syncengine.cpp.o
[ 25%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/syncfileitem.cpp.o
[ 26%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/syncfilestatus.cpp.o
[ 26%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/syncfilestatustracker.cpp.o
[ 27%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/syncresult.cpp.o
[ 27%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/theme.cpp.o
[ 28%] Building CXX object src/libsync/CMakeFiles/nextcloudsync.dir/clientsideencryption.cpp.o
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp: In function 'QByteArray OCC::EncryptionHelper::generateRandom(int)':
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:94:15: error: 'RAND_bytes' was not declared in this scope
int ret = RAND_bytes(tmp, size);
^~~~~~~~~~
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:94:15: note: suggested alternative: 'RSA_bits'
int ret = RAND_bytes(tmp, size);
^~~~~~~~~~
RSA_bits
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp: In function 'QByteArray OCC::EncryptionHelper::decryptStringAsymmetric(EVP_PKEY*, const QByteArray&)':
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:513:9: error: 'EVP_PKEY_CTX_set_rsa_oaep_md' was not declared in this scope
if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:513:9: note: suggested alternative: 'EVP_PKEY_CTX_set_rsa_mgf1_md'
if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
EVP_PKEY_CTX_set_rsa_mgf1_md
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp: In function 'QByteArray OCC::EncryptionHelper::encryptStringAsymmetric(EVP_PKEY*, const QByteArray&)':
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:576:9: error: 'EVP_PKEY_CTX_set_rsa_oaep_md' was not declared in this scope
if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/desktop-2.5.0-beta2/src/libsync/clientsideencryption.cpp:576:9: note: suggested alternative: 'EVP_PKEY_CTX_set_rsa_mgf1_md'
if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
EVP_PKEY_CTX_set_rsa_mgf1_md
make[2]: *** [src/libsync/CMakeFiles/nextcloudsync.dir/build.make:479: src/libsync/CMakeFiles/nextcloudsync.dir/clientsideencryption.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: src/libsync/CMakeFiles/nextcloudsync.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
Client version:
Operating system: Linux void 4.18.15_1 #1 SMP PREEMPT Thu Oct 18 12:33:28 UTC 2018 x86_64 GNU/Linux
OS language: en_US.UTF-8
Qt version used by client package (Linux only, see also Settings dialog):
Qt5 5.11
Client package (From Nextcloud or distro) (Linux only):
Trying to build on Void Linux
PS: I am using this patch https://github.com/codingHahn/void-packages-1/blob/nextcloud-client/srcpkgs/nextcloud-client/patches/warning.patch to fix an error with wrong g++ parameters.
I think I found the problem. I was missing the development files of libressl
The issue actually lies in Void Linux using LibreSSL instead of OpenSSL as crypto library. I got it to compile with this patch:
Source: written by Nick Hahn <[email protected]>
Upstream: pending
Reason: nextcloud-desktop fails during compilation because it does not support LibreSLL
natively
--- clientsideencryption.cpp.orig 2018-08-24 14:54:42.000000000 +0200
+++ clientsideencryption.cpp 2018-10-22 22:00:10.099275292 +0200
@@ -3,6 +3,7 @@
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/engine.h>
+#include <openssl/rand.h>
#include "clientsideencryption.h"
@@ -510,7 +511,7 @@
return {};
}
- if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
+ if (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) {
qCInfo(lcCseDecryption()) << "Error setting OAEP SHA 256";
handleErrors();
return {};
@@ -573,7 +574,7 @@
exit(1);
}
- if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) {
+ if (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) {
qCInfo(lcCse()) << "Error setting OAEP SHA 256";
exit(1);
}
I don't know enough about the inner workings of nextcloud/desktop to see if something breaks with this patch. I would greatly appreciate if you could support LibreSSL in your application
Your patch works great, confirmed on Gentoo with LibreSSL 2.6.5
include
That one makes sense.
EVP_PKEY_CTX_set_rsa_mgf1_md
that will most likely result in broken encryption cross devices
Then how could we make this application compatible with libressl?
@codingHahn Above patch works correctly.
Also with E2E encryption across devices?
The patch in https://github.com/nextcloud/desktop/issues/738#issuecomment-431956684 seems incorrect indeed. EVP_PKEY_CTX_set_rsa_oaep_md() in LibreSSL is not (yet) implemented. In this diff it is just another operation used instead of not implemented one.
A [slightly] more correct patch in my opinion would be:
diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp
index f0d3bc9dc..1b062fc23 100644
--- a/src/libsync/clientsideencryption.cpp
+++ b/src/libsync/clientsideencryption.cpp
@@ -35,6 +35,15 @@
#include "wordlist.h"
+#ifndef EVP_PKEY_CTX_set_rsa_oaep_md
+# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9)
+# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11)
+
+# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
+ EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md))
+#endif
+
QDebug operator<<(QDebug out, const std::string& str)
{
out << QString::fromStdString(str);
So with LibreSSL EVP_PKEY_CTX_ctrl() should explicitly return an error "operation not supported" when you try to use e2e instead of probably breaking it. When it is implemented in LibreSSL these macros should be in
+1 libreSSL support
+1
Seems to work nicely inside a docker container for the meantime though: https://github.com/SirPscl/nextcloud-desktop-docker
Submit a pull request maybe? https://github.com/nextcloud/desktop/pulls
openSUSE also have this problem.
As mentioned in https://github.com/libressl-portable/portable/issues/547#issuecomment-549200784, support has landed in libreSSL. So, can someone revisit this?
That would be nice, I would love to see libressl support for nextcloud. Otherwise. I will use owncloud's client till it is supported in nextcloud. Though... there are other issues too.
LibreSSL introduced EVP_PKEY_CTX_set_rsa_oaep_md in version 3.1 AFAICT. I just tried and it seems to build properly with no change on our end so should be resolved now (or soon depending when your distro of choice upgrades to 3.1). As pointed out by @rullzer we couldn't do anything about it before to avoid breaking encryption across devices.
Ah okay cool! :)
LibreSSL introduced EVP_PKEY_CTX_set_rsa_oaep_md in version 3.1 AFAICT. I just tried and it seems to build properly with no change on our end so should be resolved now (or soon depending when your distro of choice upgrades to 3.1). As pointed out by @rullzer we couldn't do anything about it before to avoid breaking encryption across devices.
Most helpful comment
The issue actually lies in Void Linux using LibreSSL instead of OpenSSL as crypto library. I got it to compile with this patch:
I don't know enough about the inner workings of nextcloud/desktop to see if something breaks with this patch. I would greatly appreciate if you could support LibreSSL in your application