Skip to content

Commit

Permalink
Avoid unwrap (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth authored Jul 7, 2023
1 parent b4128a3 commit a866c04
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions aws-lc-rs/src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,8 @@ where
KeyInner::ECDH_P256(ec_key) | KeyInner::ECDH_P384(ec_key) | KeyInner::ECDH_P521(ec_key) => {
let pub_key_bytes = peer_public_key.bytes.as_ref();
unsafe {
let result =
ec_key_ecdh(&mut buffer, ec_key.as_const(), pub_key_bytes, expected_nid);
if result.is_err() {
return Err(error_value);
}
result.unwrap()
ec_key_ecdh(&mut buffer, ec_key.as_const(), pub_key_bytes, expected_nid)
.or(Err(error_value))?
}
}
};
Expand Down

0 comments on commit a866c04

Please sign in to comment.