project-chip / rs-matter

Rust implementation of the Matter protocol. Status: Experimental
Apache License 2.0
329 stars 45 forks source link

Reduce allocations in crypto_rustcrypto.rs #54

Closed bjoernQ closed 1 year ago

bjoernQ commented 1 year ago

In crypto_rustcrypto.rs there were a few unnecessary .to_vec() calls on byte slices.

This was causing a lot of heap-memory fragmentation which became a problem on a very resource constrained device. Turned out these allocations are totally avoidable.

Side note: There were two failing tests before (and after) my changes:

I haven't had time to look into these but it's unlikely they relate to my changes.