summaryrefslogtreecommitdiff
path: root/src/encryption.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/encryption.c')
-rw-r--r--src/encryption.c51
1 files changed, 51 insertions, 0 deletions
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 @@
1#include "encryption.h"
2#include "shared.h"
3
4#include <sodium.h>
5
6#include <stdarg.h>
7#include <errno.h>
8#include <error.h>
9#include <stdio.h>
10
11int checkSodium(void) {
12 int ret = sodium_init();
13 if(ret < 0)
14 error(1, ENOTSUP, "Couldn't initialize sodium for some reason. Quitting...");
15
16 return ret;
17}
18
19// To encrypt:
20// 1- Create a temp file with the correct name in the root folder of the partition being encrypted
21 // 1.1- Detect the partition and find the root folder
22 // 1.2- Create the temp file with the correct name
23// 2- Encrypt the file's contents to the temp file
24 // 2.1- Open the file
25 // 2.2- Stream the file's contents into some encryption algo
26 // 2.3- Pipe the output of the encryption into the temp file
27// 3- Once the file has been encrypted, hard link it back to the original location
28// 4- Delete the original file
29// 5- Delete the temp file
30
31
32int maketmp(const char *dest, const char *format, ...) {
33 va_list ap;
34 va_start(ap, format);
35
36
37
38 va_end(ap);
39 return 0;
40}
41
42
43
44int main() {
45 char *test = NULL;
46
47 saprintf(&test, "We do a little trolling %d", 900);
48 printf("%s\n", test);
49
50 return 0;
51} \ No newline at end of file