Added ENCRYPTION_ENABLED macro

This commit is contained in:
sfc-gh-tclinkenbeard 2021-07-09 21:20:40 -07:00
parent ad03a4787a
commit 41b4ace19a
5 changed files with 18 additions and 11 deletions

View File

@ -170,7 +170,7 @@ public:
}
Reference<IAsyncFile> f =
makeReference<ReadFile>(self->asyncTaskThread, self->containerName, fileName, self->client.get());
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTION_ENABLED
if (self->usesEncryption()) {
f = makeReference<AsyncFileEncrypted>(f, false);
}
@ -185,7 +185,7 @@ public:
return Void();
}));
auto f = makeReference<WriteFile>(self->asyncTaskThread, self->containerName, fileName, self->client.get());
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTED_ENABLED
if (self->usesEncryption()) {
f = makeReference<AsyncFileEncrypted>(f, true);
}

View File

@ -1127,7 +1127,7 @@ public:
return false;
}
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTION_ENABLED
ACTOR static Future<Void> createTestEncryptionKeyFile(std::string filename) {
state Reference<IAsyncFile> 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<Reference<IBackupFile>> BackupContainerFileSystem::writeLogFile(Version beginVersion,
@ -1479,7 +1480,7 @@ Future<Void> BackupContainerFileSystem::encryptionSetupComplete() const {
}
void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> 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<std::string> const& en
}
}
Future<Void> BackupContainerFileSystem::createTestEncryptionKeyFile(std::string const &filename) {
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTION_ENABLED
return BackupContainerFileSystemImpl::createTestEncryptionKeyFile(filename);
#else
return Void();

View File

@ -171,7 +171,7 @@ std::string BackupContainerS3BlobStore::getURLFormat() {
Future<Reference<IAsyncFile>> BackupContainerS3BlobStore::readFile(const std::string& path) {
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreRead>(m_bstore, m_bucket, dataPath(path));
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTED_ENABLED
if (usesEncryption()) {
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::READ_ONLY);
}
@ -191,7 +191,7 @@ Future<std::vector<std::string>> BackupContainerS3BlobStore::listURLs(Reference<
Future<Reference<IBackupFile>> BackupContainerS3BlobStore::writeFile(const std::string& path) {
Reference<IAsyncFile> f = makeReference<AsyncFileS3BlobStoreWrite>(m_bstore, m_bucket, dataPath(path));
#if (!defined(TLS_DISABLED) && !defined(_WIN32))
#if ENCRYPTION_ENABLED
if (usesEncryption()) {
f = makeReference<AsyncFileEncrypted>(f, AsyncFileEncrypted::Mode::APPEND_ONLY);
}

View File

@ -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

View File

@ -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