Moved crypto classes to cpputils

This commit is contained in:
Sebastian Messmer 2015-10-27 22:19:40 +01:00
parent d8ed751039
commit 340bbf842e
22 changed files with 21 additions and 447 deletions

View File

@ -10,7 +10,6 @@
messmer/fspp: 1
messmer/gitversion: 6
messmer/parallelaccessstore: 1
messmer/scrypt: 0
[parent]
messmer/cryfs: 3

View File

@ -5,7 +5,6 @@
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include "CryConfig.h"
#include "crypto/kdf/Scrypt.h"
#include <messmer/blockstore/implementations/encrypted/ciphers/ciphers.h>
#include "crypto/CryConfigEncryptorFactory.h"

View File

@ -7,7 +7,7 @@
#include "CryConfigFile.h"
#include "CryCipher.h"
#include "CryConfigCreator.h"
#include "crypto/kdf/Scrypt.h"
#include <messmer/cpp-utils/crypto/kdf/Scrypt.h>
namespace cryfs {
@ -16,7 +16,7 @@ public:
CryConfigLoader(cpputils::unique_ref<cpputils::Console> console, cpputils::RandomGenerator &keyGenerator, std::function<std::string()> askPassword);
CryConfigLoader(CryConfigLoader &&rhs) = default;
template<class SCryptSettings = SCryptDefaultSettings>
template<class SCryptSettings = cpputils::SCryptDefaultSettings>
boost::optional<CryConfigFile> loadOrCreate(const boost::filesystem::path &filename);
private:

View File

@ -4,9 +4,9 @@
#include <messmer/cpp-utils/data/Serializer.h>
#include <messmer/cpp-utils/data/Deserializer.h>
#include "RandomPadding.h"
#include "InnerEncryptor.h"
#include "kdf/DerivedKey.h"
#include <messmer/cpp-utils/crypto/RandomPadding.h>
#include <messmer/cpp-utils/crypto/kdf/DerivedKey.h>
namespace cryfs {
//TODO Test
@ -43,7 +43,7 @@ namespace cryfs {
if (decrypted == boost::none) {
return boost::none;
}
auto configData = RandomPadding::remove(*decrypted);
auto configData = cpputils::RandomPadding::remove(*decrypted);
if (configData == boost::none) {
return boost::none;
}
@ -71,7 +71,7 @@ namespace cryfs {
template<class Cipher>
cpputils::Data ConcreteInnerEncryptor<Cipher>::encrypt(const cpputils::Data &plaintext) const {
auto paddedPlaintext = RandomPadding::add(plaintext, CONFIG_SIZE);
auto paddedPlaintext = cpputils::RandomPadding::add(plaintext, CONFIG_SIZE);
auto encrypted = Cipher::encrypt(static_cast<const uint8_t*>(paddedPlaintext.data()), paddedPlaintext.size(), _key);
return _serialize(encrypted);
}

View File

@ -1,11 +1,13 @@
#include "CryConfigEncryptor.h"
#include "RandomPadding.h"
#include <messmer/cpp-utils/crypto/RandomPadding.h>
using std::string;
using cpputils::Deserializer;
using cpputils::Serializer;
using cpputils::unique_ref;
using cpputils::Data;
using cpputils::RandomPadding;
using cpputils::DerivedKeyConfig;
using boost::optional;
using boost::none;
using namespace cpputils::logging;

View File

@ -6,7 +6,7 @@
#include <messmer/cpp-utils/data/Deserializer.h>
#include <messmer/cpp-utils/data/Serializer.h>
#include "InnerEncryptor.h"
#include "kdf/DerivedKeyConfig.h"
#include <messmer/cpp-utils/crypto/kdf/DerivedKeyConfig.h>
#include <messmer/blockstore/implementations/encrypted/ciphers/ciphers.h>
namespace cryfs {
@ -20,7 +20,7 @@ namespace cryfs {
using OuterCipher = blockstore::encrypted::AES256_GCM;
static constexpr size_t CONFIG_SIZE = 1024; // Config data is grown to this size before encryption to hide its actual size
CryConfigEncryptor(cpputils::unique_ref<InnerEncryptor> innerEncryptor, OuterCipher::EncryptionKey outerKey, DerivedKeyConfig keyConfig);
CryConfigEncryptor(cpputils::unique_ref<InnerEncryptor> innerEncryptor, OuterCipher::EncryptionKey outerKey, cpputils::DerivedKeyConfig keyConfig);
cpputils::Data encrypt(const cpputils::Data &plaintext);
boost::optional <cpputils::Data> decrypt(const cpputils::Data &plaintext);
@ -35,7 +35,7 @@ namespace cryfs {
cpputils::unique_ref<InnerEncryptor> _innerEncryptor;
OuterCipher::EncryptionKey _outerKey;
DerivedKeyConfig _keyConfig;
cpputils::DerivedKeyConfig _keyConfig;
static const std::string HEADER;
};

View File

@ -5,7 +5,7 @@
#include "ConcreteInnerEncryptor.h"
#include "CryConfigEncryptor.h"
#include <messmer/cpp-utils/pointer/unique_ref.h>
#include "kdf/Scrypt.h"
#include <messmer/cpp-utils/crypto/kdf/Scrypt.h>
namespace cryfs {
//TODO Test
@ -22,7 +22,7 @@ namespace cryfs {
template<class Cipher> static constexpr size_t TotalKeySize();
template<class Cipher>
static DerivedKey<CryConfigEncryptor::OuterCipher::EncryptionKey::BINARY_LENGTH + Cipher::EncryptionKey::BINARY_LENGTH>
static cpputils::DerivedKey<CryConfigEncryptor::OuterCipher::EncryptionKey::BINARY_LENGTH + Cipher::EncryptionKey::BINARY_LENGTH>
_loadKey(cpputils::Deserializer *deserializer, const std::string &password);
};
@ -32,7 +32,7 @@ namespace cryfs {
template<class Cipher, class SCryptConfig>
cpputils::unique_ref<CryConfigEncryptor> CryConfigEncryptorFactory::deriveKey(const std::string &password, const std::string &cipherName) {
auto derivedKey = SCrypt().generateKey<TotalKeySize<Cipher>(), SCryptConfig>(password);
auto derivedKey = cpputils::SCrypt().generateKey<TotalKeySize<Cipher>(), SCryptConfig>(password);
auto outerKey = derivedKey.key().template take<OuterKeySize>();
auto innerKey = derivedKey.key().template drop<OuterKeySize>();
return cpputils::make_unique_ref<CryConfigEncryptor>(
@ -43,14 +43,14 @@ namespace cryfs {
}
template<class Cipher>
DerivedKey<CryConfigEncryptor::OuterCipher::EncryptionKey::BINARY_LENGTH + Cipher::EncryptionKey::BINARY_LENGTH>
cpputils::DerivedKey<CryConfigEncryptor::OuterCipher::EncryptionKey::BINARY_LENGTH + Cipher::EncryptionKey::BINARY_LENGTH>
CryConfigEncryptorFactory::_loadKey(cpputils::Deserializer *deserializer, const std::string &password) {
auto keyConfig = DerivedKeyConfig::load(deserializer);
auto keyConfig = cpputils::DerivedKeyConfig::load(deserializer);
//TODO This is only kept here to recognize when this is run in tests. After tests are faster, replace this with something in main(), saying something like "Loading configuration file..."
std::cout << "Deriving secure key for config file..." << std::flush;
auto key = SCrypt().generateKeyFromConfig<TotalKeySize<Cipher>()>(password, keyConfig);
auto key = cpputils::SCrypt().generateKeyFromConfig<TotalKeySize<Cipher>()>(password, keyConfig);
std::cout << "done" << std::endl;
return DerivedKey<TotalKeySize<Cipher>()>(std::move(keyConfig), std::move(key));
return cpputils::DerivedKey<TotalKeySize<Cipher>()>(std::move(keyConfig), std::move(key));
}
}

View File

@ -1,34 +0,0 @@
#include "RandomPadding.h"
#include <messmer/cpp-utils/logging/logging.h>
#include <messmer/cpp-utils/random/Random.h>
using cpputils::Data;
using cpputils::Random;
using boost::optional;
using namespace cpputils::logging;
namespace cryfs {
Data RandomPadding::add(const Data &data, size_t targetSize) {
uint32_t size = data.size();
ASSERT(size < targetSize - sizeof(size), "Config data too large. We should increase padding target size.");
Data randomData = Random::PseudoRandom().get(targetSize-sizeof(size)-size);
ASSERT(sizeof(size) + size + randomData.size() == targetSize, "Calculated size of randomData incorrectly");
Data result(targetSize);
std::memcpy(reinterpret_cast<char*>(result.data()), &size, sizeof(size));
std::memcpy(reinterpret_cast<char*>(result.dataOffset(sizeof(size))), reinterpret_cast<const char*>(data.data()), size);
std::memcpy(reinterpret_cast<char*>(result.dataOffset(sizeof(size)+size)), reinterpret_cast<const char*>(randomData.data()), randomData.size());
return result;
}
optional<Data> RandomPadding::remove(const Data &data) {
uint32_t size;
std::memcpy(&size, reinterpret_cast<const char*>(data.data()), sizeof(size));
if(sizeof(size) + size >= data.size()) {
LOG(ERROR) << "Config file is invalid: Invalid padding.";
return boost::none;
};
Data result(size);
std::memcpy(reinterpret_cast<char*>(result.data()), reinterpret_cast<const char*>(data.dataOffset(sizeof(size))), size);
return std::move(result);
}
}

View File

@ -1,17 +0,0 @@
#pragma once
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYPTO_PADDING_H
#define MESSMER_CRYFS_SRC_CONFIG_CRYPTO_PADDING_H
#include <messmer/cpp-utils/data/Data.h>
#include <boost/optional.hpp>
namespace cryfs {
//TODO Test
class RandomPadding {
public:
static cpputils::Data add(const cpputils::Data &data, size_t targetSize);
static boost::optional<cpputils::Data> remove(const cpputils::Data &data);
};
}
#endif

View File

@ -1 +0,0 @@
#include "DerivedKey.h"

View File

@ -1,39 +0,0 @@
#pragma once
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_DERIVEDKEY_H
#define MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_DERIVEDKEY_H
#include <messmer/cpp-utils/data/FixedSizeData.h>
#include "DerivedKeyConfig.h"
namespace cryfs {
template<size_t KEY_LENGTH>
class DerivedKey {
public:
DerivedKey(DerivedKeyConfig config, const cpputils::FixedSizeData<KEY_LENGTH> &key): _config(std::move(config)), _key(key) {}
DerivedKey(DerivedKey &&rhs) = default;
const DerivedKeyConfig &config() const {
return _config;
}
DerivedKeyConfig moveOutConfig() {
return std::move(_config);
}
const cpputils::FixedSizeData<KEY_LENGTH> &key() const {
return _key;
}
cpputils::FixedSizeData<KEY_LENGTH> moveOutKey() {
return std::move(_key);
}
private:
DerivedKeyConfig _config;
cpputils::FixedSizeData<KEY_LENGTH> _key;
DISALLOW_COPY_AND_ASSIGN(DerivedKey);
};
}
#endif

View File

@ -1,33 +0,0 @@
#include "DerivedKeyConfig.h"
#include <messmer/cpp-utils/assert/assert.h>
#include <messmer/cpp-utils/logging/logging.h>
using std::istream;
using std::ostream;
using cpputils::Data;
using cpputils::Serializer;
using cpputils::Deserializer;
using boost::optional;
using boost::none;
using namespace cpputils::logging;
namespace cryfs {
void DerivedKeyConfig::serialize(Serializer *target) const {
target->writeData(_salt);
target->writeUint64(_N);
target->writeUint32(_r);
target->writeUint32(_p);
}
size_t DerivedKeyConfig::serializedSize() const {
return Serializer::DataSize(_salt) + sizeof(uint64_t) + sizeof(uint32_t) + sizeof(uint32_t);
}
DerivedKeyConfig DerivedKeyConfig::load(Deserializer *source) {
Data salt = source->readData();
uint64_t N = source->readUint64();
uint32_t r = source->readUint32();
uint32_t p = source->readUint32();
return DerivedKeyConfig(std::move(salt), N, r, p);
}
}

View File

@ -1,51 +0,0 @@
#pragma once
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_KEYCONFIG_H
#define MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_KEYCONFIG_H
#include <messmer/cpp-utils/data/Data.h>
#include <messmer/cpp-utils/data/Serializer.h>
#include <messmer/cpp-utils/data/Deserializer.h>
#include <iostream>
namespace cryfs {
class DerivedKeyConfig {
public:
DerivedKeyConfig(cpputils::Data salt, uint64_t N, uint32_t r, uint32_t p)
: _salt(std::move(salt)),
_N(N), _r(r), _p(p) { }
DerivedKeyConfig(DerivedKeyConfig &&rhs) = default;
const cpputils::Data &salt() const {
return _salt;
}
size_t N() const {
return _N;
}
size_t r() const {
return _r;
}
size_t p() const {
return _p;
}
void serialize(cpputils::Serializer *destination) const;
size_t serializedSize() const;
static DerivedKeyConfig load(cpputils::Deserializer *source);
private:
cpputils::Data _salt;
uint64_t _N;
uint32_t _r;
uint32_t _p;
};
}
#endif

View File

@ -1,13 +0,0 @@
#include "Scrypt.h"
namespace cryfs {
constexpr size_t SCryptDefaultSettings::SALT_LEN;
constexpr uint64_t SCryptDefaultSettings::N;
constexpr uint32_t SCryptDefaultSettings::r;
constexpr uint32_t SCryptDefaultSettings::p;
constexpr size_t SCryptParanoidSettings::SALT_LEN;
constexpr uint64_t SCryptParanoidSettings::N;
constexpr uint32_t SCryptParanoidSettings::r;
constexpr uint32_t SCryptParanoidSettings::p;
}

View File

@ -1,57 +0,0 @@
#pragma once
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_SCRYPT_H
#define MESSMER_CRYFS_SRC_CONFIG_CRYPTO_KDF_SCRYPT_H
#include <messmer/cpp-utils/macros.h>
#include <messmer/cpp-utils/random/Random.h>
extern "C" {
#include <messmer/scrypt/lib/crypto/crypto_scrypt.h>
}
#include <stdexcept>
#include "DerivedKey.h"
namespace cryfs {
struct SCryptParanoidSettings {
constexpr static size_t SALT_LEN = 32; // Size of the salt
constexpr static uint64_t N = 1048576; // CPU/Memory cost
constexpr static uint32_t r = 8; // Blocksize
constexpr static uint32_t p = 16; // Parallelization
};
struct SCryptDefaultSettings {
constexpr static size_t SALT_LEN = 32; // Size of the salt
constexpr static uint64_t N = 524288; // CPU/Memory cost
constexpr static uint32_t r = 1; // Blocksize
constexpr static uint32_t p = 1; // Parallelization
};
class SCrypt {
public:
SCrypt() {}
template<size_t KEYSIZE, class Settings = SCryptDefaultSettings> DerivedKey<KEYSIZE> generateKey(const std::string &password) {
auto salt = cpputils::Random::PseudoRandom().get(Settings::SALT_LEN);
auto config = DerivedKeyConfig(std::move(salt), Settings::N, Settings::r, Settings::p);
auto key = generateKeyFromConfig<KEYSIZE>(password, config);
return DerivedKey<KEYSIZE>(std::move(config), key);
}
template<size_t KEYSIZE> cpputils::FixedSizeData<KEYSIZE> generateKeyFromConfig(const std::string &password, const DerivedKeyConfig &config) {
auto key = cpputils::FixedSizeData<KEYSIZE>::Null();
int errorcode = crypto_scrypt(reinterpret_cast<const uint8_t*>(password.c_str()), password.size(),
reinterpret_cast<const uint8_t*>(config.salt().data()), config.salt().size(),
config.N(), config.r(), config.p(),
static_cast<uint8_t*>(key.data()), KEYSIZE);
if (errorcode != 0) {
throw std::runtime_error("Error running scrypt key derivation.");
}
return key;
}
private:
DISALLOW_COPY_AND_ASSIGN(SCrypt);
};
}
#endif

View File

@ -3,7 +3,7 @@
#include "../../src/config/CryConfigFile.h"
#include <messmer/cpp-utils/tempfile/TempFile.h>
#include <boost/optional/optional_io.hpp>
#include "testutils/SCryptTestSettings.h"
#include <messmer/cpp-utils/test/crypto/testutils/SCryptTestSettings.h>
using namespace cryfs;
using cpputils::TempFile;

View File

@ -4,7 +4,7 @@
#include <messmer/cpp-utils/tempfile/TempFile.h>
#include <messmer/cpp-utils/random/Random.h>
#include <messmer/blockstore/implementations/encrypted/ciphers/ciphers.h>
#include "testutils/SCryptTestSettings.h"
#include <messmer/cpp-utils/test/crypto/testutils/SCryptTestSettings.h>
using cpputils::unique_ref;
using cpputils::make_unique_ref;

View File

@ -1,90 +0,0 @@
#include <google/gtest/gtest.h>
#include "../../../../src/config/crypto/kdf/DerivedKeyConfig.h"
#include <messmer/cpp-utils/data/DataFixture.h>
#include <sstream>
using namespace cryfs;
using cpputils::DataFixture;
using cpputils::Data;
using cpputils::Serializer;
using cpputils::Deserializer;
class DerivedKeyConfigTest : public ::testing::Test {
public:
DerivedKeyConfig SaveAndLoad(const DerivedKeyConfig &source) {
Serializer serializer(source.serializedSize());
source.serialize(&serializer);
Data serialized = serializer.finished();
Deserializer deserializer(&serialized);
return DerivedKeyConfig::load(&deserializer);
}
};
TEST_F(DerivedKeyConfigTest, Salt) {
DerivedKeyConfig cfg(DataFixture::generate(32), 0, 0, 0);
EXPECT_EQ(DataFixture::generate(32), cfg.salt());
}
TEST_F(DerivedKeyConfigTest, Salt_Move) {
DerivedKeyConfig cfg(DataFixture::generate(32), 0, 0, 0);
DerivedKeyConfig moved = std::move(cfg);
EXPECT_EQ(DataFixture::generate(32), moved.salt());
}
TEST_F(DerivedKeyConfigTest, Salt_SaveAndLoad) {
DerivedKeyConfig cfg(DataFixture::generate(32), 0, 0, 0);
DerivedKeyConfig loaded = SaveAndLoad(cfg);
EXPECT_EQ(DataFixture::generate(32), loaded.salt());
}
TEST_F(DerivedKeyConfigTest, N) {
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
EXPECT_EQ(1024, cfg.N());
}
TEST_F(DerivedKeyConfigTest, N_Move) {
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
DerivedKeyConfig moved = std::move(cfg);
EXPECT_EQ(1024, moved.N());
}
TEST_F(DerivedKeyConfigTest, N_SaveAndLoad) {
DerivedKeyConfig cfg(Data(0), 1024, 0, 0);
DerivedKeyConfig loaded = SaveAndLoad(cfg);
EXPECT_EQ(1024, loaded.N());
}
TEST_F(DerivedKeyConfigTest, r) {
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
EXPECT_EQ(8, cfg.r());
}
TEST_F(DerivedKeyConfigTest, r_Move) {
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
DerivedKeyConfig moved = std::move(cfg);
EXPECT_EQ(8, moved.r());
}
TEST_F(DerivedKeyConfigTest, r_SaveAndLoad) {
DerivedKeyConfig cfg(Data(0), 0, 8, 0);
DerivedKeyConfig loaded = SaveAndLoad(cfg);
EXPECT_EQ(8, loaded.r());
}
TEST_F(DerivedKeyConfigTest, p) {
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
EXPECT_EQ(16, cfg.p());
}
TEST_F(DerivedKeyConfigTest, p_Move) {
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
DerivedKeyConfig moved = std::move(cfg);
EXPECT_EQ(16, moved.p());
}
TEST_F(DerivedKeyConfigTest, p_SaveAndLoad) {
DerivedKeyConfig cfg(Data(0), 0, 0, 16);
DerivedKeyConfig loaded = SaveAndLoad(cfg);
EXPECT_EQ(16, loaded.p());
}

View File

@ -1,20 +0,0 @@
#include <google/gtest/gtest.h>
#include "../../../../src/config/crypto/kdf/DerivedKey.h"
#include <messmer/cpp-utils/data/DataFixture.h>
using namespace cryfs;
using cpputils::DataFixture;
using cpputils::Data;
TEST(DerivedKeyTest, Config) {
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));
EXPECT_EQ(DataFixture::generate(32, 1), key.config().salt());
EXPECT_EQ(1024, key.config().N());
EXPECT_EQ(8, key.config().r());
EXPECT_EQ(16, key.config().p());
}
TEST(DerivedKeyTest, Key) {
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));
EXPECT_EQ(DataFixture::generateFixedSize<32>(2), key.key());
}

View File

@ -1,51 +0,0 @@
#include <google/gtest/gtest.h>
#include "../../../../src/config/crypto/kdf/Scrypt.h"
#include "../../testutils/SCryptTestSettings.h"
using namespace cryfs;
TEST(SCryptTest, GeneratedKeyIsReproductible_448) {
auto created = SCrypt().generateKey<56, SCryptTestSettings>("mypassword");
auto recreated = SCrypt().generateKeyFromConfig<56>("mypassword", created.config());
EXPECT_EQ(created.key(), recreated);
}
TEST(SCryptTest, GeneratedKeyIsReproductible_256) {
auto created = SCrypt().generateKey<32, SCryptTestSettings>("mypassword");
auto recreated = SCrypt().generateKeyFromConfig<32>("mypassword", created.config());
EXPECT_EQ(created.key(), recreated);
}
TEST(SCryptTest, GeneratedKeyIsReproductible_128) {
auto created = SCrypt().generateKey<16, SCryptTestSettings>("mypassword");
auto recreated = SCrypt().generateKeyFromConfig<16>("mypassword", created.config());
EXPECT_EQ(created.key(), recreated);
}
TEST(SCryptTest, GeneratedKeyIsReproductible_DefaultSettings) {
auto created = SCrypt().generateKey<16>("mypassword");
auto recreated = SCrypt().generateKeyFromConfig<16>("mypassword", created.config());
EXPECT_EQ(created.key(), recreated);
}
TEST(SCryptTest, DifferentPasswordResultsInDifferentKey) {
auto created = SCrypt().generateKey<16, SCryptTestSettings>("mypassword");
auto recreated = SCrypt().generateKeyFromConfig<16>("mypassword2", created.config());
EXPECT_NE(created.key(), recreated);
}
TEST(SCryptTest, UsesCorrectSettings) {
auto created = SCrypt().generateKey<16, SCryptTestSettings>("mypassword");
EXPECT_EQ(SCryptTestSettings::SALT_LEN, created.config().salt().size());
EXPECT_EQ(SCryptTestSettings::N, created.config().N());
EXPECT_EQ(SCryptTestSettings::r, created.config().r());
EXPECT_EQ(SCryptTestSettings::p, created.config().p());
}
TEST(SCryptTest, UsesCorrectDefaultSettings) {
auto created = SCrypt().generateKey<16>("mypassword");
EXPECT_EQ(SCryptDefaultSettings::SALT_LEN, created.config().salt().size());
EXPECT_EQ(SCryptDefaultSettings::N, created.config().N());
EXPECT_EQ(SCryptDefaultSettings::r, created.config().r());
EXPECT_EQ(SCryptDefaultSettings::p, created.config().p());
}

View File

@ -1,6 +0,0 @@
#include "SCryptTestSettings.h"
constexpr size_t SCryptTestSettings::SALT_LEN;
constexpr uint64_t SCryptTestSettings::N;
constexpr uint32_t SCryptTestSettings::r;
constexpr uint32_t SCryptTestSettings::p;

View File

@ -1,14 +0,0 @@
#ifndef MESSMER_CRYFS_TEST_CONFIG_CRYPTO_TESTUTILS_SCRYPTTESTSETTINGS_H
#define MESSMER_CRYFS_TEST_CONFIG_CRYPTO_TESTUTILS_SCRYPTTESTSETTINGS_H
#include <cstddef>
#include <cstdint>
struct SCryptTestSettings {
constexpr static size_t SALT_LEN = 32; // Size of the salt
constexpr static uint64_t N = 1024; // CPU/Memory cost
constexpr static uint32_t r = 1; // Blocksize
constexpr static uint32_t p = 1; // Parallelization
};
#endif