Skip to content

Commit

Permalink
Fix spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jan 23, 2025
1 parent 1105a8b commit 002cf1f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions aws-lc-rs/src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ mod ephemeral;

pub use ephemeral::{agree_ephemeral, EphemeralPrivateKey};

use crate::ec::evp_key_generate;
use crate::error::{KeyRejected, Unspecified};
use crate::fips::indicator_check;
use crate::ptr::{ConstPointer, LcPtr};
use crate::{ec, hex};
use crate::aws_lc::{
EVP_PKEY_CTX_new_id, EVP_PKEY_derive, EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer,
EVP_PKEY_get0_EC_KEY, EVP_PKEY_get_raw_private_key, EVP_PKEY_get_raw_public_key,
EVP_PKEY_keygen, EVP_PKEY_keygen_init, EVP_PKEY_new_raw_private_key,
EVP_PKEY_new_raw_public_key, NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, EVP_PKEY,
EVP_PKEY_X25519, NID_X25519,
};
use crate::ec::evp_key_generate;
use crate::error::{KeyRejected, Unspecified};
use crate::fips::indicator_check;
use crate::ptr::{ConstPointer, LcPtr};
use crate::{ec, hex};

use crate::buffer::Buffer;
use crate::encoding::{
Expand Down Expand Up @@ -601,7 +601,7 @@ impl AsDer<PublicKeyX509Der<'static>> for PublicKey {
| KeyInner::ECDH_P384(evp_pkey)
| KeyInner::ECDH_P521(evp_pkey)
| KeyInner::X25519(evp_pkey) => {
let der = evp_pkey.marshall_rfc5280_public_key()?;
let der = evp_pkey.marshal_rfc5280_public_key()?;
Ok(PublicKeyX509Der::from(Buffer::new(der)))
}
}
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/ec/key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl EcdsaKeyPair {
///
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified> {
Ok(Document::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V1)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V1)?,
))
}

Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/ec/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl AsDer<PublicKeyX509Der<'static>> for PublicKey {
/// # Errors
/// Returns an error if the public key fails to marshal to X.509.
fn as_der(&self) -> Result<PublicKeyX509Der<'static>, Unspecified> {
let der = self.evp_pkey.marshall_rfc5280_public_key()?;
let der = self.evp_pkey.marshal_rfc5280_public_key()?;
Ok(PublicKeyX509Der::new(der))
}
}
Expand Down
14 changes: 7 additions & 7 deletions aws-lc-rs/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl AsDer<PublicKeyX509Der<'static>> for PublicKey {
// 2:d=1 hl=2 l= 5 cons: SEQUENCE
// 4:d=2 hl=2 l= 3 prim: OBJECT :ED25519
// 9:d=1 hl=2 l= 33 prim: BIT STRING
let der = self.evp_pkey.marshall_rfc5280_public_key()?;
let der = self.evp_pkey.marshal_rfc5280_public_key()?;
Ok(PublicKeyX509Der::from(Buffer::new(der)))
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@ impl Ed25519KeyPair {
pub fn generate_pkcs8(_rng: &dyn SecureRandom) -> Result<Document, Unspecified> {
let evp_pkey = generate_key()?;
Ok(Document::new(
evp_pkey.marshall_rfc5208_private_key(Version::V2)?,
evp_pkey.marshal_rfc5208_private_key(Version::V2)?,
))
}

Expand All @@ -290,7 +290,7 @@ impl Ed25519KeyPair {
///
pub fn to_pkcs8(&self) -> Result<Document, Unspecified> {
Ok(Document::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V2)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V2)?,
))
}

Expand All @@ -311,7 +311,7 @@ impl Ed25519KeyPair {
pub fn generate_pkcs8v1(_rng: &dyn SecureRandom) -> Result<Document, Unspecified> {
let evp_pkey = generate_key()?;
Ok(Document::new(
evp_pkey.marshall_rfc5208_private_key(Version::V1)?,
evp_pkey.marshal_rfc5208_private_key(Version::V1)?,
))
}

Expand All @@ -322,7 +322,7 @@ impl Ed25519KeyPair {
///
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified> {
Ok(Document::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V1)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V1)?,
))
}

Expand Down Expand Up @@ -536,7 +536,7 @@ impl AsDer<Pkcs8V1Der<'static>> for Ed25519KeyPair {
/// `error::Unspecified` on internal error.
fn as_der(&self) -> Result<Pkcs8V1Der<'static>, crate::error::Unspecified> {
Ok(Pkcs8V1Der::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V1)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V1)?,
))
}
}
Expand All @@ -548,7 +548,7 @@ impl AsDer<Pkcs8V2Der<'static>> for Ed25519KeyPair {
/// `error::Unspecified` on internal error.
fn as_der(&self) -> Result<Pkcs8V2Der<'static>, crate::error::Unspecified> {
Ok(Pkcs8V2Der::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V2)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V2)?,
))
}
}
Expand Down
4 changes: 2 additions & 2 deletions aws-lc-rs/src/evp_pkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl LcPtr<EVP_PKEY> {
}
}

