Commit Graph

89 Commits

Author SHA1 Message Date
Pol Henarejos
4edc506759 Fix build for non-pico boards.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2025-09-22 23:35:46 +02:00
Pol Henarejos
5984d1f72d NK compatibility improvements.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2025-08-25 01:33:46 +02:00
Pol Henarejos
a75fd6b815 CTAP_RESP should be 0ed before sending.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2025-03-30 18:12:06 +02:00
Pol Henarejos
a08abaed0f Enable each USB interface independently depending on PHY parameters.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2025-03-22 23:25:31 +01:00
Pol Henarejos
f1b1382300 USB descriptors are now created dynamically.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2025-03-21 15:30:50 +01:00
Pol Henarejos
8e68e6cae9 Use BE/LE functions for packing uint16.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-12-23 21:00:38 +01:00
Pol Henarejos
86999d8cdd Do not debug after write the buffer.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-12-16 18:42:42 +01:00
Pol Henarejos
1431f91281 In pure U2F mode, no keepalive is sent by authenticator. Instead, client sends commands to know the status.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-12-11 22:36:24 +01:00
Pol Henarejos
f58bcaecf1 In pure U2F mode, no keepalive is sent by authenticator. Instead, client sends commands to know the status.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-12-11 22:36:09 +01:00
Pol Henarejos
e9875b358c Fix cancel command.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-12-03 08:35:20 +01:00
Pol Henarejos
6625678c30 Rename CCID_ codes to PICOKEY_
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-11-05 18:21:24 +01:00
Pol Henarejos
83c2eaa0b2 Remove printf.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-09-02 09:46:32 +02:00
Pol Henarejos
f8c4106367 Clear otp report before processing.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-30 00:33:48 +02:00
Pol Henarejos
7a88a2b8e7 Improved multicore synchronization. Now they exchange signals and protect areas atomically.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-23 19:24:18 +02:00
Pol Henarejos
90842bb8f7 Fix emulation build.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-23 14:24:17 +02:00
Pol Henarejos
65fea84df1 Fix warnings.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-23 13:17:10 +02:00
Pol Henarejos
fa6292118d Major refactor of USB CCID and USB HID interfaces. All interfaces are rewritten.
With this new scheme we ensure that:
- memcpy's are reduced.
- no race conditions are performed.
- critical areas are protected.
- callbacks are executed immediately.
- write's are executed after the positive report is received.
- no usb middle interface anymore.
- CCID and HID are totally independent.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-23 10:02:19 +02:00
Pol Henarejos
0745838e3f Fix when receiving a packet in the middle of a transmission. RX shall be always processed.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-20 16:39:44 +02:00
Pol Henarejos
e1dd57067e Fix when a keepalive packet collides with an ongoing transmission.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-20 16:39:08 +02:00
Pol Henarejos
38f0e2cc3a select_app now invokes U2F or FIDO depending on the message.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-20 14:29:11 +02:00
Pol Henarejos
d379a39bd6 keepalive should be sent without conditions and without reseting any buffer.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-19 16:44:58 +02:00
Pol Henarejos
11447371fe Rewritten continuous flow for HID.
HID uses complete_cb to send the next packet and not the value returned by tud_write. Therefore, no other writes can happen in between of a writing packet if fails.

This ensures a proper interface multiplexing and continuous flow.

Also, the read pointer is used to multiplex usb packets.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-08-19 00:06:24 +02:00
Pol Henarejos
9a607707f0 Merge branch 'main' into esp32
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-05-31 17:12:12 +02:00
Pol Henarejos
88071e1172 Some fixes.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-05-05 00:56:51 +02:00
Pol Henarejos
22d4e62952 Add procedure to compute unique ID at startup.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-04-17 11:31:11 +02:00
Pol Henarejos
8d86a8c56b Add procedure to compute unique ID at startup.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-04-15 23:44:51 +02:00
Pol Henarejos
023039deb2 Attempting to add support to esp32s3.
Will it work? Who knows...

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-04-04 21:01:55 +02:00
Pol Henarejos
9fdae7ef31 Fix HID compilation with new sizes.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2024-03-13 17:24:20 +01:00
Pol Henarejos
d0dc786f74 Rename project to Pico Keys SDK to avoid confusions with Pico Fido and Pico OpenPGP.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-11-06 13:32:28 +01:00
Pol Henarejos
899a7ed609 Move some functions from HID to fido callbacks.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-11-06 13:01:10 +01:00
Pol Henarejos
d253889747 Use get_version_major and get_version_minor as pointers.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-11-06 11:57:09 +01:00
Pol Henarejos
c9cb330a07 Move some OTP functions from HID to OTP.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-11-06 11:49:18 +01:00
Pol Henarejos
d580194030 Fix reading OTP packets from HID interface.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-10-31 17:34:09 +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
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
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
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
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
96f2dab74b Fix init_cmd channel.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-03 00:22:45 +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
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
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
5d2dd5aa75 Compilation fixes
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-13 18:48:40 +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