From c8347d03bf66dff5d8096995e05c919956d92a1b Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 27 May 2006 18:31:58 +0000 Subject: add error checking to T=CL test program git-svn-id: https://svn.gnumonks.org/trunk/librfid@1808 e0336214-984f-0b4b-a45f-81c69e1f0ede --- utils/librfid-tool.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'utils') diff --git a/utils/librfid-tool.c b/utils/librfid-tool.c index 5e55b50..8b7f58e 100644 --- a/utils/librfid-tool.c +++ b/utils/librfid-tool.c @@ -361,25 +361,49 @@ int main(int argc, char **argv) printf("Protocol T=CL\n"); /* we've established T=CL at this point */ printf("selecting Master File\n"); - select_mf(); + rc = select_mf(); + if (rc < 0) { + printf("error selecting MF\n"); + break; + } printf("Getting random challenge, length 255\n"); - iso7816_get_challenge(0xff); + rc = iso7816_get_challenge(0xff); + if (rc < 0) { + printf("error getting random challenge\n"); + break; + } printf("selecting Passport application\n"); - iso7816_select_application(); + rc = iso7816_select_application(); + if (rc < 0) { + printf("error selecting passport application\n"); + break; + } printf("selecting EF 0x1e\n"); - iso7816_select_ef(0x011e); + rc = iso7816_select_ef(0x011e); + if (rc < 0) { + printf("error selecting EF 0x1e\n"); + break; + } printf("selecting EF 0x01\n"); - iso7816_select_ef(0x0101); + rc = iso7816_select_ef(0x0101); + if (rc < 0) { + printf("error selecting EF 0x01\n"); + break; + } while (1) { printf("reading EF1\n"); len = 200; printf("reading ef\n"); - iso7816_read_binary(buf, &len); + rc = iso7816_read_binary(buf, &len); + if (rc < 0) { + printf("error reading EF\n"); + break; + } } #if 0 for (i = 0; i < 4; i++) -- cgit v1.2.3