Add util/mem to zero out memory on drop. (#8356)
* Add `util/mem` to zero out memory on drop. * Remove nonsense. * Remove `Into` impls for `Memzero`. * Update ethereum-types and remove H256Mut.
This commit is contained in:
committed by
Marek Kotewicz
parent
dd2c27958c
commit
2b05eb43a9
@@ -1272,7 +1272,7 @@ mod tests {
|
||||
use crypto::DEFAULT_MAC;
|
||||
use crypto::ecies::decrypt;
|
||||
let decrypt_shadows: Vec<_> = decrypted_secret.decrypt_shadows.unwrap().into_iter()
|
||||
.map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap()))
|
||||
.map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap()).unwrap())
|
||||
.collect();
|
||||
let decrypted_secret = math::decrypt_with_shadow_coefficients(decrypted_secret.decrypted_secret, decrypted_secret.common_point.unwrap(), decrypt_shadows).unwrap();
|
||||
assert_eq!(decrypted_secret, SECRET_PLAIN.into());
|
||||
@@ -1418,7 +1418,7 @@ mod tests {
|
||||
let result = sessions[0].decrypted_secret().unwrap().unwrap();
|
||||
assert_eq!(3, sessions.iter().skip(1).filter(|s| s.decrypted_secret() == Some(Ok(result.clone()))).count());
|
||||
let decrypt_shadows: Vec<_> = result.decrypt_shadows.unwrap().into_iter()
|
||||
.map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap()))
|
||||
.map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap()).unwrap())
|
||||
.collect();
|
||||
let decrypted_secret = math::decrypt_with_shadow_coefficients(result.decrypted_secret, result.common_point.unwrap(), decrypt_shadows).unwrap();
|
||||
assert_eq!(decrypted_secret, SECRET_PLAIN.into());
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn zero_scalar() -> Secret {
|
||||
pub fn to_scalar(hash: H256) -> Result<Secret, Error> {
|
||||
let scalar: U256 = hash.into();
|
||||
let scalar: H256 = (scalar % math::curve_order()).into();
|
||||
let scalar = Secret::from_slice(&*scalar);
|
||||
let scalar = Secret::from(scalar.0);
|
||||
scalar.check_validity()?;
|
||||
Ok(scalar)
|
||||
}
|
||||
@@ -697,7 +697,7 @@ pub mod tests {
|
||||
// === required to generate shares of inv(x) mod r with out revealing
|
||||
// === any information about x or inv(x).
|
||||
// === https://www.researchgate.net/publication/280531698_Robust_Threshold_Elliptic_Curve_Digital_Signature
|
||||
|
||||
|
||||
// generate shared random secret e for given t
|
||||
let n = artifacts.id_numbers.len();
|
||||
assert!(t * 2 + 1 <= n);
|
||||
|
||||
Reference in New Issue
Block a user