Repository navigation
Answer 6A80 instead of panicking when the backend refuses a key mechanism - #58
FlorianFranzen wants to merge 2 commits into
Conversation
|
Which runner did you use to test it? A missing mechanism should be caught at compile time by the mechanism validation. |
|
I used the solo2 LPC55 runner, as I do not have any Nitrokey development hardware yet. It has no mechanism validation, so the first P-384 And it is not the only runner with this issue. The usbip runner also has this problem, as it purposeful exempts P-384 to return an error at runtime. Tested at The red CI is the SELECT test with iso7816 0.2.2, fixed in #49. |
|
I see. I agree that we should avoid the panicking syscalls, I was just wondering how you hit the case and if there is a bug in the mechanism checks. |
|
Our OpenPGP implementation takes a different approach to this, it has a runtime config that can be used to disable/enable specific algorithms and features. This seems a better approach to me than making all syscalls fallible. |
GENERATE ASYMMETRIC and the RSA arm of IMPORT ASYMMETRIC KEY used
syscall!, so a trussed built without the requested mechanism (P-384 on a runner usingdefault-mechanisms, or RSA without the RSA backend) panicked: no status word, pcscd blocked until a power cycle. Both now usetry_syscall!and answer6A80, as the app already does for an unknown algorithm byte. ECC import already handled this.The virtual card has every mechanism, so the suite cannot hit the error path. Checked on an LPC55S69 without
p384: the P-384 generate now answers6A80and the card keeps working.