From: Vitaly Chikunov Date: Sat, 11 Aug 2018 04:57:38 +0000 (+0300) Subject: Allow double calling of gost_grasshopper_cipher_cleanup() X-Git-Tag: v3.0.0~361^2 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F82%2Fhead;p=openssl-gost%2Fengine.git Allow double calling of gost_grasshopper_cipher_cleanup() --- 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);