fix clippy warnings

This commit is contained in:
dlblv 2022-12-21 01:11:17 +05:00
parent 50dbb9eb4d
commit 7374fd3d2f
2 changed files with 3 additions and 3 deletions

View file

@ -25,12 +25,12 @@ use x25519_dalek::EphemeralSecret;
use x25519_dalek::PublicKey;
fn bench_diffie_hellman(c: &mut Criterion) {
let bob_secret = EphemeralSecret::new(&mut OsRng);
let bob_secret = EphemeralSecret::new(OsRng);
let bob_public = PublicKey::from(&bob_secret);
c.bench_function("diffie_hellman", move |b| {
b.iter_with_setup(
|| EphemeralSecret::new(&mut OsRng),
|| EphemeralSecret::new(OsRng),
|alice_secret| alice_secret.diffie_hellman(&bob_public),
)
});

View file

@ -174,7 +174,7 @@ impl StaticSecret {
/// Perform a Diffie-Hellman key agreement between `self` and
/// `their_public` key to produce a `SharedSecret`.
pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret {
SharedSecret(&self.0 * their_public.0)
SharedSecret(self.0 * their_public.0)
}
/// Generate an x25519 key.