Pass response to ykpiv_auth_verifyresponse by value

This commit is contained in:
Jack Grigg
2019-11-20 12:32:04 +00:00
parent 6324f7a75d
commit b23ed1d48a
+2 -2
View File
@@ -2228,7 +2228,7 @@ pub unsafe fn ykpiv_auth_getchallenge(state: &mut YubiKey) -> Result<[u8; 8], Er
/// Verify an auth response /// Verify an auth response
pub unsafe fn ykpiv_auth_verifyresponse( pub unsafe fn ykpiv_auth_verifyresponse(
state: &mut YubiKey, state: &mut YubiKey,
response: &[u8; 8], response: [u8; 8],
) -> Result<(), ErrorKind> { ) -> Result<(), ErrorKind> {
let mut data = [0u8; 261]; let mut data = [0u8; 261];
let mut recv_len = data.len() as u32; let mut recv_len = data.len() as u32;
@@ -2245,7 +2245,7 @@ pub unsafe fn ykpiv_auth_verifyresponse(
apdu.data[1] = 0x0a; // 2 + 8 apdu.data[1] = 0x0a; // 2 + 8
apdu.data[2] = 0x82; apdu.data[2] = 0x82;
apdu.data[3] = 8; apdu.data[3] = 8;
apdu.data[4..12].copy_from_slice(response); apdu.data[4..12].copy_from_slice(&response);
apdu.lc = 12; apdu.lc = 12;
let mut res = _send_data(state, &mut apdu, data.as_mut_ptr(), &mut recv_len, &mut sw); let mut res = _send_data(state, &mut apdu, data.as_mut_ptr(), &mut recv_len, &mut sw);