diff options
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rw-r--r-- | lib/crypto/qolmaccount.cpp | 3 | ||||
-rw-r--r-- | lib/crypto/qolmaccount.h | 4 | ||||
-rw-r--r-- | lib/crypto/qolmerrors.cpp | 4 | ||||
-rw-r--r-- | lib/crypto/qolmerrors.h | 3 | ||||
-rw-r--r-- | lib/crypto/qolminboundsession.cpp | 2 | ||||
-rw-r--r-- | lib/crypto/qolminboundsession.h | 3 | ||||
-rw-r--r-- | lib/crypto/qolmmessage.cpp | 7 | ||||
-rw-r--r-- | lib/crypto/qolmmessage.h | 5 | ||||
-rw-r--r-- | lib/crypto/qolmoutboundsession.cpp | 3 | ||||
-rw-r--r-- | lib/crypto/qolmoutboundsession.h | 3 | ||||
-rw-r--r-- | lib/crypto/qolmsession.cpp | 6 | ||||
-rw-r--r-- | lib/crypto/qolmsession.h | 4 | ||||
-rw-r--r-- | lib/crypto/qolmutility.cpp | 4 | ||||
-rw-r--r-- | lib/crypto/qolmutility.h | 3 | ||||
-rw-r--r-- | lib/crypto/qolmutils.cpp | 2 | ||||
-rw-r--r-- | lib/crypto/qolmutils.h | 2 |
17 files changed, 17 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba6c8cd1..5601a281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,16 +158,20 @@ list(APPEND lib_SRCS lib/jobs/syncjob.cpp lib/jobs/mediathumbnailjob.cpp lib/jobs/downloadfilejob.cpp - lib/crypto/qolmaccount.cpp - lib/crypto/qolmsession.cpp - lib/crypto/qolminboundsession.cpp - lib/crypto/qolmoutboundsession.cpp - lib/crypto/qolmutils.cpp - lib/crypto/qolmutility.cpp - lib/crypto/qolmerrors.cpp - lib/crypto/qolmsession.cpp - lib/crypto/qolmmessage.cpp ) +if (${PROJECT_NAME}_ENABLE_E2EE) + list(APPEND lib_SRCS + lib/crypto/qolmaccount.cpp + lib/crypto/qolmsession.cpp + lib/crypto/qolminboundsession.cpp + lib/crypto/qolmoutboundsession.cpp + lib/crypto/qolmutils.cpp + lib/crypto/qolmutility.cpp + lib/crypto/qolmerrors.cpp + lib/crypto/qolmsession.cpp + lib/crypto/qolmmessage.cpp + ) +endif() # Configure API files generation diff --git a/lib/crypto/qolmaccount.cpp b/lib/crypto/qolmaccount.cpp index 0f354d3e..4f007e2f 100644 --- a/lib/crypto/qolmaccount.cpp +++ b/lib/crypto/qolmaccount.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "qolmaccount.h" #include "connection.h" #include "csapi/keys.h" @@ -318,5 +317,3 @@ bool Quotient::ed25519VerifySignature(const QString &signingKey, return std::get<bool>(result); } - -#endif diff --git a/lib/crypto/qolmaccount.h b/lib/crypto/qolmaccount.h index de78a8af..1e198687 100644 --- a/lib/crypto/qolmaccount.h +++ b/lib/crypto/qolmaccount.h @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> // // SPDX-License-Identifier: LGPL-2.1-or-later + #pragma once -#ifdef Quotient_E2EE_ENABLED #include "csapi/keys.h" #include "crypto/e2ee.h" @@ -111,5 +111,3 @@ bool ed25519VerifySignature(const QString &signingKey, const QString &signature); } // namespace Quotient - -#endif diff --git a/lib/crypto/qolmerrors.cpp b/lib/crypto/qolmerrors.cpp index f407383e..46b2618c 100644 --- a/lib/crypto/qolmerrors.cpp +++ b/lib/crypto/qolmerrors.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> +// // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED + #include "qolmerrors.h" Quotient::QOlmError Quotient::fromString(const std::string &error_raw) { @@ -18,4 +19,3 @@ Quotient::QOlmError Quotient::fromString(const std::string &error_raw) { return QOlmError::Unknown; } } -#endif diff --git a/lib/crypto/qolmerrors.h b/lib/crypto/qolmerrors.h index 400573c6..f8390d2a 100644 --- a/lib/crypto/qolmerrors.h +++ b/lib/crypto/qolmerrors.h @@ -4,7 +4,6 @@ #pragma once -#ifdef Quotient_E2EE_ENABLED #include <string> namespace Quotient { @@ -27,5 +26,3 @@ enum QOlmError QOlmError fromString(const std::string &error_raw); } //namespace Quotient - -#endif diff --git a/lib/crypto/qolminboundsession.cpp b/lib/crypto/qolminboundsession.cpp index 8f5056d8..e1ced72b 100644 --- a/lib/crypto/qolminboundsession.cpp +++ b/lib/crypto/qolminboundsession.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "crypto/qolminboundsession.h" #include <iostream> #include <cstring> @@ -154,4 +153,3 @@ bool QOlmInboundGroupSession::isVerified() const { return olm_inbound_group_session_is_verified(m_groupSession) != 0; } -#endif diff --git a/lib/crypto/qolminboundsession.h b/lib/crypto/qolminboundsession.h index 6af71cbd..36ab4942 100644 --- a/lib/crypto/qolminboundsession.h +++ b/lib/crypto/qolminboundsession.h @@ -4,8 +4,6 @@ #pragma once -#ifdef Quotient_E2EE_ENABLED - #include <QByteArray> #include <variant> #include <memory> @@ -48,4 +46,3 @@ private: using QOlmInboundGroupSessionPtr = std::unique_ptr<QOlmInboundGroupSession>; using OlmInboundGroupSessionPtr = std::unique_ptr<OlmInboundGroupSession>; } // namespace Quotient -#endif diff --git a/lib/crypto/qolmmessage.cpp b/lib/crypto/qolmmessage.cpp index ae98d52f..15008b75 100644 --- a/lib/crypto/qolmmessage.cpp +++ b/lib/crypto/qolmmessage.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "qolmmessage.h" using namespace Quotient; @@ -34,9 +33,3 @@ QOlmMessage QOlmMessage::fromCiphertext(const QByteArray &ciphertext) { return QOlmMessage(ciphertext, QOlmMessage::General); } - - -#endif // Quotient_E2EE_ENABLED - - - diff --git a/lib/crypto/qolmmessage.h b/lib/crypto/qolmmessage.h index d203364d..52aba78c 100644 --- a/lib/crypto/qolmmessage.h +++ b/lib/crypto/qolmmessage.h @@ -4,8 +4,6 @@ #pragma once -#ifdef Quotient_E2EE_ENABLED - #include <QObject> #include <QByteArray> @@ -40,7 +38,4 @@ private: Type m_messageType = General; }; - } //namespace Quotient - -#endif // Quotient_E2EE_ENABLED diff --git a/lib/crypto/qolmoutboundsession.cpp b/lib/crypto/qolmoutboundsession.cpp index 14b7368e..bf8dce61 100644 --- a/lib/crypto/qolmoutboundsession.cpp +++ b/lib/crypto/qolmoutboundsession.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "qolmoutboundsession.h" #include "crypto/qolmutils.h" @@ -127,5 +126,3 @@ std::variant<QByteArray, QOlmError> QOlmOutboundGroupSession::sessionKey() const } return keyBuffer; } - -#endif diff --git a/lib/crypto/qolmoutboundsession.h b/lib/crypto/qolmoutboundsession.h index 6b4fd30b..f1df0395 100644 --- a/lib/crypto/qolmoutboundsession.h +++ b/lib/crypto/qolmoutboundsession.h @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> // // SPDX-License-Identifier: LGPL-2.1-or-later + #pragma once -#ifdef Quotient_E2EE_ENABLED #include "olm/olm.h" #include "crypto/qolmerrors.h" @@ -51,4 +51,3 @@ private: using QOlmOutboundGroupSessionPtr = std::unique_ptr<QOlmOutboundGroupSession>; using OlmOutboundGroupSessionPtr = std::unique_ptr<OlmOutboundGroupSession>; } -#endif diff --git a/lib/crypto/qolmsession.cpp b/lib/crypto/qolmsession.cpp index b901a440..a1f6ab71 100644 --- a/lib/crypto/qolmsession.cpp +++ b/lib/crypto/qolmsession.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "qolmsession.h" #include "crypto/qolmutils.h" #include "logging.h" @@ -255,8 +254,3 @@ QOlmSession::QOlmSession(OlmSession *session) : m_session(session) { } - -#endif // Quotient_E2EE_ENABLED - - - diff --git a/lib/crypto/qolmsession.h b/lib/crypto/qolmsession.h index 0fc59e9e..959c77d0 100644 --- a/lib/crypto/qolmsession.h +++ b/lib/crypto/qolmsession.h @@ -4,8 +4,6 @@ #pragma once -#ifdef Quotient_E2EE_ENABLED - #include <QDebug> #include <olm/olm.h> // FIXME: OlmSession #include "crypto/e2ee.h" @@ -80,5 +78,3 @@ private: //using QOlmSessionPtr = std::unique_ptr<QOlmSession>; } //namespace Quotient - -#endif // Quotient_E2EE_ENABLED diff --git a/lib/crypto/qolmutility.cpp b/lib/crypto/qolmutility.cpp index 87615770..bb50b4d0 100644 --- a/lib/crypto/qolmutility.cpp +++ b/lib/crypto/qolmutility.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "crypto/qolmutility.h" #include "olm/olm.h" #include <QDebug> @@ -62,6 +61,3 @@ std::variant<bool, QOlmError> QOlmUtility::ed25519Verify(const QByteArray &key, } return true; } - - -#endif diff --git a/lib/crypto/qolmutility.h b/lib/crypto/qolmutility.h index 3de09ab4..fc6569f7 100644 --- a/lib/crypto/qolmutility.h +++ b/lib/crypto/qolmutility.h @@ -4,7 +4,6 @@ #pragma once -#ifdef Quotient_E2EE_ENABLED #include <QObject> #include <variant> #include "crypto/qolmerrors.h" @@ -44,5 +43,3 @@ private: }; } - -#endif diff --git a/lib/crypto/qolmutils.cpp b/lib/crypto/qolmutils.cpp index 4479932e..cd5ac83c 100644 --- a/lib/crypto/qolmutils.cpp +++ b/lib/crypto/qolmutils.cpp @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: LGPL-2.1-or-later -#ifdef Quotient_E2EE_ENABLED #include "crypto/qolmutils.h" #include <QDebug> #include <openssl/rand.h> @@ -23,4 +22,3 @@ QByteArray Quotient::getRandom(size_t bufferSize) RAND_bytes(reinterpret_cast<uint8_t *>(buffer.data()), buffer.size()); return buffer; } -#endif diff --git a/lib/crypto/qolmutils.h b/lib/crypto/qolmutils.h index 11e9f3cc..8b1c01ce 100644 --- a/lib/crypto/qolmutils.h +++ b/lib/crypto/qolmutils.h @@ -3,7 +3,6 @@ // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once -#ifdef Quotient_E2EE_ENABLED #include <QByteArray> @@ -14,4 +13,3 @@ namespace Quotient { QByteArray toKey(const PicklingMode &mode); QByteArray getRandom(size_t bufferSize); } -#endif |