Forwarding the email to Dev community also. The 'rsa' pointer is like below when it is passed to RSA_check_key(): (gdb) p/x *keys $1 = { pad = 0x0, version = 0x0, meth = 0x32543b3940, engine = 0x0, n = 0x7fd508007470, e = 0x7fd508007a80, d = 0x7fd508007ac0, p = 0x7fd508007b70, q = 0x7fd508007be0, dmp1 = 0x7fd508007c50, dmq1 = 0x7fd508007cc0, iqmp = 0x7fd508007d30, ex_data = { sk = 0x0, dummy = 0x0 }, references = 0x1, flags = 0x406, _method_mod_n = 0x0, _method_mod_p = 0x0, _method_mod_q = 0x0, bignum_data = 0x0, blinding = 0x0, mt_blinding = 0x0 }
> -----Original Message----- > From: Tayade, Nilesh > Sent: Wednesday, June 20, 2012 7:13 PM > To: 'openssl-us...@openssl.org' > Subject: Core dump in RSA_check_key > > Hi, > > I am seeing a core dump in RSA_check_key() function. The backtrace is > as below. > I am unable to understand what is causing the issue. The core dump is > intermittent (not always reproduced). > Could someone please provide any pointers if I am missing any check? > > -- > Thanks, > Nilesh > > P.S. > > The code generating crash is: > // fp is a valid pointer to the private key file in > PEM format. > RSA *rsa = (RSA *) PEM_read_RSAPrivateKey(fp, NULL, > NULL, NULL); > if (!rsa) { > return -1; > } > > if (RSA_check_key(rsa) != 1) { > RSA_free(rsa); > rsa = NULL; > } > > Back trace: > Program terminated with signal 11, Segmentation fault. > #0 sha1_block_data_order_ssse3 () at sha1-x86_64.s:2240 > #0 sha1_block_data_order_ssse3 () at sha1-x86_64.s:2240 > #1 0xca62c1d6ca62c1d6 in ?? () > #2 0xca62c1d6ca62c1d6 in ?? () > #3 0xca62c1d6ca62c1d6 in ?? () > #4 0xca62c1d6ca62c1d6 in ?? () > #5 0xca62c1d6ca62c1d6 in ?? () > #6 0xca62c1d6ca62c1d6 in ?? () > #7 0xca62c1d6ca62c1d6 in ?? () > #8 0xca62c1d6ca62c1d6 in ?? () > #9 0x00000032543be076 in state () from /lib64/libcrypto.so.10 > #10 0x00007fd508008210 in ?? () > #11 0x0000000000000029 in ?? () > #12 0x000000325406acf7 in SHA1_Update (c=0xe992ba8d, data_=<value > optimized out>, len=<value optimized out>) at ../md32_common.h:325 > #13 0x00000032540ce30f in ssleay_rand_bytes (buf=0x7fd5080081c0 "", > num=54, pseudo=1) at md_rand.c:498 > #14 0x00000032540a2535 in bnrand (pseudorand=1, rnd=0x7fd5080075f0, > bits=512, top=-1, bottom=0) at bn_rand.c:147 > #15 0x00000032540a2358 in bn_rand_range (pseudo=<value optimized out>, > r=0x7fd5080075f0, range=0x7fd5080075c0) at bn_rand.c:281 > #16 0x00000032540a533b in BN_is_prime_fasttest_ex (a=0x7fd508007be0, > checks=6, ctx_passed=0x0, do_trial_division=<value optimized out>, > cb=0x0) > at bn_prime.c:322 > #17 0x00000032540b2775 in RSA_check_key (key=0x7fd508007940) at > rsa_chk.c:88 ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org