diff --git a/fdbclient/BackupContainerAzureBlobStore.actor.cpp b/fdbclient/BackupContainerAzureBlobStore.actor.cpp index 39c001a198..5b32d9a9f7 100644 --- a/fdbclient/BackupContainerAzureBlobStore.actor.cpp +++ b/fdbclient/BackupContainerAzureBlobStore.actor.cpp @@ -170,7 +170,7 @@ public: } Reference f = makeReference(self->asyncTaskThread, self->containerName, fileName, self->client.get()); -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED if (self->usesEncryption()) { f = makeReference(f, false); } @@ -185,7 +185,7 @@ public: return Void(); })); auto f = makeReference(self->asyncTaskThread, self->containerName, fileName, self->client.get()); -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTED_ENABLED if (self->usesEncryption()) { f = makeReference(f, true); } diff --git a/fdbclient/BackupContainerFileSystem.actor.cpp b/fdbclient/BackupContainerFileSystem.actor.cpp index 051d6ec2ea..5c6783201e 100644 --- a/fdbclient/BackupContainerFileSystem.actor.cpp +++ b/fdbclient/BackupContainerFileSystem.actor.cpp @@ -1127,7 +1127,7 @@ public: return false; } -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED ACTOR static Future createTestEncryptionKeyFile(std::string filename) { state Reference keyFile = wait(IAsyncFileSystem::filesystem()->open( filename, @@ -1164,7 +1164,8 @@ public: StreamCipher::Key::initializeKey(std::move(key)); return Void(); } -#endif // encryption enabled +#endif // ENCRYPTION_ENABLED + }; // class BackupContainerFileSystemImpl Future> BackupContainerFileSystem::writeLogFile(Version beginVersion, @@ -1479,7 +1480,7 @@ Future BackupContainerFileSystem::encryptionSetupComplete() const { } void BackupContainerFileSystem::setEncryptionKey(Optional const& encryptionKeyFileName) { if (encryptionKeyFileName.present()) { -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED encryptionSetupFuture = BackupContainerFileSystemImpl::readEncryptionKey(encryptionKeyFileName.get()); #else encryptionSetupFuture = Void(); @@ -1487,7 +1488,7 @@ void BackupContainerFileSystem::setEncryptionKey(Optional const& en } } Future BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const &filename) { -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED return BackupContainerFileSystemImpl::createTestEncryptionKeyFile(filename); #else return Void(); diff --git a/fdbclient/BackupContainerS3BlobStore.actor.cpp b/fdbclient/BackupContainerS3BlobStore.actor.cpp index 0dc526e953..f95e683768 100644 --- a/fdbclient/BackupContainerS3BlobStore.actor.cpp +++ b/fdbclient/BackupContainerS3BlobStore.actor.cpp @@ -171,7 +171,7 @@ std::string BackupContainerS3BlobStore::getURLFormat() { Future> BackupContainerS3BlobStore::readFile(const std::string& path) { Reference f = makeReference(m_bstore, m_bucket, dataPath(path)); -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTED_ENABLED if (usesEncryption()) { f = makeReference(f, AsyncFileEncrypted::Mode::READ_ONLY); } @@ -191,7 +191,7 @@ Future> BackupContainerS3BlobStore::listURLs(Reference< Future> BackupContainerS3BlobStore::writeFile(const std::string& path) { Reference f = makeReference(m_bstore, m_bucket, dataPath(path)); -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED if (usesEncryption()) { f = makeReference(f, AsyncFileEncrypted::Mode::APPEND_ONLY); } diff --git a/fdbrpc/AsyncFileEncrypted.h b/fdbrpc/AsyncFileEncrypted.h index 76d6d53222..a31673b829 100644 --- a/fdbrpc/AsyncFileEncrypted.h +++ b/fdbrpc/AsyncFileEncrypted.h @@ -20,7 +20,7 @@ #pragma once -#if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#if ENCRYPTION_ENABLED #include "fdbrpc/IAsyncFile.h" #include "flow/FastRef.h" @@ -82,4 +82,4 @@ public: int64_t debugFD() const override; }; -#endif // Encryption enabled +#endif // ENCRYPTION_ENABLED diff --git a/flow/StreamCipher.h b/flow/StreamCipher.h index ed85c0bc07..8c35d99da5 100644 --- a/flow/StreamCipher.h +++ b/flow/StreamCipher.h @@ -21,6 +21,12 @@ #pragma once #if (!defined(TLS_DISABLED) && !defined(_WIN32)) +#define ENCRYPTION_ENABLED 1 +#else +#define ENCRYPTION_ENABLED 0 +#endif + +#if ENCRYPTION_ENABLED #include "flow/Arena.h" #include "flow/FastRef.h" @@ -81,4 +87,4 @@ public: StringRef finish(Arena&); }; -#endif // encryption enabled +#endif // ENCRYPTION_ENABLED