Add missing EVP_CIPHER_CTX_{init,cleanup}
authorDr. Stephen Henson <steve@openssl.org>
Sat, 20 Oct 2001 16:18:03 +0000 (16:18 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 20 Oct 2001 16:18:03 +0000 (16:18 +0000)
apps/speed.c
crypto/pem/pem_lib.c

index dec893d..363ec65 100644 (file)
@@ -1215,6 +1215,7 @@ int MAIN(int argc, char **argv)
                        names[D_EVP]=OBJ_nid2ln(evp->nid);
                        print_message(names[D_EVP],save_count,
                                                  lengths[j]);
+                       EVP_CIPHER_CTX_init(&ctx);
                        if(decrypt)
                                EVP_DecryptInit_ex(&ctx,evp,NULL,key16,iv);
                        else
@@ -1232,6 +1233,7 @@ int MAIN(int argc, char **argv)
                        else
                                EVP_EncryptFinal_ex(&ctx,buf,&outl);
                        d=Time_F(STOP,usertime);
+                       EVP_CIPHER_CTX_cleanup(&ctx);
                        BIO_printf(bio_err,"%ld %s's in %.2fs\n",
                                           count,names[D_EVP],d);
                        results[D_EVP][j]=((double)count)/d*lengths[j];
index f5ae9d7..94373e1 100644 (file)
@@ -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);