summaryrefslogtreecommitdiff
path: root/src/encryption.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/encryption.h')
-rw-r--r--src/encryption.h9
1 files changed, 8 insertions, 1 deletions
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 @@
1#ifndef __VXGG_REWRITE___ENCRYPTION_H___1481879318188___ 1#ifndef __VXGG_REWRITE___ENCRYPTION_H___1481879318188___
2#define __VXGG_REWRITE___ENCRYPTION_H___1481879318188___ 2#define __VXGG_REWRITE___ENCRYPTION_H___1481879318188___
3 3
4#include <sodium.h>
5
4// Determines whether any function that calls libsodium functions also checks to make sure libsodium is actually initialized. May 6// Determines whether any function that calls libsodium functions also checks to make sure libsodium is actually initialized. May
5// cause unexpected issues with early exiting due to libsodium failing to initialize properly. It's recommended that you just 7// cause unexpected issues with early exiting due to libsodium failing to initialize properly. It's recommended that you just
6// manually run `sodium_init()` in some main or init function of your own so that you can deal with a potential error yourself 8// manually run `sodium_init()` in some main or init function of your own so that you can deal with a potential error yourself
7#define ___VXGG___ALWAYS_CHECK_LIBSODIUM___ 0 9#define ___VXGG___ALWAYS_CHECK_LIBSODIUM___ 0
8 10
9#define CHUNK_SIZE ((int)(1 << 12)) 11#define CHUNKSIZE (1 << 9)
10 12
11// 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 13// 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
12#if ___VXGG___ALWAYS_CHECK_LIBSODIUM___ > 0 14#if ___VXGG___ALWAYS_CHECK_LIBSODIUM___ > 0
@@ -82,4 +84,9 @@ void checksodium(void);
82// open() with the flags O_TMPFILE, O_WRONLY, O_CLOEXEC, and O_SYNC. Opened with mode S_IRUSR, S_IWUSR 84// open() with the flags O_TMPFILE, O_WRONLY, O_CLOEXEC, and O_SYNC. Opened with mode S_IRUSR, S_IWUSR
83int maketmp(const char * const dest); 85int maketmp(const char * const dest);
84 86
87int encrypttofile(FILE *dst, FILE *src, unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
88int decrypttofile(FILE *dst, FILE *src, unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
89
90int encrypttotmp(const char * const target, const char * const output, const unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
91
85#endif \ No newline at end of file 92#endif \ No newline at end of file