diff --git a/.gitignore b/.gitignore
index 8631494..f5af4a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
-*.o
*.user
+/**/bin
+/**/lib
+/**/obj
/.vs
-/bin
-/lib
-/obj
diff --git a/Makefile b/Makefile
index e6621dc..613a539 100644
--- a/Makefile
+++ b/Makefile
@@ -7,10 +7,17 @@ MARCH ?= native
MTUNE ?= native
# ---------------------------------------------------------------------------
-# FLags
+# Directories
# ---------------------------------------------------------------------------
-CFLAGS = -IlibMCrypt/include -Wall -Wno-trigraphs -march=$(MARCH) -mtune=$(MTUNE)
+SUBDIR_APP := frontend
+SUBDIR_LIB := libslunkcrypt
+
+# ---------------------------------------------------------------------------
+# Flags
+# ---------------------------------------------------------------------------
+
+CFLAGS = -I$(SUBDIR_LIB)/include -Wall -Wno-trigraphs -march=$(MARCH) -mtune=$(MTUNE)
ifeq ($(DEBUG),1)
CFLAGS += -Og -g
@@ -24,10 +31,6 @@ ifeq ($(OS),Windows_NT)
LDFLGS += -municode -mconsole
endif
-# ---------------------------------------------------------------------------
-# File names
-# ---------------------------------------------------------------------------
-
undefine SUFFIX
ifeq ($(OS),Windows_NT)
SUFFIX := .exe
@@ -36,19 +39,26 @@ else
endif
ifeq ($(DEBUG),1)
- NAMEX := _g
+ CONFIG := _g
else
- undefine NAMEX
+ undefine CONFIG
endif
-TARGET_APP := bin/mcrypt$(NAMEX)$(SUFFIX)
-TARGET_LIB := lib/libmcrypt$(NAMEX)-1.a
+# ---------------------------------------------------------------------------
+# File names
+# ---------------------------------------------------------------------------
-SOURCES_APP := $(wildcard frontend/src/*.c)
-OBJECTS_APP := $(patsubst %.c,%$(NAMEX).o,$(SOURCES_APP))
+OUTNAME_APP := slunkcrypt$(CONFIG)$(SUFFIX)
+OUTNAME_LIB := libslunkcrypt$(CONFIG)-1.a
-SOURCES_LIB := $(wildcard libMCrypt/src/*.c)
-OBJECTS_LIB := $(patsubst %.c,%$(NAMEX).o,$(SOURCES_LIB))
+OUTPATH_APP := $(SUBDIR_APP)/bin/$(OUTNAME_APP)
+OUTPATH_LIB := $(SUBDIR_LIB)/lib/$(OUTNAME_LIB)
+
+SOURCES_APP := $(wildcard $(SUBDIR_APP)/src/*.c)
+OBJECTS_APP := $(patsubst $(SUBDIR_APP)/src/%.c,$(SUBDIR_APP)/obj/%$(CONFIG).o,$(SOURCES_APP))
+
+SOURCES_LIB := $(wildcard $(SUBDIR_LIB)/src/*.c)
+OBJECTS_LIB := $(patsubst $(SUBDIR_LIB)/src/%.c,$(SUBDIR_LIB)/obj/%$(CONFIG).o,$(SOURCES_LIB))
# ---------------------------------------------------------------------------
# Targets
@@ -56,20 +66,24 @@ OBJECTS_LIB := $(patsubst %.c,%$(NAMEX).o,$(SOURCES_LIB))
.PHONY: all clean
-all: $(TARGET_APP)
+all: $(OUTPATH_APP)
-$(TARGET_APP): $(OBJECTS_APP) $(TARGET_LIB)
+$(OUTPATH_APP): $(OBJECTS_APP) $(OUTPATH_LIB)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLGS)
-$(TARGET_LIB): $(OBJECTS_LIB)
+$(OUTPATH_LIB): $(OBJECTS_LIB)
@mkdir -p $(@D)
$(AR) rcs $@ $^
-%$(NAMEX).o: %.c
+$(SUBDIR_APP)/obj/%$(CONFIG).o: $(SUBDIR_APP)/src/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
-
+
+$(SUBDIR_LIB)/obj/%$(CONFIG).o: $(SUBDIR_LIB)/src/%.c
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -c $< -o $@
+
clean:
$(RM) $(addsuffix *crypt*,$(dir $(TARGET_APP)) $(dir $(TARGET_LIB)))
$(RM) $(addsuffix *.o,$(dir $(OBJECTS_APP)) $(dir $(OBJECTS_LIB)))
diff --git a/README.md b/README.md
index c6a7254..8902910 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
-MCrypt
-======
+SlunkCrypt
+==========
+
+An experimental cryptography library
Legal Warning
-------------
-Use of MCrypt may be illegal in countries where encryption is outlawed. We believe it is legal to use MCrypt in a large number of countries, but we are not lawyers, and so if in doubt you should seek legal advice before downloading it. You may find useful information at [cryptolaw.org](http://www.cryptolaw.org/), which collects information on cryptography laws in many countries, but we can't vouch for its correctness.
+Use of SlunkCrypt may be illegal in countries where encryption is outlawed. We believe it is legal to use SlunkCrypt in many countries all around the world, but we are not lawyers, and so if in doubt you should seek legal advice before downloading it. You may find useful information at [cryptolaw.org](http://www.cryptolaw.org/), which collects information on cryptography laws in many countries, but we can't vouch for its correctness.
License
-------
diff --git a/MCrypt.sln b/Slunk.sln
similarity index 86%
rename from MCrypt.sln
rename to Slunk.sln
index 8793d78..fcb9fda 100644
--- a/MCrypt.sln
+++ b/Slunk.sln
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30523.141
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCrypt", "frontend\MCrypt.vcxproj", "{86D28793-713E-4CEC-9686-335514AC5EF0}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SlunkCrypt", "frontend\SlunkCrypt.vcxproj", "{86D28793-713E-4CEC-9686-335514AC5EF0}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libMCrypt", "libMCrypt\libMCrypt.vcxproj", "{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSlunkCrypt", "libslunkcrypt\libSlunkCrypt.vcxproj", "{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/frontend/MCrypt.vcxproj b/frontend/SlunkCrypt.vcxproj
similarity index 90%
rename from frontend/MCrypt.vcxproj
rename to frontend/SlunkCrypt.vcxproj
index 551a46d..652b0fe 100644
--- a/frontend/MCrypt.vcxproj
+++ b/frontend/SlunkCrypt.vcxproj
@@ -24,11 +24,6 @@
-
-
- {a4a3879c-bd2c-4304-af66-7349cef7e4c0}
-
-
@@ -36,13 +31,21 @@
-
+
+ {a4a3879c-bd2c-4304-af66-7349cef7e4c0}
+
+
+
+
+
+
+
16.0
Win32Proj
{86d28793-713e-4cec-9686-335514ac5ef0}
- MCrypt
+ SlunkCrypt
7.0
@@ -94,25 +97,25 @@
true
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- mcrypt
+ slunkcrypt
false
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- mcrypt
+ slunkcrypt
true
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- mcrypt
+ slunkcrypt
false
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- mcrypt
+ slunkcrypt
@@ -120,8 +123,9 @@
true
WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- $(SolutionDir)libMCrypt\include
+ $(SolutionDir)libSlunkCrypt\include
4706;4204
+ MultiThreadedDebug
Console
@@ -135,7 +139,7 @@
true
WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- $(SolutionDir)libMCrypt\include
+ $(SolutionDir)libSlunkCrypt\include
MaxSpeed
AnySuitable
Speed
@@ -162,8 +166,9 @@
true
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- $(SolutionDir)libMCrypt\include
+ $(SolutionDir)libSlunkCrypt\include
4706;4204
+ MultiThreadedDebug
Console
@@ -177,7 +182,7 @@
true
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- $(SolutionDir)libMCrypt\include
+ $(SolutionDir)libSlunkCrypt\include
MaxSpeed
AnySuitable
Speed
diff --git a/frontend/MCrypt.vcxproj.filters b/frontend/SlunkCrypt.vcxproj.filters
similarity index 89%
rename from frontend/MCrypt.vcxproj.filters
rename to frontend/SlunkCrypt.vcxproj.filters
index 2df90a6..a0ce886 100644
--- a/frontend/MCrypt.vcxproj.filters
+++ b/frontend/SlunkCrypt.vcxproj.filters
@@ -43,8 +43,13 @@
-
+
Resource Files
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/frontend/res/Compatibility.manifest b/frontend/res/Compatibility.manifest
new file mode 100644
index 0000000..fce5b0f
--- /dev/null
+++ b/frontend/res/Compatibility.manifest
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/MCrypt.rc b/frontend/res/SlunkCrypt.rc
similarity index 52%
rename from frontend/MCrypt.rc
rename to frontend/res/SlunkCrypt.rc
index b04a7da..664cdc1 100644
--- a/frontend/MCrypt.rc
+++ b/frontend/res/SlunkCrypt.rc
@@ -6,6 +6,8 @@
#include "WinResrc.h" //"afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS
+#include "../../libslunkcrypt/src/version.h"
+
/////////////////////////////////////////////////////////////////////////////
//
// Neutral resources
@@ -20,8 +22,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// Version
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,0
- PRODUCTVERSION 1,0,0,0
+ FILEVERSION LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH, 0
+ PRODUCTVERSION LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH, 0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x3L
@@ -36,16 +38,16 @@ BEGIN
BEGIN
BLOCK "000004b0"
BEGIN
- VALUE "ProductName", "MCrypt"
- VALUE "FileDescription", "MCrypt Utility"
- VALUE "ProductVersion", "1.0.0"
- VALUE "FileVersion", "1.0.0"
- VALUE "InternalName", "mcrypt"
- VALUE "OriginalFilename", "mcrypt.exe"
- VALUE "LegalCopyright", "Created by LoRd_MuldeR "
- VALUE "CompanyName", "Muldersoft"
- VALUE "LegalTrademarks", "Muldersoft"
- VALUE "Comments", "This work has been released under the CC0 1.0 Universal license!"
+ VALUE "ProductName", "SlunkCrypt"
+ VALUE "FileDescription", "SlunkCrypt"
+ VALUE "ProductVersion", LIB_VERSION_STRING
+ VALUE "FileVersion", LIB_VERSION_STRING
+ VALUE "InternalName", "slunkcrypt"
+ VALUE "OriginalFilename", "slunkcrypt.exe"
+ VALUE "LegalCopyright", "Created by LoRd_MuldeR "
+ VALUE "CompanyName", "Muldersoft"
+ VALUE "LegalTrademarks", "Muldersoft"
+ VALUE "Comments", "This work has been released under the CC0 1.0 Universal license!"
END
END
BLOCK "VarFileInfo"
diff --git a/frontend/src/crc.c b/frontend/src/crc.c
index 0b93072..7ece5cb 100644
--- a/frontend/src/crc.c
+++ b/frontend/src/crc.c
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/crc.h b/frontend/src/crc.h
index a984126..a952c79 100644
--- a/frontend/src/crc.h
+++ b/frontend/src/crc.h
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/main.c b/frontend/src/main.c
index 69264c6..5885e9e 100644
--- a/frontend/src/main.c
+++ b/frontend/src/main.c
@@ -1,11 +1,11 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1
-#include
+#include
#include "utils.h"
#include "crc.h"
#include "test.h"
@@ -17,7 +17,7 @@
#define BUFF_SIZE 4096U
-static const CHR *const ENVV_PASSWD_NAME = T("MCRYPT_PASSWD");
+static const CHR *const ENVV_PASSWD_NAME = T("SLUNK_PASSPHRASE");
static char* read_passphrase(const CHR* const file_name)
{
@@ -103,7 +103,7 @@ static int open_files(FILE **const file_in, FILE **const file_out, const CHR* co
static int encrypt(const char* const passphrase, const CHR* const input_path, const CHR* const output_path)
{
- mcrypt_t ctx = MCRYPT_NULL;
+ slunkcrypt_t ctx = SLUNKCRYPT_NULL;
FILE * file_in = NULL, * file_out = NULL;
int result = 1;
@@ -128,9 +128,9 @@ static int encrypt(const char* const passphrase, const CHR* const input_path, co
fflush(stderr);
uint64_t seed;
- if (mcrypt_generate_seed(&seed) != MCRYPT_SUCCESS)
+ if (slunkcrypt_generate_seed(&seed) != SLUNKCRYPT_SUCCESS)
{
- FPUTS(T("\n\nMCrypt error: Failed to generate seed!\n\n"), stderr);
+ FPUTS(T("\n\nSlunkCrypt error: Failed to generate seed!\n\n"), stderr);
goto clean_up;
}
@@ -140,10 +140,10 @@ static int encrypt(const char* const passphrase, const CHR* const input_path, co
goto clean_up;
}
- ctx = mcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
+ ctx = slunkcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
if (!ctx)
{
- FPUTS(g_macrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nMCrypt error: Failed to initialize encryption!\n\n"), stderr);
+ FPUTS(g_slunkcrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nSlunkCrypt error: Failed to initialize encryption!\n\n"), stderr);
goto clean_up;
}
@@ -163,10 +163,10 @@ static int encrypt(const char* const passphrase, const CHR* const input_path, co
{
crc_actual = crc64_update(crc_actual, buffer, count);
bytes_read += count;
- const int status = mcrypt_encrypt_inplace(ctx, buffer, count);
- if (status != MCRYPT_SUCCESS)
+ const int status = slunkcrypt_encrypt_inplace(ctx, buffer, count);
+ if (status != SLUNKCRYPT_SUCCESS)
{
- FPUTS((status == MCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nMCrypt error: Failed to encrypt data!\n\n"), stderr);
+ FPUTS((status == SLUNKCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nSlunkCrypt error: Failed to encrypt data!\n\n"), stderr);
goto clean_up;
}
if (fwrite(buffer, sizeof(uint8_t), count, file_out) < count)
@@ -218,7 +218,7 @@ clean_up:
if (ctx)
{
- mcrypt_free(ctx);
+ slunkcrypt_free(ctx);
}
if (file_out)
@@ -236,7 +236,7 @@ clean_up:
static int decrypt(const char* const passphrase, const CHR* const input_path, const CHR* const output_path)
{
- mcrypt_t ctx = MCRYPT_NULL;
+ slunkcrypt_t ctx = SLUNKCRYPT_NULL;
FILE *file_in = NULL, *file_out = NULL;
int result = 1;
@@ -267,10 +267,10 @@ static int decrypt(const char* const passphrase, const CHR* const input_path, co
goto clean_up;
}
- ctx = mcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
+ ctx = slunkcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
if (!ctx)
{
- FPUTS(g_macrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nMCrypt error: Failed to initialize decryption!\n\n"), stderr);
+ FPUTS(g_slunkcrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nSlunkCrypt error: Failed to initialize decryption!\n\n"), stderr);
goto clean_up;
}
@@ -290,10 +290,10 @@ static int decrypt(const char* const passphrase, const CHR* const input_path, co
if (count > 0U)
{
bytes_read += count;
- const int status = mcrypt_decrypt_inplace(ctx, buffer, count);
- if (status != MCRYPT_SUCCESS)
+ const int status = slunkcrypt_decrypt_inplace(ctx, buffer, count);
+ if (status != SLUNKCRYPT_SUCCESS)
{
- FPUTS((status == MCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nMCrypt error: Failed to decrypt data!\n\n"), stderr);
+ FPUTS((status == SLUNKCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nSlunkCrypt error: Failed to decrypt data!\n\n"), stderr);
goto clean_up;
}
crc_actual = crc64_update(crc_actual, buffer, count);
@@ -354,7 +354,7 @@ clean_up:
if (ctx)
{
- mcrypt_free(ctx);
+ slunkcrypt_free(ctx);
}
if (file_out)
@@ -376,10 +376,10 @@ static int run_test(const char *const message)
const size_t length = strlen(message) + 1U;
int status, result = 1;
- mcrypt_t ctx = MCRYPT_NULL;
+ slunkcrypt_t ctx = SLUNKCRYPT_NULL;
uint64_t seed;
- if (mcrypt_generate_seed(&seed) != MCRYPT_SUCCESS)
+ if (slunkcrypt_generate_seed(&seed) != SLUNKCRYPT_SUCCESS)
{
FPUTS(T("\n\nWhoops: Failed to generate seed!\n\n"), stderr);
return 1;
@@ -392,17 +392,17 @@ static int run_test(const char *const message)
goto clean_up;
}
- ctx = mcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
+ ctx = slunkcrypt_alloc(seed, (const uint8_t*)passphrase, strlen(passphrase));
if (!ctx)
{
- FPUTS(g_macrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to initialize encoder!\n\n"), stderr);
+ FPUTS(g_slunkcrypt_abort_flag ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to initialize encoder!\n\n"), stderr);
goto clean_up;
}
- status = mcrypt_encrypt_inplace(ctx, (uint8_t*)text_temp, length);
- if (status != MCRYPT_SUCCESS)
+ status = slunkcrypt_encrypt_inplace(ctx, (uint8_t*)text_temp, length);
+ if (status != SLUNKCRYPT_SUCCESS)
{
- FPUTS((status == MCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to encrypt the message!\n\n"), stderr);
+ FPUTS((status == SLUNKCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to encrypt the message!\n\n"), stderr);
goto clean_up;
}
@@ -412,17 +412,17 @@ static int run_test(const char *const message)
goto clean_up;
}
- status = mcrypt_reset(ctx, seed, (const uint8_t*)passphrase, strlen(passphrase));
- if (status != MCRYPT_SUCCESS)
+ status = slunkcrypt_reset(ctx, seed, (const uint8_t*)passphrase, strlen(passphrase));
+ if (status != SLUNKCRYPT_SUCCESS)
{
- FPUTS((status == MCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to initialize decoder!\n\n"), stderr);
+ FPUTS((status == SLUNKCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to initialize decoder!\n\n"), stderr);
goto clean_up;
}
- status = mcrypt_decrypt_inplace(ctx, (uint8_t*)text_temp, length);
- if (status != MCRYPT_SUCCESS)
+ status = slunkcrypt_decrypt_inplace(ctx, (uint8_t*)text_temp, length);
+ if (status != SLUNKCRYPT_SUCCESS)
{
- FPUTS((status == MCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to decrypt the message!\n\n"), stderr);
+ FPUTS((status == SLUNKCRYPT_ABORTED) ? T("\n\nProcess interrupted!\n\n") : T("\n\nWhoops: Failed to decrypt the message!\n\n"), stderr);
goto clean_up;
}
@@ -438,12 +438,12 @@ clean_up:
if (ctx)
{
- mcrypt_free(ctx);
+ slunkcrypt_free(ctx);
}
if (text_temp)
{
- mcrypt_bzero(text_temp, strlen(text_temp));
+ slunkcrypt_bzero(text_temp, strlen(text_temp));
free(text_temp);
}
@@ -482,7 +482,7 @@ static void sigint_handler(const int sig)
{
if (sig == SIGINT)
{
- g_macrypt_abort_flag = 1;
+ g_slunkcrypt_abort_flag = 1;
signal(SIGINT, sigint_handler);
}
}
@@ -492,8 +492,8 @@ int MAIN(int argc, CHR* argv[])
init_terminal();
signal(SIGINT, sigint_handler);
- FPRINTF(stderr, T("MCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR \n"), OS_TYPE, CPU_ARCH);
- FPRINTF(stderr, T("Using libMCrypt v%") T(PRIstr) T(" [%") T(PRIstr) T("]\n\n"), LIBMCRYPT_VERSION, LIBMCRYPT_BUILDNO);
+ FPRINTF(stderr, T("SlunkCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR \n"), OS_TYPE, CPU_ARCH);
+ FPRINTF(stderr, T("Using libSlunkCrypt v%") T(PRIstr) T(" [%") T(PRIstr) T("]\n\n"), SLUNKCRYPT_VERSION, SLUNKCRYPT_BUILD);
if (argc > 1)
{
@@ -511,13 +511,13 @@ int MAIN(int argc, CHR* argv[])
FPUTS(T("Synopsis:\n"), stderr);
FPRINTF(stderr, T(" %") T(PRISTR) T(" --encrypt [[@][:]] \n"), program);
FPRINTF(stderr, T(" %") T(PRISTR) T(" --decrypt [[@][:]] \n\n"), program);
- FPUTS(T("Remarks:\n"), stderr);
+ FPUTS(T("Options:\n"), stderr);
FPUTS(T("- If is prefixed with a '@' character, then it specifies the file\n"), stderr);
FPUTS(T(" to read the passphrase from; only the first line in that file is used!\n"), stderr);
FPUTS(T("- If is prefixed with a ':' character, then the leading character\n"), stderr);
FPUTS(T(" is skipped and the remainder of the argument is used as passphrase.\n"), stderr);
- FPUTS(T("- If the argument is *not* present, then the environment variable\n"), stderr);
- FPRINTF(stderr, T(" \"%") T(PRISTR) T("\" must be set; it specifies the passphrase to be used.\n"), ENVV_PASSWD_NAME);
+ FPUTS(T("- If argument is omitted, then the passphrase is read from the\n"), stderr);
+ FPRINTF(stderr, T(" environment variable \"%") T(PRISTR) T("\" instead.\n"), ENVV_PASSWD_NAME);
FPUTS(T("- Specify \"@-\" in order to read the passphrase from the standard input stream!\n\n"), stderr);
return 0;
}
@@ -560,7 +560,7 @@ int MAIN(int argc, CHR* argv[])
return 1;
}
- mcrypt_bzero((CHR*)passphrase, STRLEN(passphrase) * sizeof(CHR));
+ slunkcrypt_bzero((CHR*)passphrase, STRLEN(passphrase) * sizeof(CHR));
if (strlen(passphrase_buffer) < 12U)
{
@@ -588,7 +588,7 @@ int MAIN(int argc, CHR* argv[])
goto exiting;
}
- if (!g_macrypt_abort_flag)
+ if (!g_slunkcrypt_abort_flag)
{
FPUTS(T("--------\n\n"), stderr);
fflush(stderr);
@@ -600,7 +600,7 @@ exiting:
if (passphrase_buffer)
{
- mcrypt_bzero(passphrase_buffer, strlen(passphrase_buffer));
+ slunkcrypt_bzero(passphrase_buffer, strlen(passphrase_buffer));
free(passphrase_buffer);
}
diff --git a/frontend/src/platform.h b/frontend/src/platform.h
index 62f6d5c..95fb069 100644
--- a/frontend/src/platform.h
+++ b/frontend/src/platform.h
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/test.c b/frontend/src/test.c
index e9e4bc0..024291c 100644
--- a/frontend/src/test.c
+++ b/frontend/src/test.c
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/test.h b/frontend/src/test.h
index 991abdd..6accd61 100644
--- a/frontend/src/test.h
+++ b/frontend/src/test.h
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/utils.c b/frontend/src/utils.c
index 08e8b2e..feab263 100644
--- a/frontend/src/utils.c
+++ b/frontend/src/utils.c
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/frontend/src/utils.h b/frontend/src/utils.h
index d7523c1..de0bef7 100644
--- a/frontend/src/utils.h
+++ b/frontend/src/utils.h
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
diff --git a/libMCrypt/include/mcrypt.h b/libMCrypt/include/mcrypt.h
deleted file mode 100644
index 885d194..0000000
--- a/libMCrypt/include/mcrypt.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
-/* This work has been released under the CC0 1.0 Universal license! */
-/******************************************************************************/
-
-#ifndef INC_MCYRPT_H
-#define INC_MCYRPT_H
-
-#include
-#include
-
-/*
- * Version info
- */
-extern const char *const LIBMCRYPT_VERSION;
-extern const char* const LIBMCRYPT_BUILDNO;
-
-/*
- * Abort flag
- */
-extern volatile int g_macrypt_abort_flag;
-
-/*
- * Opaque handle to internal state
- */
-typedef uintptr_t mcrypt_t;
-
-/*
- * Constants
- */
-#define MCRYPT_NULL ((mcrypt_t)NULL)
-#define MCRYPT_SUCCESS 0
-#define MCRYPT_FAILURE (-1)
-#define MCRYPT_ABORTED (-2)
-
-/*
- * Seed generator
- */
-int mcrypt_generate_seed(uint64_t* const seed);
-
-/*
- * Allocate, reset or free state
- */
-mcrypt_t mcrypt_alloc(const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len);
-int mcrypt_reset(const mcrypt_t context, const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len);
-void mcrypt_free(const mcrypt_t context);
-
-/*
- * Encryption routines
- */
-int mcrypt_encrypt(const mcrypt_t context, const uint8_t *const input, uint8_t* const output, size_t length);
-int mcrypt_encrypt_inplace(const mcrypt_t context, uint8_t *const buffer, size_t length);
-
-/*
- * Decryption routines
- */
-int mcrypt_decrypt(const mcrypt_t context, const uint8_t *const input, uint8_t *const output, size_t length);
-int mcrypt_decrypt_inplace(const mcrypt_t context, uint8_t* const buffer, size_t length);
-
-/*
- * Auxiliary functions
- */
-int mcrypt_random_bytes(uint8_t* const buffer, const size_t length);
-void mcrypt_bzero(void* const ptr, const size_t length);
-
-#endif
diff --git a/libslunkcrypt/include/slunkcrypt.h b/libslunkcrypt/include/slunkcrypt.h
new file mode 100644
index 0000000..97edbad
--- /dev/null
+++ b/libslunkcrypt/include/slunkcrypt.h
@@ -0,0 +1,66 @@
+/******************************************************************************/
+/* SlunkCrypt, by LoRd_MuldeR */
+/* This work has been released under the CC0 1.0 Universal license! */
+/******************************************************************************/
+
+#ifndef INC_SLUNKCRYPT_H
+#define INC_SLUNKCRYPT_H
+
+#include
+#include
+
+/*
+ * Version info
+ */
+extern const char *const SLUNKCRYPT_VERSION;
+extern const char* const SLUNKCRYPT_BUILD;
+
+/*
+ * Abort flag
+ */
+extern volatile int g_slunkcrypt_abort_flag;
+
+/*
+ * Opaque handle to internal state
+ */
+typedef uintptr_t slunkcrypt_t;
+
+/*
+ * Constants
+ */
+#define SLUNKCRYPT_NULL ((slunkcrypt_t)NULL)
+#define SLUNKCRYPT_SUCCESS 0
+#define SLUNKCRYPT_FAILURE (-1)
+#define SLUNKCRYPT_ABORTED (-2)
+
+/*
+ * Seed generator
+ */
+int slunkcrypt_generate_seed(uint64_t* const seed);
+
+/*
+ * Allocate, reset or free state
+ */
+slunkcrypt_t slunkcrypt_alloc(const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len);
+int slunkcrypt_reset(const slunkcrypt_t context, const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len);
+void slunkcrypt_free(const slunkcrypt_t context);
+
+/*
+ * Encryption routines
+ */
+int slunkcrypt_encrypt(const slunkcrypt_t context, const uint8_t *const input, uint8_t* const output, size_t length);
+int slunkcrypt_encrypt_inplace(const slunkcrypt_t context, uint8_t *const buffer, size_t length);
+
+/*
+ * Decryption routines
+ */
+int slunkcrypt_decrypt(const slunkcrypt_t context, const uint8_t *const input, uint8_t *const output, size_t length);
+int slunkcrypt_decrypt_inplace(const slunkcrypt_t context, uint8_t* const buffer, size_t length);
+
+/*
+ * Auxiliary functions
+ */
+int slunkcrypt_random_bytes(uint8_t* const buffer, const size_t length);
+void slunkcrypt_bzero(void* const ptr, const size_t length);
+
+#endif
diff --git a/libMCrypt/libMCrypt.vcxproj b/libslunkcrypt/libSlunkCrypt.vcxproj
similarity index 95%
rename from libMCrypt/libMCrypt.vcxproj
rename to libslunkcrypt/libSlunkCrypt.vcxproj
index b58f34e..ae6970b 100644
--- a/libMCrypt/libMCrypt.vcxproj
+++ b/libslunkcrypt/libSlunkCrypt.vcxproj
@@ -19,17 +19,18 @@
-
+
-
+
+
16.0
Win32Proj
{a4a3879c-bd2c-4304-af66-7349cef7e4c0}
- libMCrypt
+ libSlunkCrypt
7.0
@@ -81,25 +82,25 @@
true
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- libmcrypt-1
+ libslunkcrypt-1
false
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- libmcrypt-1
+ libslunkcrypt-1
true
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- libmcrypt-1
+ libslunkcrypt-1
false
$(SolutionDir)bin\$(Platform)\$(Configuration)\
$(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\
- libmcrypt-1
+ libslunkcrypt-1
@@ -110,6 +111,7 @@
NotUsing
$(ProjectDir)include
4706;4204
+ MultiThreadedDebug
@@ -155,6 +157,7 @@
NotUsing
$(ProjectDir)include
4706;4204
+ MultiThreadedDebug
diff --git a/libMCrypt/libMCrypt.vcxproj.filters b/libslunkcrypt/libSlunkCrypt.vcxproj.filters
similarity index 84%
rename from libMCrypt/libMCrypt.vcxproj.filters
rename to libslunkcrypt/libSlunkCrypt.vcxproj.filters
index 2b0f3be..c1afe5c 100644
--- a/libMCrypt/libMCrypt.vcxproj.filters
+++ b/libslunkcrypt/libSlunkCrypt.vcxproj.filters
@@ -15,15 +15,18 @@
-
+
Source Files
-
+
Source Files
-
+
+ Header Files
+
+
Header Files
diff --git a/libMCrypt/src/internal.c b/libslunkcrypt/src/internal.c
similarity index 90%
rename from libMCrypt/src/internal.c
rename to libslunkcrypt/src/internal.c
index 27a7408..a587c48 100644
--- a/libMCrypt/src/internal.c
+++ b/libslunkcrypt/src/internal.c
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
@@ -8,7 +8,7 @@
#define WIN32_LEAN_AND_MEAN 1
#endif
-#include
+#include
#ifdef _WIN32
#include
@@ -29,7 +29,7 @@
#endif
#endif
-int mcrypt_random_bytes(uint8_t* const buffer, const size_t length)
+int slunkcrypt_random_bytes(uint8_t* const buffer, const size_t length)
{
#ifdef _WIN32
size_t pos = 0U;
@@ -76,7 +76,7 @@ int mcrypt_random_bytes(uint8_t* const buffer, const size_t length)
#endif
}
-void mcrypt_bzero(void* const ptr, const size_t length)
+void slunkcrypt_bzero(void* const ptr, const size_t length)
{
if ((ptr) && (length > 0U))
{
diff --git a/libMCrypt/src/mcrypt.c b/libslunkcrypt/src/slunkcrypt.c
similarity index 78%
rename from libMCrypt/src/mcrypt.c
rename to libslunkcrypt/src/slunkcrypt.c
index 735dc58..96777bb 100644
--- a/libMCrypt/src/mcrypt.c
+++ b/libslunkcrypt/src/slunkcrypt.c
@@ -1,5 +1,5 @@
/******************************************************************************/
-/* MCrypt, by LoRd_MuldeR */
+/* SlunkCrypt, by LoRd_MuldeR */
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
@@ -7,8 +7,9 @@
#define _CRT_RAND_S 1
#endif
-#include
+#include
#include
+#include "version.h"
#ifdef _MSC_VER
#define FORCE_INLINE __forceinline
@@ -23,8 +24,8 @@
#endif
#endif
-const char* const LIBMCRYPT_VERSION = "1.0.0";
-const char* const LIBMCRYPT_BUILDNO = __DATE__", "__TIME__;
+const char* const SLUNKCRYPT_VERSION = LIB_VERSION_STRING;
+const char* const SLUNKCRYPT_BUILD = __DATE__", "__TIME__;
typedef struct
{
@@ -55,13 +56,13 @@ rand_state_t;
// Abort flag
// ==========================================================================
-volatile int g_macrypt_abort_flag = 0;
+volatile int g_slunkcrypt_abort_flag = 0;
#define CHECK_ABORTED() do \
{ \
- if (g_macrypt_abort_flag) \
+ if (g_slunkcrypt_abort_flag) \
{ \
- return MCRYPT_ABORTED; \
+ return SLUNKCRYPT_ABORTED; \
} \
} \
while (0)
@@ -113,7 +114,7 @@ static void generate_key(key_data_t *const key, const uint64_t salt, const uint1
static void random_init(rand_state_t* const state, const uint64_t seed_0, const uint64_t seed_1)
{
- mcrypt_bzero(state, sizeof(rand_state_t));
+ slunkcrypt_bzero(state, sizeof(rand_state_t));
state->a = (uint32_t)( seed_0 & 0xFFFFFFFF);
state->b = (uint32_t)((seed_0 >> 32) & 0xFFFFFFFF);
state->c = (uint32_t)( seed_1 & 0xFFFFFFFF);
@@ -139,7 +140,7 @@ static void random_seed(rand_state_t* const state, const uint64_t salt, const ui
key_data_t key;
generate_key(&key, salt, pepper, passwd, passwd_len);
random_init(state, key.a, key.b);
- mcrypt_bzero(&key, sizeof(key_data_t));
+ slunkcrypt_bzero(&key, sizeof(key_data_t));
for (size_t i = 0U; i < 97U; ++i)
{
volatile UNUSED uint32_t u = random_next(state);
@@ -152,7 +153,7 @@ static void random_seed(rand_state_t* const state, const uint64_t salt, const ui
static int initialize_state(crypt_state_t* const crypt_state, const uint64_t salt, const uint8_t* const passwd, const size_t passwd_len)
{
- mcrypt_bzero(crypt_state, sizeof(crypt_state_t));
+ slunkcrypt_bzero(crypt_state, sizeof(crypt_state_t));
/* set up wheels and initial rotation */
rand_state_t rand_state;
@@ -192,8 +193,8 @@ static int initialize_state(crypt_state_t* const crypt_state, const uint64_t sal
crypt_state->step_bwd[j] = (uint8_t)(255U - i);
}
- mcrypt_bzero(&rand_state, sizeof(rand_state_t));
- return MCRYPT_SUCCESS;
+ slunkcrypt_bzero(&rand_state, sizeof(rand_state_t));
+ return SLUNKCRYPT_SUCCESS;
}
// ==========================================================================
@@ -239,127 +240,127 @@ static FORCE_INLINE uint8_t process_dec(crypt_state_t* const crypt_state, uint8_
// Public API
// ==========================================================================
-int mcrypt_generate_seed(uint64_t* const seed)
+int slunkcrypt_generate_seed(uint64_t* const seed)
{
if (!seed)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
do
{
- if (mcrypt_random_bytes((uint8_t*)seed, sizeof(uint64_t)) != 0)
+ if (slunkcrypt_random_bytes((uint8_t*)seed, sizeof(uint64_t)) != 0)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
}
while (!(*seed));
- return MCRYPT_SUCCESS;
+ return SLUNKCRYPT_SUCCESS;
}
-mcrypt_t mcrypt_alloc(const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len)
+slunkcrypt_t slunkcrypt_alloc(const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len)
{
if ((!passwd) || (passwd_len < 1U))
{
- return MCRYPT_NULL;
+ return SLUNKCRYPT_NULL;
}
crypt_state_t* const state = (crypt_state_t*)malloc(sizeof(crypt_state_t));
if (!state)
{
- return MCRYPT_NULL;
+ return SLUNKCRYPT_NULL;
}
- if (initialize_state(state, salt, passwd, passwd_len) == MCRYPT_SUCCESS)
+ if (initialize_state(state, salt, passwd, passwd_len) == SLUNKCRYPT_SUCCESS)
{
- return ((mcrypt_t)state);
+ return ((slunkcrypt_t)state);
}
else
{
- mcrypt_bzero(state, sizeof(crypt_state_t));
- return MCRYPT_NULL;
+ slunkcrypt_bzero(state, sizeof(crypt_state_t));
+ return SLUNKCRYPT_NULL;
}
}
-int mcrypt_reset(const mcrypt_t context, const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len)
+int slunkcrypt_reset(const slunkcrypt_t context, const uint64_t salt, const uint8_t *const passwd, const size_t passwd_len)
{
crypt_state_t* const state = (crypt_state_t*)context;
if ((!state) || (!passwd) || (passwd_len < 1U))
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
const int result = initialize_state(state, salt, passwd, passwd_len);
- if (result != MCRYPT_SUCCESS)
+ if (result != SLUNKCRYPT_SUCCESS)
{
- mcrypt_bzero(state, sizeof(crypt_state_t));
+ slunkcrypt_bzero(state, sizeof(crypt_state_t));
}
return result;
}
-int mcrypt_encrypt(const mcrypt_t context, const uint8_t* const input, uint8_t* const output, size_t length)
+int slunkcrypt_encrypt(const slunkcrypt_t context, const uint8_t* const input, uint8_t* const output, size_t length)
{
crypt_state_t* const state = (crypt_state_t*)context;
if (!state)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
for (size_t i = 0; i < length; ++i)
{
output[i] = process_enc(state, input[i]);
CHECK_ABORTED();
}
- return MCRYPT_SUCCESS;
+ return SLUNKCRYPT_SUCCESS;
}
-int mcrypt_encrypt_inplace(const mcrypt_t context, uint8_t* const buffer, size_t length)
+int slunkcrypt_encrypt_inplace(const slunkcrypt_t context, uint8_t* const buffer, size_t length)
{
crypt_state_t* const state = (crypt_state_t*)context;
if (!state)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
for (size_t i = 0; i < length; ++i)
{
buffer[i] = process_enc(state, buffer[i]);
CHECK_ABORTED();
}
- return MCRYPT_SUCCESS;
+ return SLUNKCRYPT_SUCCESS;
}
-int mcrypt_decrypt(const mcrypt_t context, const uint8_t* const input, uint8_t* const output, size_t length)
+int slunkcrypt_decrypt(const slunkcrypt_t context, const uint8_t* const input, uint8_t* const output, size_t length)
{
crypt_state_t* const state = (crypt_state_t*)context;
if (!state)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
for (size_t i = 0; i < length; ++i)
{
output[i] = process_dec(state, input[i]);
CHECK_ABORTED();
}
- return MCRYPT_SUCCESS;
+ return SLUNKCRYPT_SUCCESS;
}
-int mcrypt_decrypt_inplace(const mcrypt_t context, uint8_t* const buffer, size_t length)
+int slunkcrypt_decrypt_inplace(const slunkcrypt_t context, uint8_t* const buffer, size_t length)
{
crypt_state_t* const state = (crypt_state_t*)context;
if (!state)
{
- return MCRYPT_FAILURE;
+ return SLUNKCRYPT_FAILURE;
}
for (size_t i = 0; i < length; ++i)
{
buffer[i] = process_dec(state, buffer[i]);
CHECK_ABORTED();
}
- return MCRYPT_SUCCESS;
+ return SLUNKCRYPT_SUCCESS;
}
-void mcrypt_free(const mcrypt_t context)
+void slunkcrypt_free(const slunkcrypt_t context)
{
crypt_state_t* const state = (crypt_state_t*)context;
if (state)
{
- mcrypt_bzero(state, sizeof(crypt_state_t));
+ slunkcrypt_bzero(state, sizeof(crypt_state_t));
free(state);
}
}
diff --git a/libslunkcrypt/src/version.h b/libslunkcrypt/src/version.h
new file mode 100644
index 0000000..551e3a4
--- /dev/null
+++ b/libslunkcrypt/src/version.h
@@ -0,0 +1,17 @@
+/******************************************************************************/
+/* SlunkCrypt, by LoRd_MuldeR */
+/* This work has been released under the CC0 1.0 Universal license! */
+/******************************************************************************/
+
+#ifndef INC_SLUNKCRYPT_VERSION_H
+#define INC_SLUNKCRYPT_VERSION_H
+
+#define LIB_VERSION_MAJOR 1
+#define LIB_VERSION_MINOR 0
+#define LIB_VERSION_PATCH 0
+
+#define VERSION_HELPER1(X,Y,Z) #X "." #Y "." #Z
+#define VERSION_HELPER2(X,Y,Z) VERSION_HELPER1(X,Y,Z)
+#define LIB_VERSION_STRING VERSION_HELPER2(LIB_VERSION_MAJOR,LIB_VERSION_MINOR,LIB_VERSION_PATCH)
+
+#endif