aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-10-20 16:18:03 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-10-20 16:18:03 +0000
commitcecd263878368268b4c0c8f3309af9eb0c7144f8 (patch)
tree202a403ec6730dae208d1c2fddba7db0517a54f5 /crypto
parent31fe950d2b3fad3ac7ca2922c2af2104514a9496 (diff)
downloadopenssl-cecd263878368268b4c0c8f3309af9eb0c7144f8.tar.gz
Add missing EVP_CIPHER_CTX_{init,cleanup}
Diffstat (limited to 'crypto')
-rw-r--r--crypto/pem/pem_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index f5ae9d7cbd..94373e1d23 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -345,10 +345,12 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
PEM_proc_type(buf,PEM_TYPE_ENCRYPTED);
PEM_dek_info(buf,objstr,8,(char *)iv);
/* k=strlen(buf); */
-
+
+ EVP_CIPHER_CTX_init(&ctx);
EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv);
EVP_EncryptUpdate(&ctx,data,&j,data,i);
EVP_EncryptFinal_ex(&ctx,&(data[j]),&i);
+ EVP_CIPHER_CTX_cleanup(&ctx);
i+=j;
ret=1;
}
@@ -399,6 +401,7 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
(unsigned char *)buf,klen,1,key,NULL);
j=(int)len;
+ EVP_CIPHER_CTX_init(&ctx);
EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0]));
EVP_DecryptUpdate(&ctx,data,&i,data,j);
o=EVP_DecryptFinal_ex(&ctx,&(data[i]),&j);