aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gost_eng.c1
-rw-r--r--gost_grasshopper_cipher.c13
-rw-r--r--gost_grasshopper_cipher.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/gost_eng.c b/gost_eng.c
index 9e77e5d..a1dcd79 100644
--- a/gost_eng.c
+++ b/gost_eng.c
@@ -112,6 +112,7 @@ static int gost_engine_destroy(ENGINE* e) {
imit_gost_cp_12_destroy();
cipher_gost_destroy();
+ cipher_gost_grasshopper_destroy();
gost_param_free();
diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c
index 92be991..cc59daf 100644
--- a/gost_grasshopper_cipher.c
+++ b/gost_grasshopper_cipher.c
@@ -624,6 +624,19 @@ const GRASSHOPPER_INLINE EVP_CIPHER* cipher_gost_grasshopper_ctr() {
return cipher_gost_grasshopper(EVP_CIPH_CTR_MODE, GRASSHOPPER_CIPHER_CTR);
}
+void cipher_gost_grasshopper_destroy(void)
+{
+ EVP_CIPHER_meth_free(gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_ECB]);
+ gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_ECB] = NULL;
+ EVP_CIPHER_meth_free(gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CBC]);
+ gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CBC] = NULL;
+ EVP_CIPHER_meth_free(gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_OFB]);
+ gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_OFB] = NULL;
+ EVP_CIPHER_meth_free(gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CFB]);
+ gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CFB] = NULL;
+ EVP_CIPHER_meth_free(gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CTR]);
+ gost_grasshopper_ciphers[GRASSHOPPER_CIPHER_CTR] = NULL;
+}
#if defined(__cplusplus)
}
#endif
diff --git a/gost_grasshopper_cipher.h b/gost_grasshopper_cipher.h
index 3a8531f..2aae662 100644
--- a/gost_grasshopper_cipher.h
+++ b/gost_grasshopper_cipher.h
@@ -98,6 +98,7 @@ extern const EVP_CIPHER* cipher_gost_grasshopper_ofb();
extern const EVP_CIPHER* cipher_gost_grasshopper_cfb();
extern const EVP_CIPHER* cipher_gost_grasshopper_ctr();
+void cipher_gost_grasshopper_destroy(void);
#if defined(__cplusplus)
}
#endif