aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/cipher.c
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-02-22 19:06:34 +0100
committerHans Nilsson <[email protected]>2019-03-19 12:45:54 +0100
commit26754483d39dab9ab09f69fcecb89ab1fb5135bd (patch)
treeb6cd8e0c8b68366958739f1b42407d89dac690b7 /lib/crypto/c_src/cipher.c
parentfcc89ded7f5cb5f81533883c30e7daa89195970d (diff)
downloadotp-26754483d39dab9ab09f69fcecb89ab1fb5135bd.tar.gz
otp-26754483d39dab9ab09f69fcecb89ab1fb5135bd.tar.bz2
otp-26754483d39dab9ab09f69fcecb89ab1fb5135bd.zip
crypto: Implement crypto one-shot
Also: Compatibility functions for aes_ctr in historic crypto libs
Diffstat (limited to 'lib/crypto/c_src/cipher.c')
-rw-r--r--lib/crypto/c_src/cipher.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/crypto/c_src/cipher.c b/lib/crypto/c_src/cipher.c
index c055a62654..5c57898c50 100644
--- a/lib/crypto/c_src/cipher.c
+++ b/lib/crypto/c_src/cipher.c
@@ -98,7 +98,9 @@ static struct cipher_type_t cipher_types[] =
{{"aes_128_ctr"}, {NULL}, 16, AES_CTR_COMPAT},
{{"aes_192_ctr"}, {NULL}, 24, AES_CTR_COMPAT},
{{"aes_256_ctr"}, {NULL}, 32, AES_CTR_COMPAT},
- {{"aes_ctr"}, {NULL}, 0, AES_CTR_COMPAT},
+ {{"aes_ctr"}, {NULL}, 16, AES_CTR_COMPAT},
+ {{"aes_ctr"}, {NULL}, 24, AES_CTR_COMPAT},
+ {{"aes_ctr"}, {NULL}, 32, AES_CTR_COMPAT},
#endif
#if defined(HAVE_CHACHA20)
@@ -162,6 +164,11 @@ static void evp_cipher_ctx_dtor(ErlNifEnv* env, struct evp_cipher_ctx* ctx) {
if (ctx->ctx)
EVP_CIPHER_CTX_free(ctx->ctx);
+
+#if !defined(HAVE_EVP_AES_CTR)
+ if (ctx->env)
+ enif_free_env(ctx->env);
+#endif
}
int init_cipher_ctx(ErlNifEnv *env) {