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

Enable more digest-related functionality for *ring*. #194

Merged
merged 4 commits into from Sep 22, 2017
Merged

Enable more digest-related functionality for *ring*. #194

merged 4 commits into from Sep 22, 2017

Conversation

briansmith
Copy link
Contributor

No description provided.

Copy link
Member

@bluejekyll bluejekyll left a comment

Choose a reason for hiding this comment

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

This is looking good so far. Let me know when it's ready for merge.

/// This will always error, enable openssl feature at compile time
#[cfg(not(feature = "openssl"))]
#[cfg(not(any(feature = "openssl", feature = "ring")))]
pub fn hash(&self, _: &[u8]) -> DnsSecResult<Vec<u8>> {
Err(DnsSecErrorKind::Message("openssl feature not enabled").into())
Copy link
Member

Choose a reason for hiding this comment

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

maybe change this error to say "openssl or ring"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pub fn digest_all(&self, data: &[&[u8]]) -> DnsSecResult<Digest> {
use std::io::Write;

let digest_type = try!(self.to_openssl_digest());
Copy link
Member

Choose a reason for hiding this comment

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

just an FYI, I'm slowly upgrading the code to use ? instead of try!. This doesn't need to be changed, but if you want to use '?' feel free.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's leave it using try! for this set of patches, but I'll remember this in the future and switch to ?.

} else {
return false;
})
.map(|hash| hash.as_ref() == self.digest())
Copy link
Member

Choose a reason for hiding this comment

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

ha, I love it when I forget to just return the result of ==. This is definitely cleaner.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 88.095% when pulling 109fe30 on briansmith:ring-digest into 2b9bc20 on bluejekyll:master.

@briansmith
Copy link
Contributor Author

This looks ready to go, as it passed CI and I addressed your review comments.

@bluejekyll
Copy link
Member

Just needed to update the branch. Assuming tests pass, I'll merge in.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.002%) to 88.076% when pulling 0a56c83 on briansmith:ring-digest into 2b9bc20 on bluejekyll:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants