]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Allow double calling of gost_grasshopper_cipher_cleanup() 82/head
authorVitaly Chikunov <vt@altlinux.org>
Sat, 11 Aug 2018 04:57:38 +0000 (07:57 +0300)
committerVitaly Chikunov <vt@altlinux.org>
Mon, 3 Sep 2018 18:26:35 +0000 (21:26 +0300)
gost_grasshopper_cipher.c

index e78fae747db56dca65fc677e00a7b4d27425afbd..a482a39cf0728ea2bf75746109cfe8aa85708293 100644 (file)
@@ -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);