]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/evp/evp_enc.c
Identify and move common internal libcrypto header files
[thirdparty/openssl.git] / crypto / evp / evp_enc.c
index 4dfc1593e6a6e5d53651b5365011af48456e5d80..125556ea6f4e070f0b6ac4cf46db8f8fcab2bdba 100644 (file)
@@ -57,7 +57,7 @@
  */
 
 #include <stdio.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include <openssl/rand.h>
@@ -70,8 +70,7 @@ const char EVP_version[] = "EVP" OPENSSL_VERSION_PTEXT;
 
 void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
 {
-    memset(ctx, 0, sizeof(EVP_CIPHER_CTX));
-    /* ctx->cipher=NULL; */
+    memset(ctx, 0, sizeof(*ctx));
 }
 
 EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
@@ -166,6 +165,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
                 EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
                 return 0;
             }
+            memset(ctx->cipher_data, 0, ctx->cipher->ctx_size);
         } else {
             ctx->cipher_data = NULL;
         }
@@ -546,7 +546,7 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
          */
         ENGINE_finish(c->engine);
 #endif
-    memset(c, 0, sizeof(EVP_CIPHER_CTX));
+    memset(c, 0, sizeof(*c));
     return 1;
 }