added Threefish cipher as submodule

This commit is contained in:
Hendrik Schutter 2022-08-22 14:24:31 +02:00
parent 4862a45ef6
commit d7aaa9647d
4 changed files with 45 additions and 3 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "--force"]
path = --force
url = https://git.mosad.xyz/localhorst/tfnoisegen.git
[submodule "tfnoisegen"]
path = tfnoisegen
url = https://git.mosad.xyz/localhorst/tfnoisegen.git

View File

@ -8,7 +8,7 @@ SRC_EXT = cpp
# Path to the source directory, relative to the makefile
SRC_PATH = src
# Space-separated pkg-config libraries used by this project
LIBS =
LIBS = lib
# General compiler flags
COMPILE_FLAGS = -std=c++17 -Wall -Wextra -g
# Additional release-specific flags
@ -18,9 +18,12 @@ DCOMPILE_FLAGS = -D DEBUG
# Add additional include paths
INCLUDES = include
# General linker settings
LINK_FLAGS = -lpthread -lncurses
LINK_FLAGS = -Llib -lpthread -lncurses -ltfng
# Doc
DOCDIR = doc
TFRANDDIR = tfnoisegen
TFRANDLIB = libtfng.a
#### END PROJECT SETTINGS ####
# Optionally you may move the section above to a separate config.mk file, and
@ -52,7 +55,7 @@ endif
# Combine compiler and linker flags
release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS)
release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS)
@ -158,6 +161,7 @@ dirs:
@echo "Creating directories"
@mkdir -p $(dir $(OBJECTS))
@mkdir -p $(BIN_PATH)
@mkdir -p $(LIBS)
# Removes all build files
.PHONY: clean
@ -167,18 +171,27 @@ clean:
@echo "Deleting directories"
@$(RM) -r build
@$(RM) -r bin
@$(RM) -r $(LIBS)
@$(RM) -f reHDD.log
$(MAKE) clean -C tfnoisegen
# Main rule, checks the executable and symlinks to the output
all: $(BIN_PATH)/$(BIN_NAME)
$(MAKE) libtfng.a -C tfnoisegen
@cp $(TFRANDDIR)/$(TFRANDLIB) $(LIBS)
@echo "Making symlink: $(BIN_NAME) -> $<"
@$(RM) $(BIN_NAME)
@ln -s $(BIN_PATH)/$(BIN_NAME) $(BIN_NAME)
# Link the executable
$(BIN_PATH)/$(BIN_NAME): $(OBJECTS)
$(MAKE) libtfng.a -C tfnoisegen
@cp $(TFRANDDIR)/$(TFRANDLIB) $(LIBS)
@echo "Linking: $@"
@$(START_TIME)
@echo $(LDFLAGS)
@ls lib/
$(CMD_PREFIX)$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
@echo -en "\t Link time: "
@$(END_TIME)

View File

@ -7,10 +7,32 @@
#include "../include/reHDD.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "../tfnoisegen/tfprng.h"
#ifdef __cplusplus
}
#endif
const static char *randomsrc = (char*) "/dev/urandom";
#define DATASIZE 65536
Shred::Shred()
{
static char data[DATASIZE];
static char key[TFNG_KEY_SIZE];
tfng_prng_seedkey(key);
tfng_prng_genrandom(data, DATASIZE);
Logger::logThis()->info("RandomData: " + to_string(data[0]));
}
Shred::~Shred()

1
tfnoisegen Submodule

@ -0,0 +1 @@
Subproject commit 488716ef22ac5a1aae235a59bea2997ac7e8e45a