+static int ul_auth_select( iso14a_card_select_t *card, TagTypeUL_t tagtype, bool hasAuthKey, uint8_t *authenticationkey, uint8_t *pack, uint8_t packSize){
+ if ( hasAuthKey && (tagtype & UL_C)) {
+ //will select card automatically and close connection on error
+ if (!ulc_authentication(authenticationkey, false)) {
+ PrintAndLog("Error: Authentication Failed UL-C");
+ return 0;
+ }
+ } else {
+ if ( !ul_select(card) ) return 0;
+
+ if (hasAuthKey) {
+ if (ulev1_requestAuthentication(authenticationkey, pack, packSize) < 1) {
+ ul_switch_off_field();
+ PrintAndLog("Error: Authentication Failed UL-EV1/NTAG");
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+