Skip to content

Commit

Permalink
Fix clippy needless borrows
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
  • Loading branch information
puiterwijk authored and petreeftime committed Aug 12, 2021
1 parent 76e9d84 commit 8eee123
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/crypto/openssl_pkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ where
// Recover the R and S factors from the signature contained in the object
let (bytes_r, bytes_s) = signature.split_at(key_length);

let r = BigNum::from_slice(&bytes_r).map_err(CoseError::SignatureError)?;
let s = BigNum::from_slice(&bytes_s).map_err(CoseError::SignatureError)?;
let r = BigNum::from_slice(bytes_r).map_err(CoseError::SignatureError)?;
let s = BigNum::from_slice(bytes_s).map_err(CoseError::SignatureError)?;

let sig = EcdsaSig::from_private_components(r, s).map_err(CoseError::SignatureError)?;
sig.verify(digest, &key).map_err(CoseError::SignatureError)
Expand Down
4 changes: 2 additions & 2 deletions src/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ impl CoseEncrypt0 {
let payload = decrypt_aead(
cose_alg.openssl_cipher(),
key,
Some(&iv),
Some(iv),
&enc_structure
.as_bytes()
.map_err(CoseError::SerializationError)?,
ciphertext,
&tag,
tag,
)
.map_err(CoseError::EncryptionError)?;

Expand Down
2 changes: 1 addition & 1 deletion src/header_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl HeaderMap {

/// Parses a slice of bytes into a HeaderMap, if possible.
pub fn from_bytes(header_map: &[u8]) -> Result<Self, CborError> {
serde_cbor::from_slice(&header_map)
serde_cbor::from_slice(header_map)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl CoseSign1 {

// Create the SigStruct to sign
let protected_bytes =
map_to_empty_or_serialized(&protected).map_err(CoseError::SerializationError)?;
map_to_empty_or_serialized(protected).map_err(CoseError::SerializationError)?;

let sig_structure = SigStructure::new_sign1(&protected_bytes, payload)
.map_err(CoseError::SerializationError)?;
Expand Down

0 comments on commit 8eee123

Please sign in to comment.