Skip to content

Zeroization policy for temporary variables stored on the stack #38

Description

@newpavlov

As noted in this comment it's unclear whether it's worth to explicitly zeroize temporaries stored on the stack. It's hard to do reliably and it prevents various optimizations (e.g. keeping the temporaries in registers) since zeroization is considered as a side effect by the compiler.

We have 3 options:

  1. Explicitly erase some temporaries on the case-by-case basis (e.g. large temporary buffers).
  2. Do not erase temporaries explicitly (it still may happen implicitly via Drop impls) and recommend to use zeroize::zeroize_stack in user code.
  3. Do not erase temporaries explicitly, but use zeroize::zeroize_stack in libraries using case-by-case judgment.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions