Fix the rust in a couple of places
This commit is contained in:
parent
fd73286e78
commit
ecef59392b
|
@ -121,8 +121,8 @@ impl BridgeLine {
|
||||||
+ reachability_priv.x[2] * bucket_attr))
|
+ reachability_priv.x[2] * bucket_attr))
|
||||||
* Btable;
|
* Btable;
|
||||||
res[pos..pos + 4].copy_from_slice(&today.to_le_bytes());
|
res[pos..pos + 4].copy_from_slice(&today.to_le_bytes());
|
||||||
res[pos + 4..pos + 36].copy_from_slice(&P.compress().as_bytes()[..]);
|
res[pos + 4..pos + 36].copy_from_slice(P.compress().as_bytes());
|
||||||
res[pos + 36..].copy_from_slice(&Q.compress().as_bytes()[..]);
|
res[pos + 36..].copy_from_slice(Q.compress().as_bytes());
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,9 @@ pub fn encrypt_cred(
|
||||||
|
|
||||||
// Serialize (to_bucket, P, Q)
|
// Serialize (to_bucket, P, Q)
|
||||||
let mut credbytes: [u8; MIGRATION_BYTES] = [0; MIGRATION_BYTES];
|
let mut credbytes: [u8; MIGRATION_BYTES] = [0; MIGRATION_BYTES];
|
||||||
credbytes[0..32].copy_from_slice(&to_bucket.as_bytes()[..]);
|
credbytes[0..32].copy_from_slice(to_bucket.as_bytes());
|
||||||
credbytes[32..64].copy_from_slice(&P.compress().as_bytes()[..]);
|
credbytes[32..64].copy_from_slice(P.compress().as_bytes());
|
||||||
credbytes[64..].copy_from_slice(&Q.compress().as_bytes()[..]);
|
credbytes[64..].copy_from_slice(Q.compress().as_bytes());
|
||||||
|
|
||||||
// Pick a random nonce
|
// Pick a random nonce
|
||||||
let mut noncebytes: [u8; 12] = [0; 12];
|
let mut noncebytes: [u8; 12] = [0; 12];
|
||||||
|
@ -93,9 +93,9 @@ pub fn encrypt_cred(
|
||||||
|
|
||||||
// Compute the hash of (id, from_bucket, Qk)
|
// Compute the hash of (id, from_bucket, Qk)
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(&id.as_bytes()[..]);
|
hasher.update(id.as_bytes());
|
||||||
hasher.update(&from_bucket.as_bytes()[..]);
|
hasher.update(from_bucket.as_bytes());
|
||||||
hasher.update(&Qk.compress().as_bytes()[..]);
|
hasher.update(Qk.compress().as_bytes());
|
||||||
let fullhash = hasher.finalize();
|
let fullhash = hasher.finalize();
|
||||||
|
|
||||||
// Create the encryption key from the 2nd half of the hash
|
// Create the encryption key from the 2nd half of the hash
|
||||||
|
@ -182,9 +182,9 @@ pub fn decrypt_cred(
|
||||||
) -> Option<Migration> {
|
) -> Option<Migration> {
|
||||||
// Compute the hash of (id, from_bucket, Qk)
|
// Compute the hash of (id, from_bucket, Qk)
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(&lox_id.as_bytes()[..]);
|
hasher.update(lox_id.as_bytes());
|
||||||
hasher.update(&from_bucket.as_bytes()[..]);
|
hasher.update(from_bucket.as_bytes());
|
||||||
hasher.update(&Qk.compress().as_bytes()[..]);
|
hasher.update(Qk.compress().as_bytes());
|
||||||
let fullhash = hasher.finalize();
|
let fullhash = hasher.finalize();
|
||||||
|
|
||||||
// Use the first half of the above hash as the label
|
// Use the first half of the above hash as the label
|
||||||
|
|
Loading…
Reference in New Issue