From f8e94a1179633799579a09dce1841f41e3b73f05 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Mon, 6 Jan 2025 18:34:13 -0600 Subject: Start work on encryption --- src/encryption.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/encryption.c (limited to 'src/encryption.c') diff --git a/src/encryption.c b/src/encryption.c new file mode 100644 index 0000000..e92e4e7 --- /dev/null +++ b/src/encryption.c @@ -0,0 +1,51 @@ +#include "encryption.h" +#include "shared.h" + +#include + +#include +#include +#include +#include + +int checkSodium(void) { + int ret = sodium_init(); + if(ret < 0) + error(1, ENOTSUP, "Couldn't initialize sodium for some reason. Quitting..."); + + return ret; +} + +// To encrypt: +// 1- Create a temp file with the correct name in the root folder of the partition being encrypted + // 1.1- Detect the partition and find the root folder + // 1.2- Create the temp file with the correct name +// 2- Encrypt the file's contents to the temp file + // 2.1- Open the file + // 2.2- Stream the file's contents into some encryption algo + // 2.3- Pipe the output of the encryption into the temp file +// 3- Once the file has been encrypted, hard link it back to the original location +// 4- Delete the original file +// 5- Delete the temp file + + +int maketmp(const char *dest, const char *format, ...) { + va_list ap; + va_start(ap, format); + + + + va_end(ap); + return 0; +} + + + +int main() { + char *test = NULL; + + saprintf(&test, "We do a little trolling %d", 900); + printf("%s\n", test); + + return 0; +} \ No newline at end of file -- cgit v1.2.3