Skip to content

Commit 00871db

Browse files
committed
Fix formatting and clippy
1 parent fb4f4f6 commit 00871db

File tree

5 files changed

+44
-15
lines changed

5 files changed

+44
-15
lines changed

aws-lc-rs/src/ed25519.rs

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ impl Ed25519KeyPair {
182182
let evp_pkey = generate_key()?;
183183

184184
let mut public_key = [0u8; ED25519_PUBLIC_KEY_LEN];
185-
let out_len: usize = evp_pkey.as_const().marshal_raw_public_to_buffer(&mut public_key)?;
185+
let out_len: usize = evp_pkey
186+
.as_const()
187+
.marshal_raw_public_to_buffer(&mut public_key)?;
186188
debug_assert_eq!(public_key.len(), out_len);
187189

188190
Ok(Self {
@@ -219,7 +221,9 @@ impl Ed25519KeyPair {
219221
pub fn generate_pkcs8(_rng: &dyn SecureRandom) -> Result<Document, Unspecified> {
220222
let evp_pkey = generate_key()?;
221223
Ok(Document::new(
222-
evp_pkey.as_const().marshal_rfc5208_private_key(Version::V2)?,
224+
evp_pkey
225+
.as_const()
226+
.marshal_rfc5208_private_key(Version::V2)?,
223227
))
224228
}
225229

@@ -230,7 +234,9 @@ impl Ed25519KeyPair {
230234
///
231235
pub fn to_pkcs8(&self) -> Result<Document, Unspecified> {
232236
Ok(Document::new(
233-
self.evp_pkey.as_const().marshal_rfc5208_private_key(Version::V2)?,
237+
self.evp_pkey
238+
.as_const()
239+
.marshal_rfc5208_private_key(Version::V2)?,
234240
))
235241
}
236242

@@ -251,7 +257,9 @@ impl Ed25519KeyPair {
251257
pub fn generate_pkcs8v1(_rng: &dyn SecureRandom) -> Result<Document, Unspecified> {
252258
let evp_pkey = generate_key()?;
253259
Ok(Document::new(
254-
evp_pkey.as_const().marshal_rfc5208_private_key(Version::V1)?,
260+
evp_pkey
261+
.as_const()
262+
.marshal_rfc5208_private_key(Version::V1)?,
255263
))
256264
}
257265

@@ -262,7 +270,9 @@ impl Ed25519KeyPair {
262270
///
263271
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified> {
264272
Ok(Document::new(
265-
self.evp_pkey.as_const().marshal_rfc5208_private_key(Version::V1)?,
273+
self.evp_pkey
274+
.as_const()
275+
.marshal_rfc5208_private_key(Version::V1)?,
266276
))
267277
}
268278

@@ -307,7 +317,9 @@ impl Ed25519KeyPair {
307317
let evp_pkey = LcPtr::<EVP_PKEY>::parse_raw_private_key(seed, EVP_PKEY_ED25519)?;
308318

309319
let mut derived_public_key = [0u8; ED25519_PUBLIC_KEY_LEN];
310-
let out_len: usize = evp_pkey.as_const().marshal_raw_public_to_buffer(&mut derived_public_key)?;
320+
let out_len: usize = evp_pkey
321+
.as_const()
322+
.marshal_raw_public_to_buffer(&mut derived_public_key)?;
311323
debug_assert_eq!(derived_public_key.len(), out_len);
312324

313325
Ok(Self {
@@ -363,7 +375,9 @@ impl Ed25519KeyPair {
363375
evp_pkey.as_const().validate_as_ed25519()?;
364376

365377
let mut public_key = [0u8; ED25519_PUBLIC_KEY_LEN];
366-
let out_len: usize = evp_pkey.as_const().marshal_raw_public_to_buffer(&mut public_key)?;
378+
let out_len: usize = evp_pkey
379+
.as_const()
380+
.marshal_raw_public_to_buffer(&mut public_key)?;
367381
debug_assert_eq!(public_key.len(), out_len);
368382

369383
Ok(Self {
@@ -406,7 +420,11 @@ impl Ed25519KeyPair {
406420
/// Currently the function cannot fail, but it might in future implementations.
407421
pub fn seed(&self) -> Result<Seed<'static>, Unspecified> {
408422
Ok(Seed {
409-
bytes: self.evp_pkey.as_const().marshal_raw_private_key()?.into_boxed_slice(),
423+
bytes: self
424+
.evp_pkey
425+
.as_const()
426+
.marshal_raw_private_key()?
427+
.into_boxed_slice(),
410428
phantom: PhantomData,
411429
})
412430
}
@@ -419,7 +437,9 @@ impl AsDer<Pkcs8V1Der<'static>> for Ed25519KeyPair {
419437
/// `error::Unspecified` on internal error.
420438
fn as_der(&self) -> Result<Pkcs8V1Der<'static>, crate::error::Unspecified> {
421439
Ok(Pkcs8V1Der::new(
422-
self.evp_pkey.as_const().marshal_rfc5208_private_key(Version::V1)?,
440+
self.evp_pkey
441+
.as_const()
442+
.marshal_rfc5208_private_key(Version::V1)?,
423443
))
424444
}
425445
}
@@ -431,7 +451,9 @@ impl AsDer<Pkcs8V2Der<'static>> for Ed25519KeyPair {
431451
/// `error::Unspecified` on internal error.
432452
fn as_der(&self) -> Result<Pkcs8V2Der<'static>, crate::error::Unspecified> {
433453
Ok(Pkcs8V2Der::new(
434-
self.evp_pkey.as_const().marshal_rfc5208_private_key(Version::V2)?,
454+
self.evp_pkey
455+
.as_const()
456+
.marshal_rfc5208_private_key(Version::V2)?,
435457
))
436458
}
437459
}

aws-lc-rs/src/evp_pkey.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ impl ConstPointer<'_, EVP_PKEY> {
189189
Err(Unspecified)
190190
}
191191
}
192-
193192
}
194193

195194
impl LcPtr<EVP_PKEY> {

aws-lc-rs/src/kem.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ where
360360
let mut encapsulate_bytes = vec![0u8; self.algorithm.encapsulate_key_size()];
361361
let encapsulate_key_size = self
362362
.evp_pkey
363-
.as_const().marshal_raw_public_to_buffer(&mut encapsulate_bytes)?;
363+
.as_const()
364+
.marshal_raw_public_to_buffer(&mut encapsulate_bytes)?;
364365

365366
debug_assert_eq!(encapsulate_key_size, encapsulate_bytes.len());
366367
encapsulate_bytes.truncate(encapsulate_key_size);

aws-lc-rs/src/pqdsa/key_pair.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ impl AsDer<Pkcs8V1Der<'static>> for PqdsaPrivateKey<'_> {
5151
Ok(Pkcs8V1Der::new(
5252
self.0
5353
.evp_pkey
54-
.as_const().marshal_rfc5208_private_key(pkcs8::Version::V1)?,
54+
.as_const()
55+
.marshal_rfc5208_private_key(pkcs8::Version::V1)?,
5556
))
5657
}
5758
}
@@ -121,7 +122,9 @@ impl PqdsaKeyPair {
121122
/// Returns `Unspecified` if serialization fails.
122123
pub fn to_pkcs8(&self) -> Result<Document, Unspecified> {
123124
Ok(Document::new(
124-
self.evp_pkey.as_const().marshal_rfc5208_private_key(Version::V1)?,
125+
self.evp_pkey
126+
.as_const()
127+
.marshal_rfc5208_private_key(Version::V1)?,
125128
))
126129
}
127130

aws-lc-rs/src/rsa/encoding.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ pub(in crate::rsa) mod rfc8017 {
2121
let mut pubkey_bytes = null_mut::<u8>();
2222
let mut outlen: usize = 0;
2323
if 1 != unsafe {
24-
RSA_public_key_to_bytes(&mut pubkey_bytes, &mut outlen, *pubkey.as_const().get_rsa()?)
24+
RSA_public_key_to_bytes(
25+
&mut pubkey_bytes,
26+
&mut outlen,
27+
*pubkey.as_const().get_rsa()?,
28+
)
2529
} {
2630
return Err(Unspecified);
2731
}

0 commit comments

Comments
 (0)