aboutsummaryrefslogtreecommitdiff
path: root/gost_grasshopper_cipher.c
diff options
context:
space:
mode:
authorVitaly Chikunov <vt@altlinux.org>2018-08-11 07:57:38 +0300
committerVitaly Chikunov <vt@altlinux.org>2018-09-03 21:26:35 +0300
commitc66825ad2610bd2bb42f9fe89156803a4235089f (patch)
tree78ee705bed25513de46a2d85eb4919ee9393de28 /gost_grasshopper_cipher.c
parent982807c016a84de0dfac220c08871f1ae273e2c2 (diff)
downloadgost-engine-c66825ad2610bd2bb42f9fe89156803a4235089f.zip
gost-engine-c66825ad2610bd2bb42f9fe89156803a4235089f.tar.gz
gost-engine-c66825ad2610bd2bb42f9fe89156803a4235089f.tar.bz2
Allow double calling of gost_grasshopper_cipher_cleanup()
Diffstat (limited to 'gost_grasshopper_cipher.c')
-rw-r--r--gost_grasshopper_cipher.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c
index e78fae7..a482a39 100644
--- a/gost_grasshopper_cipher.c
+++ b/gost_grasshopper_cipher.c
@@ -604,6 +604,10 @@ int gost_grasshopper_cipher_do_cfb(EVP_CIPHER_CTX* ctx, unsigned char* out,
int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx) {
gost_grasshopper_cipher_ctx* c = (gost_grasshopper_cipher_ctx*) EVP_CIPHER_CTX_get_cipher_data(ctx);
+
+ if (!c)
+ return 1;
+
struct GRASSHOPPER_CIPHER_PARAMS* params = &gost_cipher_params[c->type];
gost_grasshopper_cipher_destroy(c);