The follow code works.

void cert(void)
{
    RSA *pair;
    int err;
    printf("Making a key pair for new cert, please wait, this could take a 
minute...\n"); 

    pair = RSA_generate_key(2048,35,NULL,NULL);

    if (pair == NULL){
        err = ERR_get_error();
        printf("Error = %s\n",ERR_reason_error_string(err));
        exit(0);
    }
    RSA_print_fp(stdout,pair,0);
    CRYPTO_cleanup_all_ex_data();
}





int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days)
 {


     rsa=RSA_generate_key(bits,RSA_F4,callback,NULL);
 
     if (!EVP_PKEY_assign_RSA(pk,rsa)) // I am thinking the problem is here.  
     {
          abort();
          goto err;
     }


     RSA_print_fp(stdout,rsa,0);  // THIS WORKS


     rsa=NULL;




    if (!X509_sign(x,pk,EVP_md5()))
        goto err;

    *x509p=x;
    *pkeyp=pk;
    return(1);
err:
    return(0);
 }



  ----- Original Message ----- 
  From: Marcus Carey 
  To: openssl-users@openssl.org 
  Sent: Friday, August 14, 2009 6:30 PM
  Subject: RSA_print_fp still crashes using Windows MD library


  OpenSSL 1.0.0-beta3 July 2009

  I have compiled the mkcert.c example in the distrubtion with the MD library 
on Win XP using VCStudio NET and it still crashes.  I also included the 
applink.c.

  Unhandled exception at 0x10001d36 in mkcert.exe: 0xC0000005: Access violation 
writing location 0x100fa020.


  I am a missing something else?

  Marcus

Reply via email to