[libfreefare] push by yob...@gmail.com - Return EACCES when authentication to a DESFire tag fails... on 2014-03-14 21:52 GMT

0 views
Skip to first unread message

libfr...@googlecode.com

unread,
Mar 14, 2014, 5:52:57 PM3/14/14
to nfc-tool...@googlegroups.com
Revision: c4e657f8cdf8
Author: Philippe Teuwen <yob...@gmail.com>
Date: Fri Mar 14 21:49:27 2014 UTC
Log: Return EACCES when authentication to a DESFire tag fails

Note that in case the tag didn't authenticate us, we've also
tag->last_picc_error = AUTHENTICATION_ERROR
But in the unlikely event that we didn't authenticate the tag
(e.g. if the tag is fake and pretends the auth was ok)
only errno = EACCES will be set

http://code.google.com/p/libfreefare/source/detail?r=c4e657f8cdf8

Modified:
/libfreefare/mifare_desfire.c

=======================================
--- /libfreefare/mifare_desfire.c Tue Mar 11 21:09:48 2014 UTC
+++ /libfreefare/mifare_desfire.c Fri Mar 14 21:49:27 2014 UTC
@@ -193,6 +193,8 @@
res[__##res##_n-2] = __res[__##res##_n-1]; \
__##res##_n--; \
if ((1 == __##res##_n) && (ADDITIONAL_FRAME != res[__##res##_n-1]) &&
(OPERATION_OK != res[__##res##_n-1])) { \
+ if (res[0] == AUTHENTICATION_ERROR) \
+ errno = EACCES; \
return MIFARE_DESFIRE (tag)->last_picc_error = res[0], -1; \
} \
memcpy (res, __res, __##res##_n - 1); \
@@ -421,6 +423,7 @@
hexdump (PCD_RndA_s, key_length, "PCD ", 0);
hexdump (PICC_RndA_s, key_length, "PICC ", 0);
#endif
+ errno = EACCES;
return -1;
}

Reply all
Reply to author
Forward
0 new messages