openwsn-berkeley / lakers

EDHOC implemented in Rust, optimized for microcontrollers, with bindings for C and Python.
https://crates.io/crates/lakers
BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

fix!: Make structs not Copy+Clone #114

Closed chrysn closed 8 months ago

chrysn commented 9 months ago

Having EDHOC state structs Copy+Clone is a dangerous footgun, because it'd allow reusing a state that has already processed some message -- without the protections of the state transition checks, because they would not see a clone.

I think that this would best be extended to the low-level (proof) structs as well, but at least the way things are expressed now that's not trivial, so doing the easy and effective thing first.

chrysn commented 9 months ago

With the second commit on this, this is extended to the low-level structs.

This required changes to the higher-level structs' mechanisms as well, but that is really necessary: Otherwise, the user could resume after an error, which AIU is not something that should be done.