Hi!

I am looking for a problem with some PEM_key.
But on the way I found some behavior I think is strange.

Here is a small piece of code.

----------------------------------
#include <stdio.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>

    // OpenSSL 1.0.1t  3 May 2016
    // gcc version 4.9.2 (Debian 4.9.2-10)
    // g++ x.cpp -lssl -lcrypto

int main (void)
{
    setbuf (stdout,NULL);

    printf ("\ninit=%d", SSL_library_init ());
    printf ("\nalgo=%d", OpenSSL_add_ssl_algorithms());

    RSA *pk= RSA_new ();
    printf ("\npk=%d\n",pk);
    printf ("\ncheckkey=%d\n", RSA_check_key(pk));
    printf ("\nsize=%d\n", RSA_size(pk));
    printf ("\n------------\n");

    return 0;
}
----------------------------------



The output.
----------------------------------

init=1
algo=1
pk=25519296

checkkey=0
Segmentation fault
----------------------------------


Why does RSA_size crash?
I would expect 0 or -1 or whatever but not a crash.

Regards,
Chris

--
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to