Commit Graph

83 Commits

Author SHA1 Message Date
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
Pol Henarejos
3092da23ed card_init_core1() shall be called from every thread launched on core1.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 19:24:07 +02:00
Pol Henarejos
e29521fcf6 Multiple bug fixes to pass HID tests.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 19:23:39 +02:00
Pol Henarejos
4ab68cc822 HID fixes.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-22 14:05:39 +02:00
Pol Henarejos
5a4aff7008 Adding KEEP_ALIVE response.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-20 15:31:34 +02:00
Pol Henarejos
8b97791d8f Reorganizing core0/core1 split.
Now CBOR and APDU (i.e., intensive processing) areas are executed on core1, while core0 is dedicated for hardware tasks (usb, button, led, etc.).
2022-09-20 14:39:59 +02:00
Pol Henarejos
847005d94f Adding support for clientPIN.
It does not pass the tests yet.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-19 17:20:52 +02:00
Pol Henarejos
4c49e59edc Major CTAP refactoring.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-15 14:16:40 +02:00
Pol Henarejos
42f3c67c61 Adding Credentials structure.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-14 17:27:00 +02:00
Pol Henarejos
607f7c50d4 Adding some macros for CBOR parsing.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-14 00:08:05 +02:00
Pol Henarejos
2cb59d57d2 Adding first attempt of adding make_credential.
It requires lot of efforts to parse CBOR incoming data.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-09-13 20:37:15 +02:00