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

@@ -1713,7 +1713,7 @@ _bytes_from_hex(const char* hex, size_t hex_size,
}
}
int
gcry_error_t
omemo_decrypt_file(FILE* in, FILE* out, off_t file_size, const char* fragment)
{
char nonce_hex[AESGCM_URL_NONCE_LEN];
@@ -1733,7 +1733,8 @@ omemo_decrypt_file(FILE* in, FILE* out, off_t file_size, const char* fragment)
_bytes_from_hex(key_hex, AESGCM_URL_KEY_LEN,
key, OMEMO_AESGCM_KEY_LENGTH);
int crypt_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, false);
gcry_error_t crypt_res;
crypt_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, false);
gcry_free(key);