Commit Graph

113 Commits

Author SHA1 Message Date
Pol Henarejos
3182d1e2e6 Fixed potential crash.
board_button_read() disables interrupts and cannot be parallelized when flash is being used. It is imperative that core1 must not use flash during the board_button_read(). Since it is not feasible to put mutexes in *every* flash memory read/write in core1, it is preferable to wait until core1 finishes command execution.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-31 00:40:38 +01:00
Pol Henarejos
4f0925420b Fix HID version.
Select fido app when necessary.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-28 20:51:18 +02:00
Pol Henarejos
c896741114 Report descriptor shall contain FEATURE report too for Windows compatibility.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-28 20:32:31 +02:00
Pol Henarejos
f801f73f72 Report ID for keyboard shall be 0.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-28 20:32:04 +02:00
Pol Henarejos
eef2f190f2 New format for applet selection.
AID comparison is performed by the kernel. If it is the same as previously loaded, do nothing. If not found, do nothing. If found and is different, unload old and load the new one.

All other applets shall be migrated to new format.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-11 21:02:04 +02:00
Pol Henarejos
42dcdd3372 Fix when chunking
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-09-24 10:31:35 +02:00
Pol Henarejos
910b2fb75a Added NO_DELAY in emulation env.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-09-05 18:14:18 +02:00
Pol Henarejos
c7849e0bda Added support to Nitrokey's nitropy tool.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-05-16 09:22:52 +02:00
Pol Henarejos
46e7d3a181 Fix otp processing if other applications were processed before.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-31 00:41:12 +02:00
Pol Henarejos
38fb8018e6 Add extern crc.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-30 23:44:21 +02:00
Pol Henarejos
94f9f2fdac Add bool header.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-30 00:57:41 +02:00
Pol Henarejos
630da663c4 Added support for APPEND_CR.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-30 00:51:49 +02:00
Pol Henarejos
ef0fb29f29 Added encoding support for keyboard hid.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-30 00:37:07 +02:00
Pol Henarejos
c11d403f12 Added support for OTP interface.
This interface enables a HID Keyboard interface to send keystrokes to host. Also, it enables bidirectional flow through set/get report with 8-bytes chunked frames of 70 bytes.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-28 23:32:43 +02:00
Pol Henarejos
ec9eb7c436 Fix race condition.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-14 09:57:50 +01:00
Pol Henarejos
599e5edbd1 Fix conditional interface compilation.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-04 14:16:45 +01:00
Pol Henarejos
15569ab419 Update code style.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-04 14:10:46 +01:00
Pol Henarejos
3b268a33eb Sending keepalive on cbor processing.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-03 00:50:13 +01:00
Pol Henarejos
86613453ae Sending timeout command.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-03 00:48:42 +01:00
Pol Henarejos
96f2dab74b Fix init_cmd channel.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-03 00:22:45 +01:00
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