How to run OpenSSL command line utility under debugger?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run OpenSSL command line utility under debugger?

Anton Schmidt
I've got an error in openssl library function when trying to read a pkcs7 message

[schmidt@localhost ssl]$ ./bin/openssl version
OpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)
[schmidt@localhost ssl]$ ./bin/openssl pkcs7 -in /tmp/55b0822e148e4ffaa0bd9ebc41814f54.der -inform DER -print_certs
unable to load PKCS7 object
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):sequence length mismatch:crypto/asn1/tasn_dec.c:388:Type=PKCS7_ENVELOPE
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):nested asn1 error:crypto/asn1/tasn_dec.c:629:
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):nested asn1 error:crypto/asn1/tasn_dec.c:479:Field=d.enveloped, Type=PKCS7 

openssl asn1parse and other online tools correctly parse and display ASN1 of pkcs7 envelopedData.

I want to run openssl utility under debugger to see what is happening inside the library function.

I've found OpenSSL library source code https://github.com/openssl/openssl but not the sources for command line utility. Are the sources available? 

Or as an option is there a guide how I could write a simple pkcs7 envelopedData reader to debug the library function?
Reply | Threaded
Open this post in threaded view
|

Re: How to run OpenSSL command line utility under debugger?

JordanBrown
On 10/14/2019 10:59 PM, Anton Schmidt wrote:
I've found OpenSSL library source code https://github.com/openssl/openssl but not the sources for command line utility. Are the sources available? 

I believe they are in the "apps" directory of that repository.
-- 
Jordan Brown, Oracle ZFS Storage Appliance, Oracle Solaris
Reply | Threaded
Open this post in threaded view
|

Re: How to run OpenSSL command line utility under debugger?

Dmitry Belyavsky-3
In reply to this post by Anton Schmidt
Dear Anton,

On Tue, Oct 15, 2019 at 9:00 AM Anton Schmidt <[hidden email]> wrote:
I've got an error in openssl library function when trying to read a pkcs7 message

[schmidt@localhost ssl]$ ./bin/openssl version
OpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)
[schmidt@localhost ssl]$ ./bin/openssl pkcs7 -in /tmp/55b0822e148e4ffaa0bd9ebc41814f54.der -inform DER -print_certs
unable to load PKCS7 object
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):sequence length mismatch:crypto/asn1/tasn_dec.c:388:Type=PKCS7_ENVELOPE
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):nested asn1 error:crypto/asn1/tasn_dec.c:629:
40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown function):nested asn1 error:crypto/asn1/tasn_dec.c:479:Field=d.enveloped, Type=PKCS7 

openssl asn1parse and other online tools correctly parse and display ASN1 of pkcs7 envelopedData.

I want to run openssl utility under debugger to see what is happening inside the library function.

I've found OpenSSL library source code https://github.com/openssl/openssl but not the sources for command line utility. Are the sources available? 

Or as an option is there a guide how I could write a simple pkcs7 envelopedData reader to debug the library function?

You can build openssl using the following steps:
./config -ggdb
make

and then debug
LD_LIBRARY_PATH=. gdb --args apps/openssl ...

--
SY, Dmitry Belyavsky