[openssl-dev] [openssl.org #4286] AutoReply: Debug in OpenSSL

Tiantian Liu via RT rt at openssl.org
Mon Feb 1 22:27:24 UTC 2016


Thanks for open the ticket  [openssl.org #4286] for me.
Thanks,
Tyler 

-----Original Message-----
From: The default queue via RT [mailto:rt at openssl.org] 
Sent: February-01-16 5:21 PM
To: Tiantian (Tyler) Liu
Subject: [openssl.org #4286] AutoReply: Debug in OpenSSL


Greetings,

This message has been automatically generated in response to the creation of a trouble ticket regarding:
	"Debug in OpenSSL",
a summary of which appears below.

There is no need to reply to this message right now.  Your ticket has been assigned an ID of [openssl.org #4286].

Please include the string:

         [openssl.org #4286]

in the subject line of all future correspondence about this issue. To do so, you may reply to this message.

                        Thank you,
                        rt at openssl.org

-------------------------------------------------------------------------
Hi, ALL,

I am software developer who is struggling with encryption and decryption issues in my application.

Our customer complained our application crashed at the point where OpenSSL method,  PEM_read_RSAPrivateKey, being called.

While I can't duplicate the crash in my machine. So I want to enable debug in OpenSSL and core dumping on their machine, then I can get the core dump file upon the crash on customer's side. And I can use GDB to debug the core dump to see what happened in side the so-called PEM_read_RSAPrivateKey.

Today, I re-compiled my OpenSSL (version openssl-1.0.1p). However, when I set the breakpoint at PEM_read_RSAPrivateKey, my GDB can't step into that function, just bypassed directly.
My machine is 32-bit RedHat Enterprise 5. What I did in configure and installation:

#./Configure -g debug-linux-elf -prefix=/usr shared # make # make install

All the new generated libs were installed under /usr/lib

I use GDB command to check my setup. It looks like my GDB can recognize all the OpenSSL source code and loaded OpenSSL shared library symbols. I post the part of information from GDB:
(gdb) info sharedlibrary
>From        To          Syms Read   Shared Object Library
0x00561a30  0x005c6364  Yes         /usr/lib/libkrb5.so.3
0x0064f590  0x00666e94  Yes         /usr/lib/libk5crypto.so.3
0x002407c0  0x004446c4  Yes         /usr/lib/libptcoresdk.so.2
0x0070a7f0  0x0070af84  Yes         /lib/libcom_err.so.2
0x008c55d0  0x00940594  Yes         /usr/lib/libstdc++.so.6
0x005e86b0  0x00631eb4  Yes         /usr/lib/libssl.so.1.0.0
0x00a73f00  0x00b81704  Yes         /usr/lib/libcrypto.so.1.0.0
0x004f7a50  0x004f8a64  Yes         /lib/libdl.so.2
0x004ff210  0x00509e34  Yes         /lib/i686/nosegneg/libpthread.so.0
0x00722bd0  0x0081a7d0  Yes         /lib/i686/nosegneg/libc.so.6
0x00513430  0x00517794  Yes         /usr/lib/libkrb5support.so.0
0x0053f0d0  0x0054a064  Yes         /lib/libresolv.so.2
0x0085a670  0x00861ea4  Yes         /lib/libgcc_s.so.1
0x00675410  0x00690654  Yes         /lib/i686/nosegneg/libm.so.6
0x00a1c7f0  0x00a3172f  Yes         /lib/ld-linux.so.2

And I also ran command:
(gdb) info source
.........................................
pem_pkey.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_pkey.c, pem_pk8.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_pk8.c,
pem_oth.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_oth.c, pem_xaux.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_xaux.c,
pem_x509.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_x509.c, pem_err.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_err.c,
pem_all.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_all.c, pem_lib.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_lib.c,
pem_info.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_info.c, pem_seal.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_seal.c,
pem_sign.c, /home/tyler28/openssl-1.0.1p/crypto/pem/pem_sign.c, asn_moid.c, /home/tyler28/openssl-1.0.1p/crypto/asn1/asn_moid.c,
...............................................

Then during debug, my GDB showed:
(gdb) break PEM_read_RSAPrivateKey
Breakpoint 2 at 0xb373fd: file pem_all.c, line 184.
(gdb) c
Continuing.
[Switching to Thread 14957456 (LWP 8796)]

Breakpoint 1, createRSAWithFilename (filename=0x82ef65a "out/private.pem", diag=0xe3ebdc "/MerchantConnectMulti/log/262.dg",
    public=0) at ../multi_client/source_Host_C_Code/ssl_open.c:1385
1385        FILE * fp = fopen(filename,"rb");
(gdb) n
1387        if(fp == NULL)
(gdb) n
1393        RSA *rsa= RSA_new() ;
(gdb) n
1394        if(diag) SerialWriteTestLine_string_Time("FILE open on:", filename, diag);
(gdb) n
1395        if(diag) SerialWriteTestLine_Time("after RSA_new", diag);
(gdb) n
1398        if (rsa == NULL) {
(gdb) n
1408        if(public >0)
(gdb) n
1415            rsa = PEM_read_RSAPrivateKey(fp, &rsa,NULL, NULL);
(gdb) s                               <<<<<<<<---------- GDB bypassed, I can't step into the function!
1419        if(diag) SerialWriteTestLine_Time("after PEM_read_RSAPrivateKey/PEM_read_RSA_PUBKEY", diag);

Beside that function, I found I can't step into any OpenSSL standard function either. For example, I can't step into the RSA_new too.
Based on the message I offered above, could you help me to figure out what mistakes I did? Could you help me?
In another word, I just want to step into the OpenSSL standard library functions. How can I do that?

I am eagerly waiting for your response and help, thank you in advance.

Thanks,
Tyler







More information about the openssl-dev mailing list