This commit is contained in:
Christien Rioux
2023-09-02 18:50:12 -04:00
parent a77f80a8a9
commit b3354194e0
12 changed files with 70 additions and 161 deletions

View File

@@ -40,6 +40,6 @@ pub fn bytes_to_cache(bytes: &[u8], cache: &mut DHCache) {
let v = DHCacheValue {
shared_secret: SharedSecret::new(d[64..96].try_into().expect("asdf")),
};
cache.insert(k, v, |_k, _v| {});
cache.insert(k, v);
}
}

View File

@@ -310,13 +310,10 @@ impl Crypto {
secret: &SecretKey,
) -> VeilidAPIResult<SharedSecret> {
Ok(
match self.inner.lock().dh_cache.entry(
DHCacheKey {
key: *key,
secret: *secret,
},
|_k, _v| {},
) {
match self.inner.lock().dh_cache.entry(DHCacheKey {
key: *key,
secret: *secret,
}) {
Entry::Occupied(e) => e.get().shared_secret,
Entry::Vacant(e) => {
let shared_secret = vcrypto.compute_dh(key, secret)?;