Fix formatting

This commit is contained in:
onyinyang 2023-07-19 10:30:35 -04:00
parent 7a24fdfa06
commit d98ae40879
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
3 changed files with 18 additions and 15 deletions

View File

@ -20,7 +20,7 @@ use rand::RngCore;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::collections::{HashMap, HashSet};
use std::convert::{TryInto, TryFrom};
use std::convert::{TryFrom, TryInto};
use subtle::ConstantTimeEq;
/// Each bridge information line is serialized into this many bytes
@ -221,7 +221,9 @@ pub struct WrongSliceLengthError;
impl TryFrom<Vec<u8>> for EncryptedBucket {
type Error = WrongSliceLengthError;
fn try_from(v: Vec<u8>) -> Result<EncryptedBucket, Self::Error> {
Ok(EncryptedBucket(*Box::<[u8; ENC_BUCKET_BYTES]>::try_from(v).map_err(|_| WrongSliceLengthError)?))
Ok(EncryptedBucket(
*Box::<[u8; ENC_BUCKET_BYTES]>::try_from(v).map_err(|_| WrongSliceLengthError)?,
))
}
}
@ -230,7 +232,6 @@ struct K {
encbucket: EncryptedBucket,
}
/// A BridgeTable is the internal structure holding the buckets
/// containing the bridges, the keys used to encrypt the buckets, and
/// the encrypted buckets. The encrypted buckets will be exposed to the

View File

@ -24,16 +24,16 @@ pub mod migration_table;
use sha2::Sha512;
use rand::rngs::OsRng;
use rand::Rng;
use std::convert::{TryFrom, TryInto};
use std::collections::HashMap;
use curve25519_dalek::constants as dalek_constants;
use curve25519_dalek::ristretto::RistrettoBasepointTable;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
#[cfg(test)]
use curve25519_dalek::traits::IsIdentity;
use rand::rngs::OsRng;
use rand::Rng;
use std::collections::HashMap;
use std::convert::{TryFrom, TryInto};
use ed25519_dalek::{Keypair, PublicKey, Signature, SignatureError, Signer, Verifier};
use subtle::ConstantTimeEq;

View File

@ -171,7 +171,8 @@ impl TestHarness {
let (id, key) = bridge_table::from_scalar(cred.bucket).unwrap();
let encbuckets = self.ba.enc_bridge_table();
let bucket =
bridge_table::BridgeTable::decrypt_bucket(id, &key, encbuckets.get(&id).unwrap()).unwrap();
bridge_table::BridgeTable::decrypt_bucket(id, &key, encbuckets.get(&id).unwrap())
.unwrap();
let reachcred = bucket.1.unwrap();
// Use the Bucket Reachability credential to advance to the next
@ -219,7 +220,8 @@ impl TestHarness {
let (id, key) = bridge_table::from_scalar(cred.bucket).unwrap();
let encbuckets = self.ba.enc_bridge_table();
let bucket =
bridge_table::BridgeTable::decrypt_bucket(id, &key, encbuckets.get(&id).unwrap()).unwrap();
bridge_table::BridgeTable::decrypt_bucket(id, &key, encbuckets.get(&id).unwrap())
.unwrap();
let reachcred = bucket.1.unwrap();
let req_start = Instant::now();
@ -741,7 +743,7 @@ fn test_bridge_replace() {
let mut num = 100000;
while !th.ba.bridge_table.buckets.contains_key(&num) {
num = rand::thread_rng().gen_range(0, th.ba.bridge_table.counter) as u32;
};
}
let replaceable_bucket = th.ba.bridge_table.buckets.get(&num).unwrap().clone();
let replacement_bridge = &replaceable_bucket[0];
assert!(