secrets icon indicating copy to clipboard operation
secrets copied to clipboard

Align `Secret` to the page size of the current system.

Open stouset opened this issue 5 months ago • 1 comments

Closes #109.

Multiple Secret<T> instances could previously share the same memory page. This would cause funlock to unlock multiple secrets at a time. With secrets aligned to page boundaries, we ensure that no two secrets can share the same page.

Additionally we had detected the multiple-unlock case in Windows, which returns an error when funlock is called on an already-unlocked page. We swallowed errors in this case, but with this change we no longer need to do so.

stouset avatar Aug 14 '25 21:08 stouset

I hate this approach. I'm going to play around and see if I can get a #[repr(align(…))] one to work.

stouset avatar Aug 14 '25 22:08 stouset