Merge branch 'develop' into feature/library_intermediate

This commit is contained in:
Sebastian Messmer 2019-01-24 13:13:44 -08:00
commit 6fff8c8030
19 changed files with 2 additions and 54 deletions

View File

@ -2,8 +2,6 @@
#ifndef MESSMER_BLOCKSTORE_IMPLEMENTATIONS_COMPRESSING_COMPRESSEDBLOCK_H_
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_COMPRESSING_COMPRESSEDBLOCK_H_
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "../../interface/Block.h"
#include "../../interface/BlockStore.h"
#include <cpp-utils/data/DataUtils.h>

View File

@ -1,4 +1,3 @@
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "Gzip.h"
#include <vendor_cryptopp/gzip.h>

View File

@ -3,7 +3,6 @@
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_ENCRYPTED_ENCRYPTEDBLOCKSTORE2_H_
#include "../../interface/BlockStore2.h"
#include "cpp-utils/crypto/cryptopp_byte.h"
#include <cpp-utils/macros.h>
#include <cpp-utils/crypto/symmetric/Cipher.h>
#include <cpp-utils/data/SerializationHelper.h>

View File

@ -1,18 +0,0 @@
#pragma once
#ifndef _CPPUTILS_CRYPTO_CRYPTOPP_BYTE_H
#define _CPPUTILS_CRYPTO_CRYPTOPP_BYTE_H
#include <vendor_cryptopp/cryptlib.h>
// If we're running an older CryptoPP version, CryptoPP::byte isn't defined yet.
// Define it. Refer to "byte" type in the global namespace (placed by CryptoPP).
// Could also use CRYPTOPP_NO_GLOBAL_BYTE - but don't want to track when it was
// introduced. This way seems more reliable, as it is compatible with more of
// the Crypto++ versions.
#if CRYPTOPP_VERSION < 600
namespace CryptoPP {
using byte = ::byte;
}
#endif /* CRYPTOPP_VERSION < 600 */
#endif /* _CPPUTILS_CRYPTO_CRYPTOPP_BYTE_H */

View File

@ -2,7 +2,6 @@
#ifndef MESSMER_CPPUTILS_CRYPTO_SYMMETRIC_CFBCIPHER_H_
#define MESSMER_CPPUTILS_CRYPTO_SYMMETRIC_CFBCIPHER_H_
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "../../data/FixedSizeData.h"
#include "../../data/Data.h"
#include "../../random/Random.h"

View File

@ -5,7 +5,6 @@
#include <cpp-utils/data/FixedSizeData.h>
#include <memory>
#include <cpp-utils/system/memory.h>
#include "../cryptopp_byte.h"
#include <cpp-utils/random/RandomGenerator.h>
namespace cpputils {

View File

@ -2,7 +2,6 @@
#ifndef MESSMER_CPPUTILS_CRYPTO_SYMMETRIC_GCMCIPHER_H_
#define MESSMER_CPPUTILS_CRYPTO_SYMMETRIC_GCMCIPHER_H_
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "../../data/FixedSizeData.h"
#include "../../data/Data.h"
#include "../../random/Random.h"

View File

@ -23,12 +23,8 @@ namespace cpputils {
DEFINE_CIPHER(Cast256_GCM);
DEFINE_CIPHER(Cast256_CFB);
#if CRYPTOPP_VERSION != 564
DEFINE_CIPHER(Mars448_GCM);
DEFINE_CIPHER(Mars448_CFB);
#else
# warning "You're using Crypto++ 5.6.4. In this version, the MARS-448 cipher is not available. Your CryFS executable will not be able to load file systems using this cipher. Please use Crypto++ 5.6.3 or 5.6.5+ instead."
#endif
DEFINE_CIPHER(Mars256_GCM);
DEFINE_CIPHER(Mars256_CFB);
DEFINE_CIPHER(Mars128_GCM);

View File

@ -41,11 +41,9 @@ static_assert(32 == CryptoPP::CAST256::MAX_KEYLENGTH, "If Cast offered larger ke
DECLARE_CIPHER(Cast256_GCM, "cast-256-gcm", GCM_Cipher, CryptoPP::CAST256, 32);
DECLARE_CIPHER(Cast256_CFB, "cast-256-cfb", CFB_Cipher, CryptoPP::CAST256, 32);
#if CRYPTOPP_VERSION != 564
static_assert(56 == CryptoPP::MARS::MAX_KEYLENGTH, "If Mars offered larger keys, we should offer a variant with it");
DECLARE_CIPHER(Mars448_GCM, "mars-448-gcm", GCM_Cipher, CryptoPP::MARS, 56);
DECLARE_CIPHER(Mars448_CFB, "mars-448-cfb", CFB_Cipher, CryptoPP::MARS, 56);
#endif
DECLARE_CIPHER(Mars256_GCM, "mars-256-gcm", GCM_Cipher, CryptoPP::MARS, 32);
DECLARE_CIPHER(Mars256_CFB, "mars-256-cfb", CFB_Cipher, CryptoPP::MARS, 32);
DECLARE_CIPHER(Mars128_GCM, "mars-128-gcm", GCM_Cipher, CryptoPP::MARS, 16);

View File

@ -2,7 +2,6 @@
#ifndef MESSMER_CPPUTILS_TEST_CRYPTO_SYMMETRIC_TESTUTILS_FAKEAUTHENTICATEDCIPHER_H_
#define MESSMER_CPPUTILS_TEST_CRYPTO_SYMMETRIC_TESTUTILS_FAKEAUTHENTICATEDCIPHER_H_
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "cpp-utils/crypto/symmetric/Cipher.h"
#include "cpp-utils/data/FixedSizeData.h"
#include "cpp-utils/data/Data.h"

View File

@ -1,7 +1,6 @@
#include "Data.h"
#include <stdexcept>
#include <vendor_cryptopp/hex.h>
#include <cpp-utils/crypto/cryptopp_byte.h>
using std::istream;
using std::ofstream;

View File

@ -2,7 +2,6 @@
#ifndef MESSMER_CPPUTILS_RANDOM_OSRANDOMGENERATOR_H
#define MESSMER_CPPUTILS_RANDOM_OSRANDOMGENERATOR_H
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "RandomGenerator.h"
#include <vendor_cryptopp/osrng.h>

View File

@ -1,4 +1,3 @@
#include "cpp-utils/crypto/cryptopp_byte.h"
#include "RandomGeneratorThread.h"
namespace cpputils {

View File

@ -73,10 +73,8 @@ const vector<shared_ptr<CryCipher>> CryCiphers::SUPPORTED_CIPHERS = {
make_shared<CryCipherInstance<Serpent128_CFB>>(INTEGRITY_WARNING),
make_shared<CryCipherInstance<Cast256_GCM>>(),
make_shared<CryCipherInstance<Cast256_CFB>>(INTEGRITY_WARNING),
#if CRYPTOPP_VERSION != 564
make_shared<CryCipherInstance<Mars448_GCM>>(),
make_shared<CryCipherInstance<Mars448_CFB>>(INTEGRITY_WARNING),
#endif
make_shared<CryCipherInstance<Mars256_GCM>>(),
make_shared<CryCipherInstance<Mars256_CFB>>(INTEGRITY_WARNING),
make_shared<CryCipherInstance<Mars128_GCM>>(),

View File

@ -1,4 +1,3 @@
#include "cpp-utils/crypto/cryptopp_byte.h"
#include <gtest/gtest.h>
#include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h"
#include "blockstore/implementations/encrypted/EncryptedBlockStore2.h"

View File

@ -1,4 +1,3 @@
#include "cpp-utils/crypto/cryptopp_byte.h"
#include <gtest/gtest.h>
#include "cpp-utils/crypto/symmetric/Cipher.h"
#include "cpp-utils/crypto/symmetric/ciphers.h"
@ -253,11 +252,9 @@ INSTANTIATE_TYPED_TEST_CASE_P(Cast256_CFB, CipherTest, Cast256_CFB); //CFB mode
INSTANTIATE_TYPED_TEST_CASE_P(Cast256_GCM, CipherTest, Cast256_GCM);
INSTANTIATE_TYPED_TEST_CASE_P(Cast256_GCM, AuthenticatedCipherTest, Cast256_GCM);
#if CRYPTOPP_VERSION != 564
INSTANTIATE_TYPED_TEST_CASE_P(Mars448_CFB, CipherTest, Mars448_CFB); //CFB mode is not authenticated
INSTANTIATE_TYPED_TEST_CASE_P(Mars448_GCM, CipherTest, Mars448_GCM);
INSTANTIATE_TYPED_TEST_CASE_P(Mars448_GCM, AuthenticatedCipherTest, Mars448_GCM);
#endif
INSTANTIATE_TYPED_TEST_CASE_P(Mars256_CFB, CipherTest, Mars256_CFB); //CFB mode is not authenticated
INSTANTIATE_TYPED_TEST_CASE_P(Mars256_GCM, CipherTest, Mars256_GCM);
INSTANTIATE_TYPED_TEST_CASE_P(Mars256_GCM, AuthenticatedCipherTest, Mars256_GCM);
@ -286,10 +283,9 @@ TEST(CipherNameTest, TestCipherNames) {
EXPECT_EQ("cast-256-gcm", string(Cast256_GCM::NAME));
EXPECT_EQ("cast-256-cfb", string(Cast256_CFB::NAME));
#if CRYPTOPP_VERSION != 564
EXPECT_EQ("mars-448-gcm", string(Mars448_GCM::NAME));
EXPECT_EQ("mars-448-cfb", string(Mars448_CFB::NAME));
#endif
EXPECT_EQ("mars-256-gcm", string(Mars256_GCM::NAME));
EXPECT_EQ("mars-256-cfb", string(Mars256_CFB::NAME));
EXPECT_EQ("mars-128-gcm", string(Mars128_GCM::NAME));

View File

@ -1,4 +1,3 @@
#include "cpp-utils/crypto/cryptopp_byte.h"
#include <gtest/gtest.h>
#include <vector>
#include <boost/filesystem.hpp>

View File

@ -77,10 +77,7 @@ TEST_F(CryCipherTest, FindsCorrectCipher) {
"aes-256-gcm", "aes-256-cfb", "aes-256-gcm", "aes-256-cfb",
"twofish-256-gcm", "twofish-256-cfb", "twofish-256-gcm", "twofish-256-cfb",
"serpent-256-gcm", "serpent-256-cfb", "serpent-256-gcm", "serpent-256-cfb",
"cast-256-gcm", "cast-256-cfb",
#if CRYPTOPP_VERSION != 564
"mars-448-gcm", "mars-448-cfb",
#endif
"cast-256-gcm", "cast-256-cfb", "mars-448-gcm", "mars-448-cfb",
"mars-256-gcm", "mars-256-cfb", "mars-256-gcm", "mars-256-cfb"
});
}
@ -100,10 +97,8 @@ TEST_F(CryCipherTest, CreatesCorrectEncryptedBlockStore) {
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Serpent128_CFB>("serpent-128-cfb");
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Cast256_GCM>("cast-256-gcm");
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Cast256_CFB>("cast-256-cfb");
#if CRYPTOPP_VERSION != 564
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Mars448_GCM>("mars-448-gcm");
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Mars448_CFB>("mars-448-cfb");
#endif
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Mars256_GCM>("mars-256-gcm");
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Mars256_CFB>("mars-256-cfb");
EXPECT_CREATES_CORRECT_ENCRYPTED_BLOCKSTORE<Mars128_GCM>("mars-128-gcm");
@ -123,11 +118,9 @@ TEST_F(CryCipherTest, ThereIsACipherWithIntegrityWarning) {
EXPECT_THAT(CryCiphers::find("aes-256-cfb").warning().value(), MatchesRegex(".*integrity.*"));
}
#if CRYPTOPP_VERSION != 564
TEST_F(CryCipherTest, EncryptionKeyHasCorrectSize_448) {
EXPECT_EQ(Mars448_GCM::STRING_KEYSIZE, CryCiphers::find("mars-448-gcm").createKey(Random::PseudoRandom()).size());
}
#endif
TEST_F(CryCipherTest, EncryptionKeyHasCorrectSize_256) {
EXPECT_EQ(AES256_GCM::STRING_KEYSIZE, CryCiphers::find("aes-256-gcm").createKey(Random::PseudoRandom()).size());

View File

@ -155,7 +155,6 @@ TEST_F(CryConfigCreatorTest, ChoosesEmptyRootBlobId) {
EXPECT_EQ("", config.RootBlob()); // This tells CryFS to create a new root blob
}
#if CRYPTOPP_VERSION != 564
TEST_F(CryConfigCreatorTest, ChoosesValidEncryptionKey_448) {
AnswerNoToDefaultSettings();
IGNORE_ASK_FOR_MISSINGBLOCKISINTEGRITYVIOLATION();
@ -163,7 +162,6 @@ TEST_F(CryConfigCreatorTest, ChoosesValidEncryptionKey_448) {
CryConfig config = creator.create(none, none, none, false).config;
cpputils::Mars448_GCM::EncryptionKey::FromString(config.EncryptionKey()); // This crashes if invalid
}
#endif
TEST_F(CryConfigCreatorTest, ChoosesValidEncryptionKey_256) {
AnswerNoToDefaultSettings();