Make anonymous field of CHUID struct public. Remove spurious -2 instances inside Transaction::transfer_data (the Response object is already eating the status words)
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ const CHUID_TMPL: &[u8] = &[
|
|||||||
|
|
||||||
/// Cardholder Unique Identifier (CHUID)
|
/// Cardholder Unique Identifier (CHUID)
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct CHUID([u8; YKPIV_CARDID_SIZE]);
|
pub struct CHUID(pub [u8; YKPIV_CARDID_SIZE]);
|
||||||
|
|
||||||
impl CHUID {
|
impl CHUID {
|
||||||
/// Generate a random Cardholder Unique Identifier (CHUID)
|
/// Generate a random Cardholder Unique Identifier (CHUID)
|
||||||
|
|||||||
+6
-6
@@ -421,17 +421,17 @@ impl<'tx> Transaction<'tx> {
|
|||||||
|
|
||||||
sw = response.status_words().code();
|
sw = response.status_words().code();
|
||||||
|
|
||||||
if out_data.len() - response.data().len() - 2 > max_out {
|
if 0 != out_data.len() && (out_data.len() - response.data().len() > max_out) {
|
||||||
error!(
|
error!(
|
||||||
"output buffer too small: wanted to write {}, max was {}",
|
"output buffer too small: wanted to write {}, max was {}",
|
||||||
out_data.len() - response.data().len() - 2,
|
out_data.len() - response.data().len(),
|
||||||
max_out
|
max_out
|
||||||
);
|
);
|
||||||
|
|
||||||
return Err(Error::SizeError);
|
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;
|
in_offset += this_size;
|
||||||
if in_offset >= in_data.len() {
|
if in_offset >= in_data.len() {
|
||||||
@@ -452,17 +452,17 @@ impl<'tx> Transaction<'tx> {
|
|||||||
return Ok(Response::new(sw.into(), vec![]));
|
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!(
|
error!(
|
||||||
"output buffer too small: wanted to write {}, max was {}",
|
"output buffer too small: wanted to write {}, max was {}",
|
||||||
out_data.len() + response.data().len() - 2,
|
out_data.len() + response.data().len(),
|
||||||
max_out
|
max_out
|
||||||
);
|
);
|
||||||
|
|
||||||
return Err(Error::SizeError);
|
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))
|
Ok(Response::new(sw.into(), out_data))
|
||||||
|
|||||||
Reference in New Issue
Block a user