diff options
author | Ian Moffett <ian@osmora.org> | 2024-09-26 14:47:29 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-09-26 14:47:29 -0400 |
commit | e394dc73ee6266f744e37f268d6279d462af7d1f (patch) | |
tree | 33dcec46d82fe338f28f319414908648602a48a8 /lib/crypto | |
parent | 6ce0543f3d2f7bb6b8e681e162bfd111b1c7a336 (diff) |
lib: crypto: Implement AES message free functions
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/aes.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c index ea9fe98..c51c594 100644 --- a/lib/crypto/aes.c +++ b/lib/crypto/aes.c @@ -33,6 +33,7 @@ #include <openssl/rand.h> #include <crypto/aes.h> #include <stdio.h> +#include <string.h> /* * Encrypt 'data' with AES-256-GCM. @@ -232,3 +233,25 @@ aes256_decrypt(struct aes_message *amp, const unsigned char *key, *res = plaintext; return 0; } + +/* + * Free data from AES message structure. + */ +int +aes256_free_msg(struct aes_message *amp) +{ + free(amp->ciphertext); + return 0; +} + +/* + * Free memory used for plaintext. + */ +int +aes256_free_plain(unsigned char *plain, size_t len) +{ + memset(plain, 0, len); + munlock(plain, len); + free(plain); + return 0; +} |