Add I/O error handling and use filenames instead of file descriptors

This commit is contained in:
William Wennerström
2020-07-21 09:31:47 +02:00
parent 73f313b921
commit 62cbad1c6e
10 changed files with 102 additions and 71 deletions

View File

@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <signal/signal_protocol_types.h>
#include <gcrypt.h>
#define AES128_GCM_KEY_LENGTH 16
#define AES128_GCM_IV_LENGTH 12
@@ -183,8 +184,8 @@ int aes128gcm_decrypt(unsigned char* plaintext,
size_t ciphertext_len, const unsigned char* const iv, size_t iv_len,
const unsigned char* const key, const unsigned char* const tag);
int aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
unsigned char key[], unsigned char nonce[], bool encrypt);
gcry_error_t aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
unsigned char key[], unsigned char nonce[], bool encrypt);
char* aes256gcm_create_secure_fragment(unsigned char* key,
unsigned char* nonce);