consts: Whittle down to the essentials

This factors the junk drawer of constants into the relevant files.

There are still a few "global" ones left but they can be addressed in a
followup commit.
This commit is contained in:
Tony Arcieri
2019-12-08 08:39:21 -08:00
parent 4dfac56753
commit 104020d518
12 changed files with 102 additions and 111 deletions
+5 -3
View File
@@ -16,9 +16,11 @@ use zeroize::Zeroizing;
#[cfg(feature = "untested")]
use crate::{
key::{AlgorithmId, SlotId},
mgm::MgmKey,
mgm::{MgmKey, DES_LEN_3DES},
};
const CB_PIN_MAX: usize = 8;
/// Exclusive transaction with the YubiKey's PC/SC card.
pub(crate) struct Transaction<'tx> {
inner: pcsc::Transaction<'tx>,
@@ -227,8 +229,8 @@ impl<'tx> Transaction<'tx> {
};
let mut data = [0u8; DES_LEN_3DES + 3];
data[0] = YKPIV_ALGO_3DES;
data[1] = YKPIV_KEY_CARDMGM;
data[0] = ALGO_3DES;
data[1] = KEY_CARDMGM;
data[2] = DES_LEN_3DES as u8;
data[3..3 + DES_LEN_3DES].copy_from_slice(new_key.as_ref());