refactor transfer data so it can send 0 bytes

This commit is contained in:
Klas Lindfors
2014-06-25 15:17:27 +02:00
parent c4d8492682
commit 00343b9b6c
+2 -2
View File
@@ -213,7 +213,7 @@ ykpiv_rc ykpiv_transfer_data(ykpiv_state *state, const unsigned char *templ,
ykpiv_rc res; ykpiv_rc res;
*out_len = 0; *out_len = 0;
while(in_ptr < in_data + in_len) { do {
size_t this_size = 0xff; size_t this_size = 0xff;
unsigned long recv_len = 0xff; unsigned long recv_len = 0xff;
unsigned char data[0xff]; unsigned char data[0xff];
@@ -247,7 +247,7 @@ ykpiv_rc ykpiv_transfer_data(ykpiv_state *state, const unsigned char *templ,
out_data += recv_len - 2; out_data += recv_len - 2;
*out_len += recv_len - 2; *out_len += recv_len - 2;
in_ptr += this_size; in_ptr += this_size;
} } while(in_ptr < in_data + in_len);
while(*sw >> 8 == 0x61) { while(*sw >> 8 == 0x61) {
APDU apdu; APDU apdu;
unsigned long recv_len = 0xff; unsigned long recv_len = 0xff;