Skip to content

Add a zeroizing allocator to the zeroize crate - #1600

Draft
rlee287 wants to merge 3 commits into
RustCrypto:masterfrom
rlee287:zeroizing_allocator
Draft

rlee287 wants to merge 3 commits into
RustCrypto:masterfrom
rlee287:zeroizing_allocator

Conversation

@rlee287

@rlee287 rlee287 commented Nov 13, 2026

Copy link
Copy Markdown

This PR adds a zeroizing allocator to the zeroize crate. I have marked it as a draft pending any discussions that we might want to have regarding the MSRV bump that the addition would require (and whether we might e.g. want to feature-gate this addition accordingly).

@rlee287
rlee287 force-pushed the zeroizing_allocator branch from 67b294c to 4244b2b Compare November 13, 2026 04:25
@tarcieri

Copy link
Copy Markdown
Member

We tend to bump the zeroize MSRV fairly conservatively as each time we do (particularly when we bump it beyond what stable Debian provides) we tend to get a lot of complaints, e.g. #1067

@rlee287
rlee287 force-pushed the zeroizing_allocator branch 2 times, most recently from 8ede5d1 to 1564cf8 Compare November 13, 2026 21:52
@rlee287

rlee287 commented Nov 13, 2026 •

Copy link
Copy Markdown
Author

v2 pushed:

  • allocator is now feature-gated and not enabled by default, to avoid bumping MSRV
  • Use &mut [MaybeUninit<u8>] to handle padding bytes correctly
  • typofixes, cargo fmt, some more documentation

@tarcieri

Copy link
Copy Markdown
Member

Thanks, will review this when I have time. Great idea, we've discussed it in the past I think but I can't find an issue.

@rlee287
rlee287 marked this pull request as ready for review November 14, 2026 01:15

@newpavlov newpavlov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allocator is now feature-gated and not enabled by default, to avoid bumping MSRV

Personally, I would prefer to not do this this. Maybe we could keep it in a separate crate?

Comment thread zeroize_allocator/src/lib.rs Resolved
@rlee287

rlee287 commented Nov 14, 2026

Copy link
Copy Markdown
Author

allocator is now feature-gated and not enabled by default, to avoid bumping MSRV

Personally, I would prefer to not do this this. Maybe we could keep it in a separate crate?

I'm fine either way, but if I'm going to submit an updated patchset making a new crate, I'd rather fix any other issues with the code first (e.g. the comment above about byte slice zeroization being inefficient).

@tarcieri

Copy link
Copy Markdown
Member

Yeah a new crate is probably the easiest way to start

@rlee287
rlee287 force-pushed the zeroizing_allocator branch 2 times, most recently from f5078b4 to 56fa014 Compare November 24, 2026 05:22
This is placed in a new crate, zeroize_allocator, instead of the existing
zeroize crate in order to avoid bumping the MSRV of the zeroize crate.
@rlee287
rlee287 force-pushed the zeroizing_allocator branch from 785abe0 to e3ce8c8 Compare November 24, 2026 05:43
@rlee287
rlee287 marked this pull request as draft November 24, 2026 05:55
@rlee287

rlee287 commented Nov 24, 2026

Copy link
Copy Markdown
Author

Updated to have a separate crate zeroize_allocator, and marking as draft while I work through Github CI failures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants