Commit Graph

11 Commits

Author SHA1 Message Date
Harald Welte
d295b92192 ensure usb_msg_hdr contains raw message length
we want to ensure that the length of every (current or future) message
can be determined by looking at cardemu_usb_msg_hdr.msg_len, rather than
having a length that is relative to the respective specific command.
2016-03-18 21:01:36 +01:00
Harald Welte
4ba66d0098 implement forwarding of PTS/PPS from emulator to host PC + test case 2016-02-26 09:40:34 +01:00
Harald Welte
86d047b8f4 card_emu_test: Verify content of emulator->reader bytes 2016-02-25 00:26:17 +01:00
Harald Welte
0ab6fcd173 card_emu_tests: Verify context of USB request contexts
when the emulator has received some data, don't just check that
we see it coming up on teh USB side, but actually also check
the content of those messages
2016-02-25 00:08:22 +01:00
Harald Welte
c043e64ef1 card_emu_tests: move test cases into functions 2016-02-24 23:26:55 +01:00
Harald Welte
eef6c2a46c card_emu_test: Add test for card-TX (reader-RX) APDU 2016-02-24 22:19:03 +01:00
Harald Welte
6bf8c12b13 update card_emu_tests to recent card_emu changes 2016-02-24 21:04:08 +01:00
Harald Welte
61bb30e4ea card_emu: Correctly handle SW after reader -> card data phase 2015-11-14 23:44:14 +01:00
Harald Welte
84ec252ff4 card_emu_test: test APDUs with both Rx and Tx data phase 2015-11-14 23:05:13 +01:00
Harald Welte
b436286ed6 card_emu_tests: extend first TPDU test to sending PB + SW in response 2015-11-14 19:02:33 +01:00
Harald Welte
9d3e38242c initial commit of more code towards card emulation
I couldn't help but to spend my sunday on working towards card
emulation, including
* various state machines in the target about ISO7816 states
* tc_etu timer import from simtrace1
* req_ctx import from simtrace1 (needs renaming and simplifiation)
* USB protocol description as cardemu_prot.h
* some host-based testing code to test the state machines

The code seems to work fine throughout card reset, sending ATR and
receiving the TPDU header of the first APDU, up to the point where it
marks the TPDU header as to-be-transmitted over th bulk-in endpoint.

Sending the ATR must be done inside the firmware for timing
requirements.

From that point onwards, the host needs to respond at the very least
with a procedure byte, and some indication whether or not the card
emulator should continue to transmit data (card->reader), or receive
data (reader->card).

The code is intentionally not hooked up yet with the USB logic nor with
the UART.  I want host-based testing completed before doing that.
2015-11-09 00:50:54 +01:00