]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Merge pull request #82 from vt-alt/fix
authorDmitry Belyavskiy <beldmit@users.noreply.github.com>
Mon, 3 Sep 2018 18:30:40 +0000 (21:30 +0300)
committerGitHub <noreply@github.com>
Mon, 3 Sep 2018 18:30:40 +0000 (21:30 +0300)
Sanity checking in gost_grasshopper_cipher_cleanup

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);