chipsalliance / caliptra-sw

Caliptra software (ROM, FMC, runtime firmware), and libraries/tools needed to build and test
Apache License 2.0
55 stars 40 forks source link

caliptra-runtime and caliptra-dpe error codes are terrible #956

Closed korran closed 10 months ago

korran commented 12 months ago

I'm seeing multiple layers of this pattern scattered all over the firmware, mostly at the interface between caliptra-runtime and caliptra-dpe, and caliptra-dpe and the lower-level crypto implementation.

We are throwing away the lower-level error code, and the replaced error codes aren't even unique

https://github.com/chipsalliance/caliptra-dpe/blob/a2c3717f300ec11d61639515bbaeb431f6307fb4/dpe/src/commands/sign.rs#L45-L48

https://github.com/chipsalliance/caliptra-sw/blob/203e80c42cd033b46b3eb340abb35cc09730d920/runtime/src/invoke_dpe.rs#L57-L58

https://github.com/chipsalliance/caliptra-sw/blob/203e80c42cd033b46b3eb340abb35cc09730d920/runtime/src/invoke_dpe.rs#L111

https://github.com/chipsalliance/caliptra-sw/blob/203e80c42cd033b46b3eb340abb35cc09730d920/runtime/src/dpe_crypto.rs#L86-L88

https://github.com/chipsalliance/caliptra-sw/blob/203e80c42cd033b46b3eb340abb35cc09730d920/runtime/src/dpe_crypto.rs#L119-L124

This makes it very difficult to discover why something isn't working.

jhand2 commented 11 months ago

Partially addressed by https://github.com/chipsalliance/caliptra-dpe/pull/247. I'll follow up with fixes in RT to expose the the extended error info registers

Also next time please ask nicely :)