Commit 6a8e588
committed
fix(u2f): replace production assert! in U2F register response upgrade
`RegisterResponse::try_upgrade` asserts that the canonical CBOR
encoding of the synthesized COSE P-256 key is exactly 77 bytes. The
77-byte assumption holds for current `cosey 0.3` output, but is
implementation-defined: a future `cosey` revision adding an optional
field (e.g., `kid`) would round-trip to a slightly different size and
panic the host process. The recent panic-removal pass (commit 5df814b)
missed this site because `clippy::panic` does not lint `assert!`.
Replace the assertion with a typed length check that returns
`Error::Platform(PlatformError::CryptoError(...))` on mismatch.1 parent 82e5acf commit 6a8e588
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
| |||
0 commit comments