From a80c58f3679ef488fe1d99e425b2614cf4114e01 Mon Sep 17 00:00:00 2001 From: allexzander Date: Mon, 24 May 2021 11:45:13 +0300 Subject: [PATCH 1/2] Bugfix. Crash when printing OpenSSL decryption errors with no e2ee mnemonic. Signed-off-by: allexzander --- src/libsync/clientsideencryption.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 869c3ee5d89ad..b4ba523b2bcd8 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -708,8 +708,8 @@ QByteArray decryptStringAsymmetric(EVP_PKEY *privateKey, const QByteArray& data) QByteArray out(outlen, '\0'); if (EVP_PKEY_decrypt(ctx, unsignedData(out), &outlen, (unsigned char *)data.constData(), data.size()) <= 0) { - qCInfo(lcCseDecryption()) << "Could not decrypt the data."; - ERR_print_errors_fp(stdout); // This line is not printing anything. + qCCritical(lcCseDecryption()) << "Could not decrypt the data."; + qCCritical(lcCseDecryption()) << handleErrors(); return {}; } else { qCInfo(lcCseDecryption()) << "data decrypted successfully"; From bf39f053c48c3ff0b5a287be7052c2f677d63348 Mon Sep 17 00:00:00 2001 From: allexzander Date: Fri, 28 May 2021 10:19:03 +0300 Subject: [PATCH 2/2] Fix review comments. Signed-off-by: allexzander --- src/libsync/clientsideencryption.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index b4ba523b2bcd8..aff13f5bc8a38 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -708,8 +708,8 @@ QByteArray decryptStringAsymmetric(EVP_PKEY *privateKey, const QByteArray& data) QByteArray out(outlen, '\0'); if (EVP_PKEY_decrypt(ctx, unsignedData(out), &outlen, (unsigned char *)data.constData(), data.size()) <= 0) { - qCCritical(lcCseDecryption()) << "Could not decrypt the data."; - qCCritical(lcCseDecryption()) << handleErrors(); + const auto error = handleErrors(); + qCCritical(lcCseDecryption()) << "Could not decrypt the data." << error; return {}; } else { qCInfo(lcCseDecryption()) << "data decrypted successfully";