Giter Club home page Giter Club logo

Comments (7)

frankmorgner avatar frankmorgner commented on August 19, 2024

Currently the ATR is not propagated from pcsc-relay to vpcd. If you want to see the correct(tm) ATR, try changing https://github.com/frankmorgner/vsmartcard/blob/master/pcsc-relay/src/vicc.c#L80 to 3B 8A 80 01 80 31 B8 73 84 01 E0 82 90 00 06.

The problem you've encountered seems to be in the wave's firmware itself, which is why the transmission fails. Obviously, it doesn't correctly parse or respond to the pseudo APDU FF 9A 04 02 00 00 07 30 05 A1 03 02 01 02 FF FF. You should be able to reproduce this problem locally (i.e. without pcsc-relay).

  1. You should check whether there is a new firmware for the wave (you need Windows for this).
  2. If there is not, you could check with BSI TR-03119 if it is encoded correctly with npa-tool (I'm pretty confident it is, because I think I've tested this successfully).
  3. If it is correct then report the problem to Reiner SCT.

from vsmartcard.

typingm0nk avatar typingm0nk commented on August 19, 2024

Thanks for the fast reply.

Locally the behavior is a bit different. The eID-functions work (sorta, Selbstauskunft has trouble with the redirect).
With the npa-tool the PACE channel gets established with eID PIN/ CAN. Input on the reader works there.
After that is has an error. I saw the same error with the relay, when the reader crashed, but thought the crash would cause it.

% npa-tool -p                                                                                                        :(
Established PACE channel with eID PIN.
lt-npa-tool: /home/malte/code/vsmartcard/npa/./src/opensc/src/libopensc/card.c:338: sc_disconnect_card: Assertion `card->lock_count == 0' failed.
[1]    950 abort (core dumped)  npa/src/npa-tool -p

While I see FF 9A 04 02 00 00 07 30 05 A1 03 02 01 03 FF FF in the more verbose npa-tool output via relay, locally it goes directly from the incoming PACECapabilities-APDU to perform_pace.

Output in question from npa-tool -vvv -p:

0x7fb48e616700 18:29:21.886 [] reader-pcsc.c:270:pcsc_transmit: 
Outgoing APDU (4 bytes):
FF 9A 04 01 ....
0x7fb48e616700 18:29:21.886 [] reader-pcsc.c:199:pcsc_internal_transmit: called
0x7fb48e616700 18:29:21.888 [] reader-pcsc.c:279:pcsc_transmit: 
Incoming APDU (24 bytes):
30 14 A1 03 01 01 FF A2 03 01 01 FF A3 03 01 01 0...............
00 A4 03 01 01 FF 90 00                         ........
0x7fb48e616700 18:29:21.888 [] reader-pcsc.c:199:pcsc_internal_transmit: called
0x7fb48e616700 18:29:30.561 [] npa.c:1468:perform_pace: returning with: 0 (Success)
Established PACE channel with eID PIN.

Firmware should be up to date, but I'll verify that at home.

from vsmartcard.

frankmorgner avatar frankmorgner commented on August 19, 2024

A core dump should never happen. Could you run npa-tool in gdb or with valgrind?

I've migrated nPA directly to https://github.com/frankmorgner/OpenSC. Could you check if this version is also affected?

from vsmartcard.

frankmorgner avatar frankmorgner commented on August 19, 2024

I think something like gdb npa-tool core should also give some details. Compiling with CFLAGS="-g -O0" also helps.

from vsmartcard.

typingm0nk avatar typingm0nk commented on August 19, 2024

I hope this helps.

Output from gdb:

% gdb /tmp/install/bin/npa-tool core_dump

Reading symbols from /tmp/install/bin/npa-tool...done.
[New LWP 13731]

warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/tmp/install/bin/npa-tool -vvv -p'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007fd56a2c004f in raise () from /usr/lib/libc.so.6
(gdb) r -p
Starting program: /tmp/install/bin/npa-tool -p
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Established PACE channel with eID PIN.
npa-tool: /home/malte/code/vsmartcard/npa/./src/opensc/src/libopensc/card.c:338: sc_disconnect_card: Assertion `card->lock_count == 0' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff685a04f in raise () from /usr/lib/libc.so.6

stack trace from coredumpctl:

Stack trace of thread 13731:
#0  0x00007fd56a2c004f raise (libc.so.6)
#1  0x00007fd56a2c147a abort (libc.so.6)
#2  0x00007fd56a2b8ea7 __assert_fail_base (libc.so.6)
#3  0x00007fd56a2b8f52 __assert_fail (libc.so.6)
#4  0x00007fd56b62b96a sc_disconnect_card (libnpa.so.0)
#5  0x0000000000404491 main (npa-tool)
#6  0x00007fd56a2ad291 __libc_start_main (libc.so.6)
#7  0x0000000000401dda _start (npa-tool)

The version from OpenSC is not affected.

card.c:362:sc_disconnect_card: returning with: 0 (Success)

from vsmartcard.

frankmorgner avatar frankmorgner commented on August 19, 2024

Thanks for the feedback. I won't investigate in libnpa further. Please use the OpenSC version. Are there any other problems left?

from vsmartcard.

typingm0nk avatar typingm0nk commented on August 19, 2024

No, thanks again.
I verified pseudo APDU with the tr-03119 and contacted Rainer SCT.

from vsmartcard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.