Skip to content

Commit

Permalink
change into to from
Browse files Browse the repository at this point in the history
  • Loading branch information
heliannuuthus committed Aug 27, 2024
1 parent 9a183ab commit b67aaef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sm2/src/pke/decrypting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ impl DecryptingKey {

/// Decrypts a ciphertext in-place from ASN.1 format using the default digest algorithm (`Sm3`).
pub fn decrypt_der(&self, ciphertext: &[u8]) -> Result<Vec<u8>> {
self.decrypt_asna1_digest::<Sm3>(ciphertext)
self.decrypt_der_digest::<Sm3>(ciphertext)
}

/// Decrypts a ciphertext in-place from ASN.1 format using the specified digest algorithm.
pub fn decrypt_asna1_digest<D>(&self, ciphertext: &[u8]) -> Result<Vec<u8>>
pub fn decrypt_der_digest<D>(&self, ciphertext: &[u8]) -> Result<Vec<u8>>
where
D: 'static + Digest + DynDigest + Send + Sync,
{
Expand Down
2 changes: 1 addition & 1 deletion sm2/src/pke/encrypting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn encrypt(
fn next_k(bit_length: u32) -> U256 {
loop {
let k = U256::random_bits(&mut rand_core::OsRng, bit_length);
if !<elliptic_curve::subtle::Choice as Into<bool>>::into(k.is_zero()) && k < Sm2::ORDER {
if !bool::from(k.is_zero()) && k < Sm2::ORDER {
return k;
}
}
Expand Down

0 comments on commit b67aaef

Please sign in to comment.