Bug 881336 - X509_issuer_and_serial_hash() segfaults in FIPS mode
Summary: X509_issuer_and_serial_hash() segfaults in FIPS mode
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: openssl
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomas Mraz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-28 18:21 UTC by Petr Pisar
Modified: 2013-07-04 13:59 UTC (History)
2 users (show)

Fixed In Version: openssl-1.0.1c-11.fc18
Clone Of:
Environment:
Last Closed: 2013-07-04 13:59:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer (1.05 KB, text/plain)
2012-11-28 18:21 UTC, Petr Pisar
no flags Details

Description Petr Pisar 2012-11-28 18:21:22 UTC
Created attachment 653634 [details]
Reproducer

Calling X509_issuer_and_serial_hash() in FIPS mode causes segfault.

Running attached program on any PEM X.509 certificate:

$ OPENSSL_FIPS=1 gdb --args ./a.out t/data/testcert_simple.crt.pem
GNU gdb (GDB) Fedora (7.4.50.20120120-52.fc17)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/petr/Net-SSLeay/Net-SSLeay-1.49/a.out...done.
(gdb) run
Starting program: /home/petr/Net-SSLeay/Net-SSLeay-1.49/a.out t/data/testcert_simple.crt.pem
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
FIPS mode is enabled

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt full
#0  0x0000000000000000 in ?? ()
No symbol table info available.
#1  0x00007ffff78d1d62 in X509_issuer_and_serial_hash (a=0x601f80) at x509_cmp.c:91
        ret = 20
        ctx = {digest = 0x7ffff7b65fa0, engine = 0x0, flags = 0, md_data = 0x0, pctx = 0x0, update = 0}
        md = "x\027~\367\377\177\000\000\000\000\000\000\000\000\000"
        f = 0x6022a0 "/C=US/O=Demo1/CN=CA1"
#2  0x00000000004009dc in main (argc=2, argv=0x7fffffffe268) at test.c:40
        filename = 0x7fffffffe555 "t/data/testcert_simple.crt.pem"
        bio = 0x601bc0
        cert = 0x601f80
        hash = 4196864
(gdb) frame 1
#1  0x00007ffff78d1d62 in X509_issuer_and_serial_hash (a=0x601f80) at x509_cmp.c:91
91              EVP_DigestUpdate(&ctx,(unsigned char *)f,ret);
(gdb) info locals
ret = 20
ctx = {digest = 0x7ffff7b65fa0, engine = 0x0, flags = 0, md_data = 0x0, pctx = 0x0, update = 0}
md = "x\027~\367\377\177\000\000\000\000\000\000\000\000\000"
f = 0x6022a0 "/C=US/O=Demo1/CN=CA1"
(gdb) info registers
rax            0x0      0
rbx            0x6022a0 6300320
rcx            0x1d5    469
rdx            0x14     20
rsi            0x6022a0 6300320
rdi            0x7fffffffe0e0   140737488347360
rbp            0x601f80 0x601f80
rsp            0x7fffffffe0e0   0x7fffffffe0e0
r8             0x1d5    469
r9             0x1      1
r10            0x0      0
r11            0x7ffff75ab2d0   140737343304400
r12            0x14     20
r13            0x7fffffffe260   140737488347744
r14            0x0      0
r15            0x0      0
rip            0x7ffff78d1d62   0x7ffff78d1d62 <X509_issuer_and_serial_hash+98>
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0

I believe this due to uninitialized digest call-back function (unavailable MD5).

The same code without FIPS passes:

$ ./a.out t/data/testcert_simple.crt.pem
FIPS mode is not enabled
Issuer and serial number hash is 1890711708


Tested on Fedora 17 with openssl-1.0.0j-2.fc17.x86_64.

Comment 2 Fedora End Of Life 2013-07-04 04:05:17 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.


Note You need to log in before you can comment on or make changes to this bug.