Commit Graph

93 Commits

Author SHA1 Message Date
Pol Henarejos
8f8134efbc Fix preparing rdata pointer with emulated HID.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-03 00:05:05 +01:00
Pol Henarejos
b96e853e6d Added support for Fido emulation to automatize tests.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-02 22:05:04 +01:00
Pol Henarejos
16b4fa6ca3 Emulation is now a higher define which also accepts interfaces.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-23 07:57:35 +01:00
Pol Henarejos
e5e5af634c Fix endianness of CCID.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-20 16:17:16 +01:00
Pol Henarejos
2471b3308b Adding support for CCID GET, SET and RESET PARAMS.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-20 13:16:46 +01:00
Pol Henarejos
e44fde509b Added support for Interrupt endpoint.
It is only used to inform the host changes on card status (insert or removal). Actually it only notifies the insertion of the virtual card on connect.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-17 19:43:26 +01:00
Pol Henarejos
fc40588547 Fixes for FIDO with Pico SDK 1.5
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-17 11:49:09 +01:00
Pol Henarejos
e47c5412cf Fixes for Pico SDK 1.5
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-16 22:54:30 +01:00
Pol Henarejos
31f899416c Using new style.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-15 00:14:10 +01:00
Pol Henarejos
43ef33d60b Switching to new style.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-15 00:10:00 +01:00
Pol Henarejos
12bdcbd1f9 Harmonizing coding style.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-14 23:23:57 +01:00
Pol Henarejos
07c15e0a3c Lets try
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-30 15:39:22 +01:00
Pol Henarejos
8f68e9f8a3 Some tricks
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-30 13:30:11 +01:00
Pol Henarejos
a9eee861fe Adding support for chained apdu in emulation mode.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-17 00:06:17 +01:00
Pol Henarejos
00f9e9c408 Fix packed term.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-14 00:40:50 +01:00
Pol Henarejos
5d2dd5aa75 Compilation fixes
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-13 18:48:40 +01:00
Pol Henarejos
007782cd2b Moving debug data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-12 20:03:51 +01:00
Pol Henarejos
4919eb980f Added a major refactoring to include Emulated interface.
It works in combination with virtualsmarcard module (vpcd). It properly installed, it creates a virtual reader that can be interfaced via PCSC+vcpd. At user app level, it has no difference of having a physical smart card.

At this moment, it only works emulating a CCID interface.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-09 18:06:21 +01:00
Pol Henarejos
2d511df5d8 Fix alternating CCID and HID. (IT DOES NOT WORK)
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-08 23:56:48 +01:00
Pol Henarejos
411755dee4 Adding a secondary HID interface that emulates a keyboard.
With it, an app can send a password directly to the host, like it is typed by user.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-30 01:41:49 +01:00
Pol Henarejos
20bd2c8b41 Fix writting read buffer for itf > 0.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-30 01:40:22 +01:00
Pol Henarejos
70979da57a Remove debug line.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-28 17:05:19 +01:00
Pol Henarejos
a8fe504d14 No more discrimination related with core0/core1. using get_core_num() returns the core number.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-24 01:38:09 +01:00
Pol Henarejos
88b2978ae5 Fix ATR response.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-22 22:50:37 +01:00
Pol Henarejos
b0bfc410a4 Thread on CORE1 is reset at every call.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-22 20:39:01 +01:00
Pol Henarejos
3310b911fc APDU header is defined at apdu_processing, depending on the interface.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-22 20:38:34 +01:00
Pol Henarejos
24522b9db8 Fix selecting FIDO AID when MSG.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-22 19:32:02 +01:00
Pol Henarejos
cd3ab0682c Fix initiating driver for CCID and buffers.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-22 19:31:39 +01:00
Pol Henarejos
e99757ed52 Fix with size of descriptor in single interface mode.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-20 23:51:14 +01:00
Pol Henarejos
6faebdf309 TUD options are declared on compile time depending on enabled interfaces.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-20 23:50:51 +01:00
Pol Henarejos
e5825df5cb Added capability to add multiple interfaces: HID and CCID at compile time.
Depending on compiling flags, HID and/or CCID may be enabled independently and run simultaneously.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-12-20 23:41:24 +01:00
Pol Henarejos
0bc13df1a2 Queues are emptied at begining of card thread.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-11-28 18:54:01 +01:00
Pol Henarejos
a3f060a79d Setting own VID/PID (despite they are useless).
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-11-28 17:36:40 +01:00
Pol Henarejos
c4178fda4b Fix when multiple shutdowns are sent
Thread queues are empty on every start to avoid ancient messages from previous sessions.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-11-24 20:21:06 +01:00
Pol Henarejos
4a8a6728c7 Adding support for specific vendor HID command (0x41).
It is a self implementation, based on CBOR command.
data[0] conveys the command and the contents mapped in CBOR encoding.
The map uses the authConfig template, where the fist item in the map is the subcommand (enable/disable at this moment), the second is a map of the parameters, the third and fourth are the pinUvParam and pinUvProtocol.

With this format only a single vendor HID command is necessary (0x41), which will be used for all my own commands, by using the command id in data[0] like with CBOR.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-10-29 19:41:00 +02:00
Pol Henarejos
5bdc7ab202 Adding specific vendor command to unlock the device.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-10-17 17:38:58 +02:00
Pol Henarejos
8f14db677e Fix strange bug when usb cannot write.
In this case, the buffer is kept until the next success call.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-29 23:11:49 +02:00
Pol Henarejos
d0fe447416 Fix PING with no data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-29 16:59:30 +02:00
Pol Henarejos
2aff75a3ec Fix keepalive msg.
Only sent when CBOR is initiatied.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-27 22:09:16 +02:00
Pol Henarejos
815e865ced Moving some defines.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-27 12:23:43 +02:00
Pol Henarejos
3912775ccb Fix writting large packets.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-27 12:23:16 +02:00
Pol Henarejos
b70a7474f2 Possibly not necessary, as it returns 0 if there is no available.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-25 23:35:35 +02:00
Pol Henarejos
fa371643a1 Fix writing large usb buffers.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-25 23:23:07 +02:00
Pol Henarejos
55d4839e21 Adding missing function to ccid driver.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-25 20:34:18 +02:00
Pol Henarejos
18fa1d7f37 Reseting previous command if new arrives.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-25 18:09:37 +02:00
Pol Henarejos
f8590ba8c7 Added CTAPHID_CANCEL support.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-23 18:07:27 +02:00
Pol Henarejos
4d7101b802 Fix send_keepalive with auxiliary buffer.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 23:53:55 +02:00
Pol Henarejos
7fded7234b Adding extra buffer to tx.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 22:52:56 +02:00
Pol Henarejos
988d4e23c2 Fix combining APDU MSG and keepalive.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 22:52:41 +02:00
Pol Henarejos
c23f17107a Random functions shall be called for each core, otherwise it will hung.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 20:18:05 +02:00