Hi, I have developed the code below, and I have found some problems. I
call the
"PKCS12_parse" function and then the "*_free" functions for releasing
the
memory that I have allocated before.

I noticed that the memory is not released in a right way, because if you

look at the code that I have sent to you, after some iterations, the
occupied memory is greater each time.

I would like to know if I am using the functions properly or if there
could be any bug with them.

Thanks,
Eduardo

/*******************************************/
#include <openssl/pkcs12.h>

int main()
{
 PKCS12 *p12;
 X509 *signer = NULL;
 EVP_PKEY *key = NULL;
 FILE *fich;
 int cont;
 char password[]="clave";

 OpenSSL_add_all_algorithms();

 for (cont=0;cont<1000;cont++)
     {
      fich=fopen("cert.p12","r");
      p12=d2i_PKCS12_fp(fich,NULL);
      fclose(fich);

      PKCS12_parse(p12,password,&key,&signer,NULL);
      X509_free(signer);
      EVP_PKEY_free(key);
      PKCS12_free(p12);
     }

 EVP_cleanup();
}
/*******************************************/


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to