[pkg-opensc-maint] Bug#786412: pkcs11-tool: pkcs15-pubkey.c:1064: sc_pkcs15_dup_pubkey: Assertion `key && out' failed.

Damyan Ivanov dmn at debian.org
Thu May 21 12:48:21 UTC 2015


Package: opensc-pkcs11
Version: 0.15.0-1
Severity: normal
Tags: upstream

After upgrading opensc & co to version 0.15.0-1, the following no longer 
works:

 $ pkcs11-tool -O
 pkcs11-tool: pkcs15-pubkey.c:1064: sc_pkcs15_dup_pubkey: Assertion `key 
 && out' failed.
 zsh: abort      pkcs11-tool -O

Downgrading opensc-pkcs11 to 0.14.0-2 fixes the problem.

After rebuilding opensc with DEB_BUILD_OPTIONS="nostrip noopt", the 
backtrace is:

(gdb) bt full
#0  0x00007ffff6dc4107 in __GI_raise (sig=sig at entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = 0
        pid = 16092
        selftid = 16092
#1  0x00007ffff6dc54e8 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x7fffffffebda, sa_sigaction = 0x7fffffffebda}, sa_mask = {__val = {140737336246689, 140737344795595, 1064, 4, 
              140737488344800, 4294957152, 1, 140733193388032, 0, 0, 0, 21474836480, 140737336246215, 140737488344952, 140737354092544, 140737336261864}}, 
          sa_flags = -143558062, sa_restorer = 0x7ffff77181e0 <__PRETTY_FUNCTION__.12239>}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff6dbd226 in __assert_fail_base (fmt=0x7ffff6ef3ce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion at entry=0x7ffff7717a52 "key && out", file=file at entry=0x7ffff77173cb "pkcs15-pubkey.c", line=line at entry=1064, 
    function=function at entry=0x7ffff77181e0 <__PRETTY_FUNCTION__.12239> "sc_pkcs15_dup_pubkey") at assert.c:92
        str = 0x650590 ""
        total = 4096
#3  0x00007ffff6dbd2d2 in __GI___assert_fail (assertion=0x7ffff7717a52 "key && out", file=0x7ffff77173cb "pkcs15-pubkey.c", line=1064, 
    function=0x7ffff77181e0 <__PRETTY_FUNCTION__.12239> "sc_pkcs15_dup_pubkey") at assert.c:101
No locals.
#4  0x00007ffff75a805e in sc_pkcs15_dup_pubkey (ctx=0x61e160, key=0x0, out=0x63da10) at pkcs15-pubkey.c:1064
        pubkey = 0x0
        rv = 0
        alg = 0x7fffffffd880 "\320\330\377\377\377\177"
        alglen = 140737343233935
        __PRETTY_FUNCTION__ = "sc_pkcs15_dup_pubkey"
        __FUNCTION__ = "sc_pkcs15_dup_pubkey"
#5  0x00007ffff6952271 in __pkcs15_prkey_bind_related (fw_data=0x633ef0, pk=0x63d9c0) at framework-pkcs15.c:770
        pubkey = 0x63dd80
        obj = 0x63dd80
        id = 0x63b1a0
        i = 7
        __FUNCTION__ = "__pkcs15_prkey_bind_related"
#6  0x00007ffff6952600 in pkcs15_bind_related_objects (fw_data=0x633ef0) at framework-pkcs15.c:838
        obj = 0x63d9c0
        i = 1
        __FUNCTION__ = "pkcs15_bind_related_objects"
#7  0x00007ffff6952f20 in _pkcs15_create_typed_objects (fw_data=0x633ef0) at framework-pkcs15.c:1062
        rv = 0
        __FUNCTION__ = "_pkcs15_create_typed_objects"
#8  0x00007ffff6953c71 in pkcs15_create_tokens (p11card=0x6335a0, app_info=0x0, first_slot=0x7fffffffdbf8) at framework-pkcs15.c:1276
        fw_data = 0x633ef0
        ffda = 0x0
        auth_user_pin = 0x63b4a0
        auth_sign_pin = 0x0
        fauo = 0x0
        slot = 0x0
        i = 0
        rv = 0
        idx = 0
        __FUNCTION__ = "pkcs15_create_tokens"
#9  0x00007ffff694bb7b in card_detect (reader=0x6331a0) at slot.c:292
        atrblock = 0x0
        enable_InitToken = 0
        app_generic = 0x0
        first_slot = 0x0
        p11card = 0x6335a0
        rc = 0
        rv = 0
        i = 0
        j = 32767
        __FUNCTION__ = "card_detect"
#10 0x00007ffff694b207 in initialize_reader (reader=0x6331a0) at slot.c:144
        i = 1
        rv = 0
        conf_block = 0x62df10
        list = 0x0
        __FUNCTION__ = "initialize_reader"
#11 0x00007ffff6945298 in C_Initialize (pInitArgs=0x0) at pkcs11-global.c:254
        rv = 0
        current_pid = 16092
        rc = 0
        i = 0
        ctx_opts = {ver = 0, app_name = 0x7ffff696383e "opensc-pkcs11", flags = 0, thread_ctx = 0x7ffff6b6f560 <sc_thread_ctx>}
        __FUNCTION__ = "C_Initialize"
#12 0x000000000040304e in ?? ()
No symbol table info available.
#13 0x00007ffff6db0b45 in __libc_start_main (main=0x402ec0, argc=2, argv=0x7fffffffe938, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffe928) at libc-start.c:287
        result = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 17383474773081810, 4219669, 140737488349488, 0, 0, -17383475093979438, -17399103454069038}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x410220, 0x7fffffffe938}, data = {prev = 0x0, cleanup = 0x0, canceltype = 4260384}}}
        not_first_call = <optimized out>
#14 0x000000000040633e in ?? ()
No symbol table info available.


The card is:

 $ opensc-tool -n
 Using reader with a card: OMNIKEY CardMan 6121 00 00
 CardOS M4
 $ opensc-tool -a

The same pkcs11-tool command works with another 'CardOS M4' card on the 
same reader, so it must be something with the card's contents.

So far the only strangeness is the following. The working card has 
matching sets of private, public key and certificate files. The problem 
card has several of those too, plus a set consisting of only a private 
and a public key (no certificate). In the past a bank employee had 
problems putting a new "e-certificate" on the card, and the broken set 
is probably a remnant from that time. Anyway, version 0.14.0-2 had no 
problems working with that.

I tried to look at the code, but found out that the sc_pkcs15_dup_pubkey 
function that invoces the assert() is new in version 0.15.0. Whatever 
was doing its job in 0.14.0 works.

I hope this information is enough, but I am ready to provide more if 
necessary.


-- dam

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/3 CPU cores)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages opensc-pkcs11 depends on:
ii  libc6        2.19-18
ii  libssl1.0.0  1.0.2a-1
ii  zlib1g       1:1.2.8.dfsg-2+b1

opensc-pkcs11 recommends no packages.

opensc-pkcs11 suggests no packages.

-- no debconf information



More information about the pkg-opensc-maint mailing list