-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaes.h
41 lines (30 loc) · 999 Bytes
/
aes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <minix/mthread.h>
#include <openssl/aes.h>
#include <stdbool.h>
#define BLOCK_SIZE 16
#define BUFFER_SIZE 320000
struct ThreadData
{
struct Buffer *input_buffer;
struct Buffer *output_buffer;
AES_KEY *key;
bool last_block;
};
struct Buffer
{
unsigned char data[BUFFER_SIZE];
size_t size;
};
void adjust_key(const unsigned char *user_key, unsigned char *adjusted_key);
void write_log(const char *message, const unsigned char *data, size_t size);
void *encrypt_thread(void *thread_arg);
void *decrypt_thread(void *thread_arg);
void encrypt_decrypt_string(const unsigned char *key);
void encrypt_file(const unsigned char *key, const char *input_file, const char *output_file);
void decrypt_file(const unsigned char *key, const char *input_file, const char *output_file);
void generate_aes_key(const char *username, const char *password, unsigned char *aes_key);