Skip to content

normalize s2n_stuffer and s2n_blob #4944

Open
@jmayclin

Description

Problem:

s2n_stuffer and s2n_blob have confusingly non-normalized fields.

s2n_stuffer defines growable and allocd fields.
s2n_blob also defines growable and allocated fields.

The semantics of this are very confusing. What would it mean for an allocated stuffer to have a non-allocated blob? Isn't "allocated-ness" purely a property of the blob?

Solution:

After some investigation with #4943, my understanding is as follows.

  1. s2n_blob should remove the growable field. This is extensively documented in the above PR, but essentially, any blob that is alloced is growable. If it isn't alloced, it isn't growable.
  2. s2n_stuffer should remove the allocd field. I was playing around with some unit tests, and I was able to make this change with breaking any unit tests. But trying to remove growable from the stuffer broke lots of things, which makes sense.

stuffer "growable" semantics are used to deliberately fail writes that are too large. This is a valuable behavior that we want to keep. (but this logic should be documented in the code 🙂)

Requirements / Acceptance Criteria:

  1. remove growable from s2n_blob.
  2. remove alloced from s2n_stuffer.

And preferably add some comments about why the fields exist and what they accomplish.

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions