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

Add specs for compare methods of OpenSSL #1107

Merged
merged 2 commits into from
Nov 12, 2023

Conversation

herwinw
Copy link
Member

@herwinw herwinw commented Nov 11, 2023

This is a very crude spec that just checks to see if the results are correct. These methods have the guarantee to run in constant time regardless of the input, which is not under test.

input1 = "the quick brown fox jumps over the lazy dog"
input2 = "the lazy dog jumps over the quick brown fox"
OpenSSL.fixed_length_secure_compare(input1, input2).should be_false
end
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: it also makes sense to illustrate that length is bytes count, not characters count (as far as I see in the implementation)

@andrykonchin
Copy link
Member

Thank you!

@andrykonchin andrykonchin merged commit 745cac7 into ruby:master Nov 12, 2023
10 checks passed
@herwinw herwinw deleted the openssl_compare branch November 12, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants