From 00343b9b6cd860a1d43810ae07d699d15af2d3e8 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 25 Jun 2014 15:17:27 +0200 Subject: [PATCH] refactor transfer data so it can send 0 bytes --- lib/ykpiv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ykpiv.c b/lib/ykpiv.c index 460dc96..a57d0e2 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -213,7 +213,7 @@ ykpiv_rc ykpiv_transfer_data(ykpiv_state *state, const unsigned char *templ, ykpiv_rc res; *out_len = 0; - while(in_ptr < in_data + in_len) { + do { size_t this_size = 0xff; unsigned long recv_len = 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_len += recv_len - 2; in_ptr += this_size; - } + } while(in_ptr < in_data + in_len); while(*sw >> 8 == 0x61) { APDU apdu; unsigned long recv_len = 0xff;