RustCrypto / utils

Utility crates used in RustCrypto
427 stars 123 forks source link

block-buffer: improve safety comments, use `MaybeUninit` for internal buffer #1081

Closed newpavlov closed 1 month ago

newpavlov commented 1 month ago

Marks private unchecked methods as unsafe and documents their safety requirements. Adds SAFETY comment for all unsafe uses. Use of copy_nonoverlapping ensures that compiler will not generate unreachable panic branches. Use of MaybeUninit removes unnecessary initialization and helps to test that we do not read bytes which were not written by us.

The code successfully passes MIRI tests, but I plan to test this implementation more thoroughly later.