From c66825ad2610bd2bb42f9fe89156803a4235089f Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sat, 11 Aug 2018 07:57:38 +0300 Subject: [PATCH] Allow double calling of gost_grasshopper_cipher_cleanup() --- gost_grasshopper_cipher.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.39.2