RustCrypto / utils

Utility crates used in RustCrypto
450 stars 130 forks source link

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

Closed newpavlov closed 5 months ago

newpavlov commented 5 months 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.