Skip to content

bench: s2n_constant_time_equals#4717

Closed
jmayclin wants to merge 6 commits intoaws:mainfrom
jmayclin:constant-time-benching
Closed

bench: s2n_constant_time_equals#4717
jmayclin wants to merge 6 commits intoaws:mainfrom
jmayclin:constant-time-benching

Conversation

@jmayclin
Copy link
Copy Markdown
Contributor

Resolved issues:

Related to #4709

Description of changes:

This adds benchmarks specifically for s2n_constant_time_equals.

Testing:

Existing CI should pass.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions Bot added the s2n-core team label Aug 20, 2024
@jmayclin jmayclin marked this pull request as ready for review August 20, 2024 01:45
Comment thread bindings/rust/bench/benches/constant_time_equals.rs Outdated
Comment thread bindings/rust/bench/benches/constant_time_equals.rs Outdated
Comment thread bindings/rust/bench/benches/constant_time_equals.rs Outdated
unsafe { s2n_constant_time_equals(a.as_ptr(), b.as_ptr(), a.len() as u32) }
}

fn comparison(criterion: &mut Criterion) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What are we trying to do with this PR? Like, it is relevant for #4709, but once that is merged we're not really going to have a use for this comparison. If we're actually trying to benchmark s2n_constant_time_equals(), I would expect to see a test that checks that the comparison of [1, 2, 3, 4, 5] to [1, 0, 0, 0, 0] takes exactly as much time as the comparison of [1, 2, 3, 4, 5] to [1, 2, 3, 4, 5]. But maybe we trust that that case is covered with cbmc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ya, I see this benchmark function as being strictly interested in the performance of s2n_constant_time_equals, and not at all concerned with the correctness of it. We formally assert its correctness with the ctverif proofs.

Comment thread bindings/rust/bench/benches/constant_time_equals.rs
jmayclin and others added 4 commits August 22, 2024 11:31
Co-authored-by: maddeleine <59030281+maddeleine@users.noreply.github.com>
Co-authored-by: maddeleine <59030281+maddeleine@users.noreply.github.com>
Co-authored-by: maddeleine <59030281+maddeleine@users.noreply.github.com>
- add comment for black_box
@jmayclin jmayclin requested a review from maddeleine August 22, 2024 18:36
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 3, 2024

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants