-
Notifications
You must be signed in to change notification settings - Fork 27
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 clippy::unwrap_used
lint
#515
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -767,6 +767,7 @@ impl RsaKeyData { | |
/// Generates a new RSA key data set from two randomly generated, secret, primes. | ||
/// | ||
/// Panics if `secret_p` or `secret_q` are invalid primes. | ||
#[allow(clippy::unwrap_used)] // TODO(tarcieri): make fallible and handle errors | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like there are a lot of situations where malformed/malchosen |
||
pub fn new(secret_p: &[u8], secret_q: &[u8]) -> Self { | ||
let p = BigUint::from_bytes_be(secret_p); | ||
let q = BigUint::from_bytes_be(secret_q); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,7 +371,7 @@ impl YubiKey { | |
} | ||
|
||
// send a response to the cards challenge and a challenge of our own. | ||
let response = mgm_key.decrypt(challenge.data()[4..12].try_into().unwrap()); | ||
let response = mgm_key.decrypt(challenge.data()[4..12].try_into()?); | ||
|
||
let mut data = [0u8; 22]; | ||
data[0] = TAG_DYN_AUTH; | ||
|
@@ -517,8 +517,7 @@ impl YubiKey { | |
|
||
// TODO(tarcieri): double check this is little endian | ||
let tnow = SystemTime::now() | ||
.duration_since(UNIX_EPOCH) | ||
.unwrap() | ||
.duration_since(UNIX_EPOCH)? | ||
.as_secs() | ||
.to_le_bytes(); | ||
|
||
|
@@ -648,7 +647,11 @@ impl YubiKey { | |
return Err(Error::AuthenticationError); | ||
} | ||
|
||
Ok(response.data()[4..12].try_into().unwrap()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing actually checked |
||
Ok(response | ||
.data() | ||
.get(4..12) | ||
.ok_or(Error::SizeError)? | ||
.try_into()?) | ||
} | ||
|
||
/// Verify an auth response. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out we don't actually use this