Skip to content

Commit

Permalink
add new line at the end of rs file
Browse files Browse the repository at this point in the history
  • Loading branch information
phochard committed Oct 31, 2024
1 parent 0301098 commit 750404e
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion examples/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {

let config: GeneralPurposeConfig = GeneralPurposeConfig::default();
let transcoder: GeneralPurpose = GeneralPurpose::new(&STANDARD, config);

let cc = Covercrypt::default();
let usk = UserSecretKey::deserialize(&transcoder.decode(USK.as_bytes()).unwrap()).unwrap();
let encrypted_header =
Expand Down
2 changes: 1 addition & 1 deletion examples/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn generate_new(
use cosmian_crypto_core::bytes_ser_de::Serializable;
let config: GeneralPurposeConfig = GeneralPurposeConfig::default();
let transcoder: GeneralPurpose = GeneralPurpose::new(&STANDARD, config);
println!(
println!(
"USK = {}",
transcoder.encode(
cc.generate_user_secret_key(_msk, &access_policy, &policy)
Expand Down
4 changes: 2 additions & 2 deletions examples/runme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() {
],
true,
);

// Another attribute axis will be department names.
// This axis is *not* hierarchical.
let department = DimensionBuilder::new(
Expand Down Expand Up @@ -102,4 +102,4 @@ fn main() {
.decrypt(&cover_crypt, &usk, None)
.unwrap()
.is_none());
}
}
2 changes: 1 addition & 1 deletion src/abe_policy/access_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub enum AccessPolicy {
Attr(Attribute),
And(Box<AccessPolicy>, Box<AccessPolicy>),
Or(Box<AccessPolicy>, Box<AccessPolicy>),
Any,
Any,
}

impl AccessPolicy {
Expand Down
2 changes: 1 addition & 1 deletion src/abe_policy/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl TryFrom<&str> for Attribute {

impl std::fmt::Display for Attribute {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}::{}", self.dimension, self.name)
write!(f, "{}: :{}", self.dimension, self.name)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/abe_policy/coordinates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Serializable for Coordinate {
}

fn read(de: &mut cosmian_crypto_core::bytes_ser_de::Deserializer) -> Result<Self, Self::Error> {
let bytes = de.read_vec()?;
let bytes = de.read_vec()?;
Ok(Self(bytes))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/abe_policy/dimension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl Dimension {
/// If the dimension is ordered, the attributes are returned in order.
#[must_use]
pub fn attributes(&self) -> Box<dyn '_ + Iterator<Item = &AttributeParameters>> {
match self {
match self {
Self::Unordered(attributes) => Box::new(attributes.values()),
Self::Ordered(attributes) => Box::new(attributes.values()),
}
Expand Down
1 change: 1 addition & 0 deletions src/abe_policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ pub enum PolicyVersion {
V1,
V2,
}

1 change: 1 addition & 0 deletions src/abe_policy/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,4 @@ mod tests {
Ok(())
}
}

2 changes: 1 addition & 1 deletion src/abe_policy/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,4 +431,4 @@ mod tests {
Ok(())
}
}

1 change: 1 addition & 0 deletions src/abe_policy/policy_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,4 @@ impl From<LegacyPolicy> for PolicyV2 {
}
}
}

2 changes: 1 addition & 1 deletion src/abe_policy/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fn specification_conversion_round_trip() -> Result<(), Error> {
.get_attribute_hybridization_hint(&Attribute::new("Department", "MKG"))
.unwrap(),
EncryptionHint::Classic
);
);
assert_eq!(
policy_from_spec
.get_attribute_hybridization_hint(&Attribute::new("Security Level", "Protected"))
Expand Down
2 changes: 1 addition & 1 deletion src/core/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,4 @@ impl<const KEY_LENGTH: usize, E: AE<KEY_LENGTH>> CovercryptPKE<E, KEY_LENGTH> fo
})
.transpose()
}
}
}
1 change: 1 addition & 0 deletions src/core/elgamal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,4 @@ mod tests {
assert_eq!(keypair, keypair_);
}
}

1 change: 1 addition & 0 deletions src/core/elgamal/ristretto_25519.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub use cosmian_crypto_core::R25519PrivateKey as Scalar;
pub use cosmian_crypto_core::R25519PublicKey as EcPoint;

2 changes: 1 addition & 1 deletion src/core/encrypted_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ impl EncryptedHeader {
pub struct CleartextHeader {
pub seed: Secret<SEED_LENGTH>,
pub metadata: Option<Vec<u8>>,
}
}
2 changes: 1 addition & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,4 @@ impl Encapsulation {
pub fn tracing_level(&self) -> usize {
self.traps.len() - 1
}
}
}
2 changes: 1 addition & 1 deletion src/core/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,4 @@ fn refresh_coordinate_keys(
})
})
.collect::<RevisionVec<_, _>>()
}
}
5 changes: 1 addition & 4 deletions src/core/serialization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,7 @@ impl Serializable for Policy {
.iter()
.map(|(s, dim)| {
to_leb128_len(s.len())
+ dim.attributes().into_iter().map(|d| {
d.len()
})
.sum::<usize>()
+ dim.attributes().into_iter().map(|d| d.len()).sum::<usize>()
})
.sum::<usize>()
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ fn test_covercrypt_pke() {
)
.expect("cannot decrypt the ciphertext");
assert_eq!(ptx, &*ptx1.unwrap());
}
}
2 changes: 1 addition & 1 deletion src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,4 @@ mod tests {

Ok(())
}
}
}
2 changes: 1 addition & 1 deletion src/test_utils/non_regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,4 @@ mod tests {
serde_json::from_str(include_str!("./tests_data/non_regression_vector.json")).unwrap();
reg_vector.verify();
}
}
}
1 change: 1 addition & 0 deletions src/test_utils/statics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 750404e

Please sign in to comment.