Skip to content

Commit

Permalink
Use now-available Copy impls
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddrysdale committed Oct 2, 2024
1 parent fe9ae60 commit c59ed84
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion aead/src/aes_ctr_hmac_aead_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,5 @@ fn validate_key_format(
)
.into());
}
Ok((aes_ctr_format.clone(), hmac_key_format.clone()))
Ok((*aes_ctr_format, *hmac_key_format))
}
2 changes: 1 addition & 1 deletion prf/src/hmac_prf_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn validate_key(
};
let hash = HashType::try_from(params.hash).unwrap_or(HashType::UnknownHash);
subtle::validate_hmac_prf_params(hash, key_size)?;
Ok((params.clone(), hash))
Ok((*params, hash))
}

/// Validates the given [`HmacPrfKeyFormat`](tink_proto::HmacPrfKeyFormat).
Expand Down
2 changes: 1 addition & 1 deletion signature/src/ecdsa_signer_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ fn validate_key_format(
.ok_or_else(|| TinkError::new("no public key parameters"))?;
let (hash, curve, encoding) = crate::get_ecdsa_param_ids(params);
crate::subtle::validate_ecdsa_params(hash, curve, encoding)?;
Ok((params.clone(), curve))
Ok((*params, curve))
}
2 changes: 1 addition & 1 deletion signature/src/ecdsa_verifier_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ pub(crate) fn validate_ecdsa_public_key(
.ok_or_else(|| TinkError::new("no public key parameters"))?;
let (hash, curve, encoding) = crate::get_ecdsa_param_ids(params);
crate::subtle::validate_ecdsa_params(hash, curve, encoding)?;
Ok(params.clone())
Ok(*params)
}
6 changes: 3 additions & 3 deletions streaming/src/aes_ctr_hmac_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn validate_key(
.params
.as_ref()
.ok_or_else(|| TinkError::new("AesCtrHmacKeyManager: no params"))?;
Ok(key_params.clone())
Ok(*key_params)
}

/// Validate the given [`tink_proto::AesCtrHmacStreamingKeyFormat`].
Expand All @@ -114,7 +114,7 @@ fn validate_key_format(
.as_ref()
.ok_or_else(|| TinkError::new("AesCtrHmacKeyManager: no params"))?;
validate_params(key_params)?;
Ok(key_params.clone())
Ok(*key_params)
}

/// Validate the given [`tink_proto::AesCtrHmacStreamingParams`].
Expand Down Expand Up @@ -151,5 +151,5 @@ fn validate_params(
if (params.ciphertext_segment_size as usize) < min_segment_size {
return Err("AesCtrHmacKeyManager: ciphertext segment size must be at least (derived_key_size + nonce_prefix_in_bytes + tag_size_in_bytes + 2)".into());
}
Ok((hmac_params.clone(), hkdf_hash, hmac_hash))
Ok((*hmac_params, hkdf_hash, hmac_hash))
}
4 changes: 2 additions & 2 deletions streaming/src/aes_gcm_hkdf_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn validate_key(
.as_ref()
.ok_or_else(|| TinkError::new("no key params"))?;
let hkdf_hash = validate_params(key_params)?;
Ok((key_params.clone(), hkdf_hash))
Ok((*key_params, hkdf_hash))
}

/// Validate the given [`tink_proto::AesGcmHkdfStreamingKeyFormat`].
Expand All @@ -111,7 +111,7 @@ fn validate_key_format(
.as_ref()
.ok_or_else(|| TinkError::new("no format params"))?;
validate_params(format_params).map_err(|e| wrap_err("AesGcmHkdfKeyManager", e))?;
Ok(format_params.clone())
Ok(*format_params)
}

/// Validate the given [`tink_proto::AesGcmHkdfStreamingParams`].
Expand Down
2 changes: 1 addition & 1 deletion tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pub fn new_ecdsa_params(
/// Create an [`EcdsaKeyFormat`](tink_proto::EcdsaKeyFormat) with the specified parameters.
pub fn new_ecdsa_key_format(params: &tink_proto::EcdsaParams) -> tink_proto::EcdsaKeyFormat {
tink_proto::EcdsaKeyFormat {
params: Some(params.clone()),
params: Some(*params),
}
}

Expand Down

0 comments on commit c59ed84

Please sign in to comment.