Commit Graph

186 Commits

Author SHA1 Message Date
Pol Henarejos
7f7e94c639 Use new names and selecting aid.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-11-06 15:23:54 +01:00
Pol Henarejos
91bcd9f9cd Fix EdDSA signature return format.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-09-05 01:04:44 +02:00
Pol Henarejos
865eafb1f3 Fix Curve25519 key import.
For an unknown reason, curve25519 keys are imported in big endian instead of little endian.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-09-05 00:25:39 +02:00
Pol Henarejos
88f5bbfd58 Added support for Ed25519.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-09-05 00:18:06 +02:00
Pol Henarejos
9ea894b60b Use mbedtls read/write keys wrappers.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-08-28 01:25:28 +02:00
Pol Henarejos
b815dc35c8 Fix initializing DEK for pw3.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-05-17 00:04:57 +02:00
Pol Henarejos
5eb6822bf5 Update code style.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-03-04 14:08:47 +01:00
Pol Henarejos
73c1bf786d Upgrade to v1.10
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-06 00:03:18 +01:00
Pol Henarejos
3c7df3aa42 Fix checking length in ECDH.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 23:44:55 +01:00
Pol Henarejos
e5871d5791 Fix returning algo attributes for authentication key.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 21:07:10 +01:00
Pol Henarejos
7ccbb0103f Fix computing length of algorithm attributes.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 21:06:33 +01:00
Pol Henarejos
8e03ce28a3 Fix returning signature in some cases.
In some particular cases where signature has a 0 prepended, mpi is written without that which caused variable length signatures. Now it returns the signature whose length is always the same.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 20:28:33 +01:00
Pol Henarejos
b300ed87f3 Fix returning ecdsa response for keys > 512 bits.
In that case, TLV shall contain 81 length.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 20:27:20 +01:00
Pol Henarejos
7b17cc7b49 Public point is now computed when private key is imported.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 19:44:44 +01:00
Pol Henarejos
abf190f767 Tuned returning public key information for ECDSA.
Despite it was not a bug, it seems some ASN.1 readers do not recognize 0x81/0x82 tags when len < 128.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 19:44:00 +01:00
Pol Henarejos
d9ed002af2 Signature counter is only increased on PSO:SIGN and not for authentication.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 01:31:34 +01:00
Pol Henarejos
e1407636b8 Fix DEK loading when resetting code is used.
If no pw3, on cmd_reset_retry pw1 is changed without providing the original, since it is done via rc. Thus, there is no way to recover DEK. To solve, another ciphered field is added for loading DEK via rc. In case rc is changed (PUT DATA), DEK is reciphered with new rc.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-04 01:23:03 +01:00
Pol Henarejos
d117442825 Adding emulation support.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 23:28:12 +01:00
Pol Henarejos
365acbd68b Fix setting RC.
When setting RC it was not hashed and then it was not recognized.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 20:21:14 +01:00
Pol Henarejos
f6facc1154 When a private key is imported, a public key is generated and stored.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 20:08:26 +01:00
Pol Henarejos
5e257729a3 Some fixes.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 19:17:42 +01:00
Pol Henarejos
4a629fe53f Fix returning size of some DO.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 17:27:02 +01:00
Pol Henarejos
22689b3784 Fix returning DO.
If the TLV container contains a single DO, the header is removed.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 17:25:18 +01:00
Pol Henarejos
4f1cd1f2f8 Fix returning sig counter.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 16:55:32 +01:00
Pol Henarejos
c9ef78b3c9 Fix returning app data.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 16:52:55 +01:00
Pol Henarejos
cf53fdd903 Adapt select_applet to new call.
Also fixes sex test.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-02-03 16:32:28 +01:00
Pol Henarejos
32868dfc31 Fix signature counter storage.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-09 17:33:43 +01:00
Pol Henarejos
303116ffea Fix P1P2 on termination check.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-01-09 17:10:12 +01:00
Pol Henarejos
23824afc1f Fix importing data with TLV length > 0x7f.
Should fix #3.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-11-29 20:21:47 +01:00
Pol Henarejos
25bddb7230 Upgrading to version 1.8.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-11-23 11:00:44 +01:00
Pol Henarejos
5ddfa6382b Upgrading to new pico-hsm-sdk module.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-08-30 17:48:44 +02:00
Pol Henarejos
35fb97c58f Upgraded to version 1.6
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-06 14:40:34 +02:00
Pol Henarejos
167b6d9770 Adapted to Pico CCID 2.0.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-06-06 01:01:52 +02:00
Pol Henarejos
d0c167345e Add fmd flag when selecting the applet.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-24 23:31:12 +02:00
Pol Henarejos
ca6affaf5d Adding private identifiers for cardholder certificates.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-20 19:03:22 +02:00
Pol Henarejos
7a77b31760 Adding INS GET NEXT DATA
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-20 19:02:55 +02:00
Pol Henarejos
9f069a7e31 When PUT DATA or GET DATA with previously selected EF (via SELECT or SELECT DATA), it puts/writes the data into the selected EF.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 19:48:31 +02:00
Pol Henarejos
a0384f67ca Adding INS A5 to select DO with multiple instances.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 19:40:17 +02:00
Pol Henarejos
32c6f60b49 Adding INS F1 to get version.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:58:35 +02:00
Pol Henarejos
0ab5526dac Adding FMD when selecting app by AID.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-15 18:50:45 +02:00
Pol Henarejos
eb066472b1 Adding AES support for symmetric encryption and decryption. However, there is no any software that supports AES. So, no tested feature.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-13 17:44:09 +02:00
Pol Henarejos
a2d1c5cf22 Adding key import.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-12 23:49:26 +02:00
Pol Henarejos
74aa99afa6 Adding Manage Security Environment (INS 22).
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-09 18:54:36 +02:00
Pol Henarejos
c68fe30077 Enabling KDF.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-06 19:44:27 +02:00
Pol Henarejos
21284a9375 When a DO is not found, it should return REFERENCE_NOT_FOUND instead of FILE_NOT_FOUND, which reserved for selecting applet.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-06 19:13:26 +02:00
Pol Henarejos
151f6d134e Adding UIF DO (D6, D7 and D8).
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-05 22:35:17 +02:00
Pol Henarejos
d95d19a85b Adding press-to-confirm when loading a private key.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-05 20:55:41 +02:00
Pol Henarejos
193220e59e Adding DEK to private keys.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-04-27 20:16:21 +02:00
Pol Henarejos
06745515eb Return SW_OK on VERIFY if user already logged in.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-04-26 21:46:13 +02:00
Pol Henarejos
30bb31a9c9 Adding life status for PW1 for PSO:CDS (single or several commands).
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-04-26 18:10:27 +02:00