crypto.c: add AES GCM 128 en/decryption

This commit is contained in:
F. Duncanh
2023-11-23 20:31:23 -05:00
parent 44365fe59c
commit 60cfb19d90
2 changed files with 91 additions and 1 deletions

View File

@@ -16,6 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* modified by fduncanh 2023
*/
/*
@@ -64,9 +66,16 @@ x25519_key_t *x25519_key_generate(void);
x25519_key_t *x25519_key_from_raw(const unsigned char data[X25519_KEY_SIZE]);
void x25519_key_get_raw(unsigned char data[X25519_KEY_SIZE], const x25519_key_t *key);
void x25519_key_destroy(x25519_key_t *key);
int get_random_bytes(unsigned char *buf, int num);
void x25519_derive_secret(unsigned char secret[X25519_KEY_SIZE], const x25519_key_t *ours, const x25519_key_t *theirs);
// GCM AES 128
int gcm_encrypt(const unsigned char *plaintext, int plaintext_len, unsigned char *ciphertext,
unsigned char *key, unsigned char *iv, unsigned char *tag);
int gcm_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *plaintext,
unsigned char *key, unsigned char *iv, unsigned char *tag);
// ED25519
#define ED25519_KEY_SIZE 32