From 833cb417608eb138d3a9b99dc995c5c1aeffd1cd Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Sun, 30 Mar 2025 23:13:35 -0500 Subject: Create encryption functions that actually work --- src/encryption.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/encryption.h') diff --git a/src/encryption.h b/src/encryption.h index 418e7f6..1bdd2b9 100644 --- a/src/encryption.h +++ b/src/encryption.h @@ -1,12 +1,14 @@ #ifndef __VXGG_REWRITE___ENCRYPTION_H___1481879318188___ #define __VXGG_REWRITE___ENCRYPTION_H___1481879318188___ +#include + // Determines whether any function that calls libsodium functions also checks to make sure libsodium is actually initialized. May // cause unexpected issues with early exiting due to libsodium failing to initialize properly. It's recommended that you just // manually run `sodium_init()` in some main or init function of your own so that you can deal with a potential error yourself #define ___VXGG___ALWAYS_CHECK_LIBSODIUM___ 0 -#define CHUNK_SIZE ((int)(1 << 12)) +#define CHUNKSIZE (1 << 9) // TODO: What the fuck was I thinking when I did any of this callback shit? Make this a different macro and decouple it from ALWAYS_CHECK #if ___VXGG___ALWAYS_CHECK_LIBSODIUM___ > 0 @@ -82,4 +84,9 @@ void checksodium(void); // open() with the flags O_TMPFILE, O_WRONLY, O_CLOEXEC, and O_SYNC. Opened with mode S_IRUSR, S_IWUSR int maketmp(const char * const dest); +int encrypttofile(FILE *dst, FILE *src, unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]); +int decrypttofile(FILE *dst, FILE *src, unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]); + +int encrypttotmp(const char * const target, const char * const output, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]); + #endif \ No newline at end of file -- cgit v1.2.3