diff options
author | William Wennerström <william@wstrm.dev> | 2020-06-11 22:50:36 +0200 |
---|---|---|
committer | William Wennerström <william@wstrm.dev> | 2020-11-16 21:58:07 +0100 |
commit | 3370418d71de255c832da97113543e554ec0e86b (patch) | |
tree | 0a364790895088cb0415b4ff31bfd40a588735bc /src/omemo/crypto.h | |
parent | 35aecd425fad6697e9cf72832cb287a156ec7942 (diff) | |
download | profani-tty-3370418d71de255c832da97113543e554ec0e86b.tar.gz |
Initial /sendfile OMEMO encryption
Diffstat (limited to 'src/omemo/crypto.h')
-rw-r--r-- | src/omemo/crypto.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/omemo/crypto.h b/src/omemo/crypto.h index 4fb6283e..916486b7 100644 --- a/src/omemo/crypto.h +++ b/src/omemo/crypto.h @@ -32,12 +32,16 @@ * source files in the program, then also delete it here. * */ +#include <stdio.h> #include <signal/signal_protocol_types.h> #define AES128_GCM_KEY_LENGTH 16 #define AES128_GCM_IV_LENGTH 12 #define AES128_GCM_TAG_LENGTH 16 +#define AES256_GCM_KEY_LENGTH 32 +#define AES256_GCM_NONCE_LENGTH 12 + int omemo_crypto_init(void); /** * Callback for a secure random number generator. @@ -176,7 +180,13 @@ int aes128gcm_encrypt(unsigned char* ciphertext, size_t* ciphertext_len, const unsigned char* const plaintext, size_t plaintext_len, const unsigned char* const iv, const unsigned char* const key); -int aes128gcm_decrypt(unsigned char* plaintext, - size_t* plaintext_len, const unsigned char* const ciphertext, - size_t ciphertext_len, const unsigned char* const iv, size_t iv_len, - const unsigned char* const key, const unsigned char* const tag); +int aes128gcm_decrypt(unsigned char *plaintext, + size_t *plaintext_len, const unsigned char *const ciphertext, + 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_encrypt_file(FILE *in, FILE *out, off_t file_size, + unsigned char key[], unsigned char nonce[]); + +int aes256gcm_decrypt_file(FILE *in, FILE *out, off_t file_size, + unsigned char key[], unsigned char nonce[]); |