The Wayback Machine - https://web.archive.org/web/20220408151247/https://github.com/aws/s2n-tls/issues/2078
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s2n_stuffer_skip_write usage pattern #2078

Open
baldwinmatt opened this issue Jun 26, 2020 · 2 comments
Open

s2n_stuffer_skip_write usage pattern #2078

baldwinmatt opened this issue Jun 26, 2020 · 2 comments
Labels
CBMC difficulty/beginner good first issue

Comments

@baldwinmatt
Copy link
Contributor

@baldwinmatt baldwinmatt commented Jun 26, 2020

Problem:

A common pattern is:

GUARD(s2n_stuffer_skip_write(stuffer, bytes_to_write));
uint8_t* ptr = suffer->blob.data + stuffer->write_cursor - bytes_to_write;

which could be simplified.

Solution:

*ptr could be an *out parameter to s2n_stuffer_skip_write

  • Does this change what S2N sends over the wire? No.
  • Does this change any public APIs? No.
  • Which versions of TLS will this impact? N/A.

Requirements / Acceptance Criteria:

What must a solution address in order to solve the problem? How do we know the solution is complete?

  • Testing: Existing tests should pass as is, however CBMC proofs will need to be updated to match thew new stuffer API
    • Will this change trigger SAW changes? No.
    • Should this change be fuzz tested? N/A

Out of scope:

Is there anything the solution will intentionally NOT address?

No

@danielsn
Copy link
Contributor

@danielsn danielsn commented Jun 26, 2020

Actually, would it make sense for the skip_write to return a s2n_blob_slice, so we carry around both the size, and the pointer together? https://github.com/awslabs/s2n/blob/0e74e54a14c4f48f95ebcb24cffd6690d0c11e4d/utils/s2n_blob.c#L55

@baldwinmatt
Copy link
Contributor Author

@baldwinmatt baldwinmatt commented Jun 30, 2020

Actually, would it make sense for the skip_write to return a s2n_blob_slice, so we carry around both the size, and the pointer together?

https://github.com/awslabs/s2n/blob/0e74e54a14c4f48f95ebcb24cffd6690d0c11e4d/utils/s2n_blob.c#L55

love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CBMC difficulty/beginner good first issue
2 participants