GCryptLib: Fix include paths

This commit is contained in:
Leonetienne 2022-05-16 22:35:28 +02:00
parent 9432325b4a
commit 7fe9dcc6dc
No known key found for this signature in database
GPG Key ID: C33879CD92E9708C
16 changed files with 483 additions and 455 deletions

View File

@ -1,8 +1,8 @@
#include <iostream>
#include <GhettoCryptWrapper.h>
#include <SecureBitset.h>
#include <Util.h>
#include <InitializationVector.h>
#include <GCrypt/GhettoCryptWrapper.h>
#include <GCrypt/SecureBitset.h>
#include <GCrypt/Util.h>
#include <GCrypt/InitializationVector.h>
using namespace Leonetienne::GCrypt;

View File

@ -1,6 +1,6 @@
#pragma once
#include "SecureBitset.h"
#include "Config.h"
#include "GCrypt/SecureBitset.h"
#include "GCrypt/Config.h"
namespace Leonetienne::GCrypt {
typedef SecureBitset<BLOCK_SIZE> Block;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Feistel.h"
#include "Flexblock.h"
#include "GCrypt/Feistel.h"
#include "GCrypt/Flexblock.h"
namespace Leonetienne::GCrypt {
/** Class to apply a block cipher to messages of arbitrary length in a distributed manner

View File

@ -1,7 +1,7 @@
#pragma once
#include "Keyset.h"
#include "Block.h"
#include "Halfblock.h"
#include "GCrypt/Keyset.h"
#include "GCrypt/Block.h"
#include "GCrypt/Halfblock.h"
namespace Leonetienne::GCrypt {
/** Class to perform a feistel block chipher

View File

@ -1,7 +1,7 @@
#pragma once
#include "SecureBitset.h"
#include <cstdint>
#include "Config.h"
#include "GCrypt/SecureBitset.h"
#include "GCrypt/Config.h"
namespace Leonetienne::GCrypt {
constexpr std::size_t HALFBLOCK_SIZE = (BLOCK_SIZE / 2);

View File

@ -1,6 +1,6 @@
#pragma once
#include "Config.h"
#include "Block.h"
#include "GCrypt/Config.h"
#include "GCrypt/Block.h"
namespace Leonetienne::GCrypt {
/** Will create a sudo-random Block based on a seed

View File

@ -1,7 +1,7 @@
#pragma once
#include <array>
#include "Block.h"
#include "Config.h"
#include "GCrypt/Block.h"
#include "GCrypt/Config.h"
namespace Leonetienne::GCrypt {
typedef std::array<Block, N_ROUNDS> Keyset;

View File

@ -3,12 +3,12 @@
#include <sstream>
#include <fstream>
#include <cstring>
#include "SecureBitset.h"
#include "Block.h"
#include "Flexblock.h"
#include "Config.h"
#include "Cipher.h"
#include "InitializationVector.h"
#include "GCrypt/SecureBitset.h"
#include "GCrypt/Block.h"
#include "GCrypt/Flexblock.h"
#include "GCrypt/Config.h"
#include "GCrypt/Cipher.h"
#include "GCrypt/InitializationVector.h"
namespace Leonetienne::GCrypt {
//! Mod-operator that works with negative values

View File

@ -1,8 +1,8 @@
#include <iostream>
#include <vector>
#include "Cipher.h"
#include "Util.h"
#include "InitializationVector.h"
#include "GCrypt/Cipher.h"
#include "GCrypt/Util.h"
#include "GCrypt/InitializationVector.h"
namespace Leonetienne::GCrypt {

View File

@ -1,7 +1,7 @@
#include <unordered_map>
#include "Feistel.h"
#include "Util.h"
#include "Config.h"
#include "GCrypt/Feistel.h"
#include "GCrypt/Util.h"
#include "GCrypt/Config.h"
namespace Leonetienne::GCrypt {

View File

@ -1,6 +1,6 @@
#include "GhettoCryptWrapper.h"
#include "Cipher.h"
#include "Util.h"
#include "GCrypt/GhettoCryptWrapper.h"
#include "GCrypt/Cipher.h"
#include "GCrypt/Util.h"
namespace Leonetienne::GCrypt {

View File

@ -1,5 +1,5 @@
#include "InitializationVector.h"
#include "Feistel.h"
#include "GCrypt/InitializationVector.h"
#include "GCrypt/Feistel.h"
namespace Leonetienne::GCrypt {

View File

@ -1,3 +1,4 @@
/*
#include "CppUnitTest.h"
#include "../GhettoCrypt/Cipher.h"
#include "../GhettoCrypt/Util.h"
@ -228,3 +229,4 @@ namespace SimpleTests
}
};
}
*/

View File

@ -1,11 +1,32 @@
#include "CppUnitTest.h"
#include "../GhettoCrypt/GhettoCryptWrapper.h"
#include "../GhettoCrypt/Flexblock.h"
#include "../GhettoCrypt/Util.h"
#include <GCrypt/GhettoCryptWrapper.h>
#include <GCrypt/Flexblock.h>
#include <GCrypt/Util.h>
#include "Catch2.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace GhettoCipher;
using namespace Leonetienne::GCrypt;
// Tests that encrypting and decrypting strings using the wrapper works.
// This test will start from scratch after encryption, to ensure EVERYTHING has to be re-calculated.
TEST_CASE(__FILE__"/Encrypting and decrypting strings works", "[Wrapper]") {
// Setup
const std::string plaintext = "Hello, World!";
const std::string password = "Der Affe will Zucker";
std::string ciphertext;
std::string decrypted;
// Encryption
ciphertext = GhettoCryptWrapper::EncryptString(plaintext, password);
// Decryption
decrypted = GhettoCryptWrapper::DecryptString(ciphertext, password);
// Assertion
REQUIRE(plaintext == decrypted);
}
/*
namespace SimpleTests
{
TEST_CLASS(GCWrapper)
@ -79,3 +100,4 @@ namespace SimpleTests
}
};
}
*/

View File

@ -1,3 +1,4 @@
/*
#include "CppUnitTest.h"
#include "../GhettoCrypt/Util.h"
#include "../GhettoCrypt/Config.h"
@ -108,3 +109,4 @@ namespace SimpleTests
}
};
}
*/

2
GCryptLib/test/main.cpp Normal file
View File

@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN
#include "Catch2.h"