pub(crate) fn marshall_rfc5280_public_key(&self) -> Result<Vec<u8>, Unspecified> {
pub(crate) fn marshal_rfc5280_public_key(&self) -> Result<Vec<u8>, Unspecified> {
let key_size_bytes: usize = unsafe { EVP_PKEY_bits(*self.as_const()) / 8 }.try_into()?;
// Data shows that the SubjectPublicKeyInfo is roughly 356% to 375% increase in size compared to the RSA key
// size in bytes for keys ranging from 2048-bit to 4096-bit. So size the initial capacity to be roughly
Expand All @@ -104,7 +104,7 @@ impl LcPtr<EVP_PKEY> {
.ok_or(KeyRejected::wrong_algorithm())
}

pub(crate) fn marshall_rfc5208_private_key(
pub(crate) fn marshal_rfc5208_private_key(
&self,
version: Version,
) -> Result<Vec<u8>, Unspecified> {
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/rsa/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub(in crate::rsa) mod rfc5280 {
pub(in crate::rsa) fn encode_public_key_der(
key: &LcPtr<EVP_PKEY>,
) -> Result<PublicKeyX509Der<'static>, Unspecified> {
let der = key.marshall_rfc5280_public_key()?;
let der = key.marshal_rfc5280_public_key()?;
Ok(PublicKeyX509Der::from(Buffer::new(der)))
}

Expand Down
4 changes: 2 additions & 2 deletions aws-lc-rs/src/rsa/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use super::{
key::{generate_rsa_key, is_rsa_key, key_size_bits, key_size_bytes},
KeySize,
};
use crate::aws_lc::{EVP_PKEY, EVP_PKEY_RSA};
use crate::pkcs8::Version;
use crate::{
encoding::{AsDer, Pkcs8V1Der, PublicKeyX509Der},
error::{KeyRejected, Unspecified},
ptr::LcPtr,
};
use crate::aws_lc::{EVP_PKEY, EVP_PKEY_RSA};
use core::fmt::Debug;

/// RSA Encryption Algorithm Identifier
Expand Down Expand Up @@ -134,7 +134,7 @@ impl Debug for PrivateDecryptingKey {
impl AsDer<Pkcs8V1Der<'static>> for PrivateDecryptingKey {
fn as_der(&self) -> Result<Pkcs8V1Der<'static>, Unspecified> {
Ok(Pkcs8V1Der::new(
self.0.marshall_rfc5208_private_key(Version::V1)?,
self.0.marshal_rfc5208_private_key(Version::V1)?,
))
}
}
Expand Down
12 changes: 6 additions & 6 deletions aws-lc-rs/src/rsa/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ use super::{
signature::{compute_rsa_signature, RsaEncoding, RsaPadding},
RsaParameters,
};
use crate::aws_lc::{
EVP_DigestSignInit, EVP_PKEY_assign_RSA, EVP_PKEY_bits, EVP_PKEY_new, EVP_PKEY_size,
RSA_generate_key_ex, RSA_generate_key_fips, RSA_new, RSA_set0_key, RSA_size, BIGNUM, EVP_PKEY,
EVP_PKEY_CTX, EVP_PKEY_RSA,
};
#[cfg(feature = "ring-io")]
use crate::io;
#[cfg(feature = "ring-io")]
Expand All @@ -25,11 +30,6 @@ use crate::{
};
#[cfg(feature = "fips")]
use aws_lc::RSA_check_fips;
use crate::aws_lc::{
EVP_DigestSignInit, EVP_PKEY_assign_RSA, EVP_PKEY_bits, EVP_PKEY_new, EVP_PKEY_size,
RSA_generate_key_ex, RSA_generate_key_fips, RSA_new, RSA_set0_key, RSA_size, BIGNUM, EVP_PKEY,
EVP_PKEY_CTX, EVP_PKEY_RSA,
};
#[cfg(feature = "ring-io")]
use aws_lc::{RSA_get0_e, RSA_get0_n};
use core::{
Expand Down Expand Up @@ -289,7 +289,7 @@ impl crate::signature::KeyPair for KeyPair {
impl AsDer<Pkcs8V1Der<'static>> for KeyPair {
fn as_der(&self) -> Result<Pkcs8V1Der<'static>, Unspecified> {
Ok(Pkcs8V1Der::new(
self.evp_pkey.marshall_rfc5208_private_key(Version::V1)?,
self.evp_pkey.marshal_rfc5208_private_key(Version::V1)?,
))
}
}
Expand Down

0 comments on commit 002cf1f

Please sign in to comment.