summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-05-27 18:31:58 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-05-27 18:31:58 +0000
commitc8347d03bf66dff5d8096995e05c919956d92a1b (patch)
tree0c5f6ce920a7cba66a8c54cdc2082f989eb47b99 /utils
parent1d3b2d558aee4f42962b6db19bfac9765e41dcf5 (diff)
add error checking to T=CL test program
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1808 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'utils')
-rw-r--r--utils/librfid-tool.c36
1 files changed, 30 insertions, 6 deletions
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++)
personal git repositories of Harald Welte. Your mileage may vary