BitBoxSwiss / bitbox02-firmware

Firmware code of the BitBox02 hardware wallet
https://bitbox.swiss/bitbox02
Apache License 2.0
217 stars 81 forks source link

rust: remove str_to_cstr and str_to_cstr_force #1044

Closed benma closed 1 year ago

benma commented 1 year ago

Simplify code by using str_to_cstr_vec instead (which we already use in many places for the same purpose), which uses core::alloc::CString for conversion. Since it uses a Vec (heap), one does not have to determine a mac size upfront.

This also saves 4k in binary space, as the macro apparently duplicated a lot of code.