Skip to content

Is zeroing of data->internal without reset of data->initialized safe? #204

@solardiz

Description

@solardiz

This issue is a code review in progress. I see no suitable issue label for that, so am leaving it with none.

While reviewing #201, I looked into other places where we may zeroize the data struct, and found this:

struct crypt_internal *cint = get_internal (data);

  struct crypt_internal *cint = get_internal (data);
  h->crypt (phrase, phr_size, setting, set_size,
            (unsigned char *)data->output, sizeof data->output,
            cint->alg_specific, sizeof cint->alg_specific);

  explicit_bzero (data->internal, sizeof data->internal);

This zeroizes internal, but leaves the initialized field as-is. For hash implementations that compute and cache constants in internal, like I think descrypt does, doesn't this result in incorrect computation on the next call?

How does this even pass tests? Maybe I'm misinformed and our descrypt doesn't cache anything anymore?

Let's at least figure this out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions