Merge pull request #36 from carl-wallace/develop
Make anonymous CHUID struct public, remove spurious subtraction of two bytes in transfer_data
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ const CHUID_TMPL: &[u8] = &[
|
||||
|
||||
/// Cardholder Unique Identifier (CHUID)
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct CHUID([u8; YKPIV_CARDID_SIZE]);
|
||||
pub struct CHUID(pub [u8; YKPIV_CARDID_SIZE]);
|
||||
|
||||
impl CHUID {
|
||||
/// Generate a random Cardholder Unique Identifier (CHUID)
|
||||
|
||||
+6
-6
@@ -421,17 +421,17 @@ impl<'tx> Transaction<'tx> {
|
||||
|
||||
sw = response.status_words().code();
|
||||
|
||||
if out_data.len() - response.data().len() - 2 > max_out {
|
||||
if !out_data.is_empty() && (out_data.len() - response.data().len() > max_out) {
|
||||
error!(
|
||||
"output buffer too small: wanted to write {}, max was {}",
|
||||
out_data.len() - response.data().len() - 2,
|
||||
out_data.len() - response.data().len(),
|
||||
max_out
|
||||
);
|
||||
|
||||
return Err(Error::SizeError);
|
||||
}
|
||||
|
||||
out_data.extend_from_slice(&response.data()[..response.data().len() - 2]);
|
||||
out_data.extend_from_slice(&response.data()[..response.data().len()]);
|
||||
|
||||
in_offset += this_size;
|
||||
if in_offset >= in_data.len() {
|
||||
@@ -452,17 +452,17 @@ impl<'tx> Transaction<'tx> {
|
||||
return Ok(Response::new(sw.into(), vec![]));
|
||||
}
|
||||
|
||||
if out_data.len() + response.data().len() - 2 > max_out {
|
||||
if out_data.len() + response.data().len() > max_out {
|
||||
error!(
|
||||
"output buffer too small: wanted to write {}, max was {}",
|
||||
out_data.len() + response.data().len() - 2,
|
||||
out_data.len() + response.data().len(),
|
||||
max_out
|
||||
);
|
||||
|
||||
return Err(Error::SizeError);
|
||||
}
|
||||
|
||||
out_data.extend_from_slice(&response.data()[..response.data().len() - 2]);
|
||||
out_data.extend_from_slice(&response.data()[..response.data().len()]);
|
||||
}
|
||||
|
||||
Ok(Response::new(sw.into(), out_data))
|
||||
|
||||
Reference in New Issue
Block a user