Refactor OMEMO download into AESGCMDownload tool

This commit is contained in:
William Wennerström
2020-07-20 22:49:50 +02:00
parent fb002a59b6
commit 73f313b921
12 changed files with 386 additions and 23 deletions

View File

@@ -400,12 +400,12 @@ aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
goto out;
}
res = gcry_cipher_setkey(hd, key, AES256_GCM_KEY_LENGTH);
res = gcry_cipher_setkey(hd, key, OMEMO_AESGCM_KEY_LENGTH);
if (res != GPG_ERR_NO_ERROR) {
goto out;
}
res = gcry_cipher_setiv(hd, nonce, AES256_GCM_NONCE_LENGTH);
res = gcry_cipher_setiv(hd, nonce, OMEMO_AESGCM_NONCE_LENGTH);
if (res != GPG_ERR_NO_ERROR) {
goto out;
}
@@ -468,8 +468,8 @@ out:
char*
aes256gcm_create_secure_fragment(unsigned char* key, unsigned char* nonce)
{
int key_size = AES256_GCM_KEY_LENGTH;
int nonce_size = AES256_GCM_NONCE_LENGTH;
int key_size = OMEMO_AESGCM_KEY_LENGTH;
int nonce_size = OMEMO_AESGCM_NONCE_LENGTH;
char* fragment = gcry_malloc_secure((nonce_size + key_size) * 2 + 1);