Commit Graph

156 Commits

Author SHA1 Message Date
Pol Henarejos
7738c1902e Added permanent memory region to store data that remains persistent even after an initialization. To delete it, the device must be fully wiped.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-08-18 19:48:13 +02:00
Pol Henarejos
2df878232b File new should return file_t pointer if it exists in the file table.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-08-18 11:57:01 +02:00
Pol Henarejos
be86197b0b Added macro to disable APDU debug.
It will speed up the device notably.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-14 19:12:17 +02:00
Pol Henarejos
d1b52d9521 PUK AUT may return 0x9001.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-12 18:07:13 +02:00
Pol Henarejos
3397f25bf0 Simply generic_hash()
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-10 16:37:06 +02:00
Pol Henarejos
9ea71fb45b Fix DEBUG_PAYLOAD().
It might overlap variables.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-09 17:28:27 +02:00
Pol Henarejos
fe53f9a729 Another fix with RAPDU in C0.
A STATUS_SLOT may be sent in between of consecutive C0. Thus, RAPDU shall be reset on every answer, even if it is partial.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-06 02:18:32 +02:00
Pol Henarejos
f44658eb63 Fix preparing next RAPDU in C0 response. 2022-06-06 01:44:41 +02:00
Pol Henarejos
2b8c23f593 Upgrading to version 2.0.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
v2.0
2022-06-06 00:11:24 +02:00
Pol Henarejos
9cfe762043 low_flash_available() should be called outside.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-03 20:11:14 +02:00
Pol Henarejos
07305e6fd7 Fix returning error message.
If return code is not 0x9000, RAPDU is cleared.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-03 16:04:31 +02:00
Pol Henarejos
8bdcfa1041 Replacing with asn1 tag len function.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-03 11:16:25 +02:00
Pol Henarejos
7249fb129b Using custom mbedtls configuration file.
We disable lots of unwanted algorithms and suites and we only keep those are used.
2022-06-01 12:57:24 +02:00
Pol Henarejos
199095c204 Moving some ASN1 procedures to a separate file. 2022-06-01 09:45:27 +02:00
Pol Henarejos
67efd73a96 Not used anymore.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-31 20:38:43 +02:00
Pol Henarejos
fa4ecf658f Implementing own functions for cvc manipulation.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-31 18:51:43 +02:00
Pol Henarejos
8d409023bf Fix Ne value for legacy apdu. 2022-05-31 00:04:46 +02:00
Pol Henarejos
950e276ee8 Adding asn1_find_tag() for searching for a tag in a asn1 string. 2022-05-30 23:31:17 +02:00
Pol Henarejos
ef52ae37d3 Reorganizing usb layer. 2022-05-30 12:20:42 +02:00
Pol Henarejos
58e9e67ee5 Fix with data and extended length. 2022-05-30 00:51:36 +02:00
Pol Henarejos
acde4c54d5 Fix timeout. 2022-05-30 00:14:44 +02:00
Pol Henarejos
46603fa390 If the he packet is multiple 64 bytes, we trunk it.
It is a weird bug that affects PHY of rp2040.
2022-05-29 03:34:22 +02:00
Pol Henarejos
8bb47e7979 Compilation fixes in debug mode 2022-05-29 03:33:40 +02:00
Pol Henarejos
e0bff38384 Moving again to TinyUSB 2022-05-29 01:52:44 +02:00
Pol Henarejos
152a2fa031 Fix warnings 2022-05-27 20:58:28 +02:00
Pol Henarejos
79878a76c2 More fixes 2022-05-27 09:04:08 +02:00
Pol Henarejos
da871e695e More and more fixes. 2022-05-27 00:36:44 +02:00
Pol Henarejos
d4b0978d50 More fixes 2022-05-26 14:15:16 +02:00
Pol Henarejos
77ce276b59 First attempt to run away from tinyUSB to our code.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-26 00:03:38 +02:00
Pol Henarejos
56453b60d6 Added fmd flag to wrap FCP to include later the FMD.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 23:30:01 +02:00
Pol Henarejos
bd178c86e4 Added check.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 20:52:31 +02:00
Pol Henarejos
cd6a2dd4b5 Fix for new meta data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 20:52:01 +02:00
Pol Henarejos
24502966ce Fix finding meta_data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 20:41:04 +02:00
Pol Henarejos
3431293d43 Optimized special case when new meta data length is the same.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 15:54:07 +02:00
Pol Henarejos
21f70601b4 Avoid unnecessary memcpy
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 15:20:59 +02:00
Pol Henarejos
c4e781103f Fix with write offsets.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 14:43:08 +02:00
Pol Henarejos
6c90ce3361 Add meta functions for manipulating meta data.
Added meta_add(), meta_delete() and meta_find().
It conveys this meta data throught tag A5 of FCP.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 14:42:54 +02:00
Pol Henarejos
1a58422cd8 flash_write_data_to_file() now accepts offset argument.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 14:28:30 +02:00
Pol Henarejos
5a30c7cbdc format_tlv_len() accepts NULL argument.
In that case, it returns the length of the length in bytes.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 14:27:49 +02:00
Pol Henarejos
5e2fc081f1 Added high level functions for reading file and returning file size.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 00:18:43 +02:00
Pol Henarejos
d19429cb84 Fix handling dynamic files.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-23 19:56:26 +02:00
Pol Henarejos
7ed4cb912e These fids are propertary.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-23 14:43:09 +02:00
Pol Henarejos
efb6c8d8cd Adding Life-cycle status to FCP.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:49:30 +02:00
Pol Henarejos
f7d30d7f4d Adding FCP tag template. Some apps could require FMD tag.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:37:57 +02:00
Pol Henarejos
de39035d9f FCI name (tag 84) has 16 bytes max length.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:34:00 +02:00
Pol Henarejos
ae935d19f8 Fix sending FCI name tag.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:33:14 +02:00
Pol Henarejos
de04dd6121 Should be with this values.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-05 22:27:01 +02:00
Pol Henarejos
9c5250f6ca Adding timeout for press button of 15 secs.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-05 20:03:17 +02:00
Pol Henarejos
cddc3b2dec Adding name to FCP
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-04-20 14:13:43 +02:00
Pol Henarejos
16f23dfa6c Upgrading to v1.1. v1.1 2022-04-19 19:22:22 +02:00