diff --git a/openpgp-card/src/apdu.rs b/openpgp-card/src/apdu.rs index c9a3b37..c5f5c05 100644 --- a/openpgp-card/src/apdu.rs +++ b/openpgp-card/src/apdu.rs @@ -22,13 +22,13 @@ const MAX_BUFFER_SIZE: usize = 264; /// /// If the reply is truncated, this fn assembles all the parts and returns /// them as one aggregated Response. -pub(crate) fn send_command( +pub(crate) fn send_command( card_tx: &mut C, cmd: Command, expect_reply: bool, ) -> Result where - C: CardTransaction, + C: CardTransaction + ?Sized, { let mut resp = RawResponse::try_from(send_command_low_level( card_tx, @@ -84,13 +84,13 @@ where /// /// If the response is chained, this fn only returns one chunk, the caller /// needs to re-assemble the chained response-parts. -fn send_command_low_level( +fn send_command_low_level( card_tx: &mut C, cmd: Command, expect_response: Expect, ) -> Result, Error> where - C: CardTransaction, + C: CardTransaction + ?Sized, { let (ext_support, chaining_support, mut max_cmd_bytes, max_rsp_bytes) = if let Some(caps) = card_tx.card_caps() { diff --git a/openpgp-card/src/keys.rs b/openpgp-card/src/keys.rs index 160eaaa..6793ffc 100644 --- a/openpgp-card/src/keys.rs +++ b/openpgp-card/src/keys.rs @@ -29,7 +29,7 @@ use crate::{CardTransaction, Error}; /// /// `fp_from_pub` calculates the fingerprint for a public key data object and /// creation timestamp -pub(crate) fn gen_key_with_metadata( +pub(crate) fn gen_key_with_metadata( card_tx: &mut C, fp_from_pub: fn( &PublicKeyMaterial, @@ -40,7 +40,7 @@ pub(crate) fn gen_key_with_metadata( algo: Option<&Algo>, ) -> Result<(PublicKeyMaterial, KeyGenerationTime), Error> where - C: CardTransaction, + C: CardTransaction + ?Sized, { // Set algo on card if it's Some if let Some(target_algo) = algo { @@ -129,12 +129,12 @@ fn tlv_to_pubkey(tlv: &Tlv, algo: &Algo) -> Result { /// /// This runs the low level key generation primitive on the card. /// (This does not set algorithm attributes, creation time or fingerprint) -pub(crate) fn generate_asymmetric_key_pair( +pub(crate) fn generate_asymmetric_key_pair( card_tx: &mut C, key_type: KeyType, ) -> Result where - C: CardTransaction, + C: CardTransaction + ?Sized, { // generate key let crt = control_reference_template(key_type)?; @@ -154,12 +154,12 @@ where /// in the card or imported") /// /// (See 7.2.14 GENERATE ASYMMETRIC KEY PAIR) -pub(crate) fn public_key( +pub(crate) fn public_key( card_tx: &mut C, key_type: KeyType, ) -> Result where - C: CardTransaction, + C: CardTransaction + ?Sized, { // get current algo let ard = card_tx.application_related_data()?; // FIXME: caching @@ -183,14 +183,14 @@ where /// If the key is suitable for `key_type`, an Error is returned (either /// caused by checks before attempting to upload the key to the card, or by /// an error that the card reports during an attempt to upload the key). -pub(crate) fn key_import( +pub(crate) fn key_import( card_tx: &mut C, key: Box, key_type: KeyType, algo_info: Option, ) -> Result<(), Error> where - C: CardTransaction, + C: CardTransaction + ?Sized, { // FIXME: caching? let ard = card_tx.application_related_data()?;