aboutsummaryrefslogblamecommitdiffstats
path: root/dev-util/mfcuk/files/mfcuk-new-libnfc-version.patch
blob: e27f105bfae634c9713f9612d69dde31bf3914d3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                    
Index: src/nfc-utils.c
===================================================================
--- src/nfc-utils.c	(revision 62)
+++ src/nfc-utils.c	(working copy)
@@ -33,7 +33,7 @@
 
 #include "nfc-utils.h"
 
-static const byte_t OddParity[256] = {
+static const uint8_t OddParity[256] = {
   1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
   0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
   0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
@@ -52,14 +52,14 @@
   1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
 };
 
-byte_t
-oddparity (const byte_t bt)
+uint8_t
+oddparity (const uint8_t bt)
 {
   return OddParity[bt];
 }
 
 void
-oddparity_bytes_ts (const byte_t * pbtData, const size_t szLen, byte_t * pbtPar)
+oddparity_bytes_ts (const uint8_t * pbtData, const size_t szLen, uint8_t * pbtPar)
 {
   size_t  szByteNr;
   // Calculate the parity bits for the command
@@ -69,7 +69,7 @@
 }
 
 void
-print_hex (const byte_t * pbtData, const size_t szBytes)
+print_hex (const uint8_t * pbtData, const size_t szBytes)
 {
   size_t  szPos;
 
@@ -80,7 +80,7 @@
 }
 
 void
-print_hex_bits (const byte_t * pbtData, const size_t szBits)
+print_hex_bits (const uint8_t * pbtData, const size_t szBits)
 {
   uint8_t uRemainder;
   size_t  szPos;
@@ -102,7 +102,7 @@
 }
 
 void
-print_hex_par (const byte_t * pbtData, const size_t szBits, const byte_t * pbtDataPar)
+print_hex_par (const uint8_t * pbtData, const size_t szBits, const uint8_t * pbtDataPar)
 {
   uint8_t uRemainder;
   size_t  szPos;
@@ -133,7 +133,7 @@
 #define SAK_ISO18092_COMPLIANT   0x40
 
 void
-print_nfc_iso14443a_info (const nfc_iso14443a_info_t nai, bool verbose)
+print_nfc_iso14443a_info (const nfc_iso14443a_info nai, bool verbose)
 {
   printf ("    ATQA (SENS_RES): ");
   print_hex (nai.abtAtqa, 2);
@@ -202,7 +202,7 @@
 
     size_t offset = 1;
     if (nai.abtAts[0] & 0x10) { // TA(1) present
-      byte_t TA = nai.abtAts[offset];
+      uint8_t TA = nai.abtAts[offset];
       offset++;
       printf ("* Bit Rate Capability:\n");
       if (TA == 0) {
@@ -234,7 +234,7 @@
       }
     }
     if (nai.abtAts[0] & 0x20) { // TB(1) present
-      byte_t TB= nai.abtAts[offset];
+      uint8_t TB= nai.abtAts[offset];
       offset++;
       printf ("* Frame Waiting Time: %.4g ms\n",256.0*16.0*(1<<((TB & 0xf0) >> 4))/13560.0);
       if ((TB & 0x0f) == 0) {
@@ -244,7 +244,7 @@
       }
     }
     if (nai.abtAts[0] & 0x40) { // TC(1) present
-      byte_t TC = nai.abtAts[offset];
+      uint8_t TC = nai.abtAts[offset];
       offset++;
       if (TC & 0x1) {
         printf("* Node ADdress supported\n");
@@ -260,20 +260,20 @@
     if (nai.szAtsLen > offset) {
       printf ("* Historical bytes Tk: " );
       print_hex (nai.abtAts + offset, (nai.szAtsLen - offset));
-      byte_t CIB = nai.abtAts[offset];
+      uint8_t CIB = nai.abtAts[offset];
       offset++;
       if (CIB != 0x00 && CIB != 0x10 && (CIB & 0xf0) != 0x80) {
         printf("  * Proprietary format\n");
         if (CIB == 0xc1) {
           printf("    * Tag byte: Mifare or virtual cards of various types\n");
-          byte_t L = nai.abtAts[offset];
+          uint8_t L = nai.abtAts[offset];
           offset++;
           if (L != (nai.szAtsLen - offset)) {
             printf("    * Warning: Type Identification Coding length (%i)", L);
             printf(" not matching Tk length (%zi)\n", (nai.szAtsLen - offset));
           }
           if ((nai.szAtsLen - offset - 2) > 0) { // Omit 2 CRC bytes
-            byte_t CTC = nai.abtAts[offset];
+            uint8_t CTC = nai.abtAts[offset];
             offset++;
             printf("    * Chip Type: ");
             switch (CTC & 0xf0) {
@@ -316,7 +316,7 @@
             }
           }
           if ((nai.szAtsLen - offset) > 0) { // Omit 2 CRC bytes
-            byte_t CVC = nai.abtAts[offset];
+            uint8_t CVC = nai.abtAts[offset];
             offset++;
             printf("    * Chip Status: ");
             switch (CVC & 0xf0) {
@@ -350,7 +350,7 @@
             }
           }
           if ((nai.szAtsLen - offset) > 0) { // Omit 2 CRC bytes
-            byte_t VCS = nai.abtAts[offset];
+            uint8_t VCS = nai.abtAts[offset];
             offset++;
             printf("    * Specifics (Virtual Card Selection):\n");
             if ((VCS & 0x09) == 0x00) {
@@ -530,7 +530,7 @@
 }
 
 void
-print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose)
+print_nfc_felica_info (const nfc_felica_info nfi, bool verbose)
 {
   (void) verbose;
   printf ("        ID (NFCID2): ");
@@ -542,7 +542,7 @@
 }
 
 void
-print_nfc_jewel_info (const nfc_jewel_info_t nji, bool verbose)
+print_nfc_jewel_info (const nfc_jewel_info nji, bool verbose)
 {
   (void) verbose;
   printf ("    ATQA (SENS_RES): ");
@@ -555,7 +555,7 @@
 #define PI_NAD_SUPPORTED        0x01
 #define PI_CID_SUPPORTED        0x02
 void
-print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi, bool verbose)
+print_nfc_iso14443b_info (const nfc_iso14443b_info nbi, bool verbose)
 {
   const int iMaxFrameSizes[] = { 16, 24, 32, 40, 48, 64, 96, 128, 256 };
   printf ("               PUPI: ");
@@ -610,7 +610,7 @@
 }
 
 void
-print_nfc_iso14443bi_info (const nfc_iso14443bi_info_t nii, bool verbose)
+print_nfc_iso14443bi_info (const nfc_iso14443bi_info nii, bool verbose)
 {
   printf ("                DIV: ");
   print_hex (nii.abtDIV, 4);
@@ -634,7 +634,7 @@
 }
 
 void
-print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info_t nsi, bool verbose)
+print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info nsi, bool verbose)
 {
   (void) verbose;
   printf ("                UID: ");
@@ -642,7 +642,7 @@
 }
 
 void
-print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info_t nci, bool verbose)
+print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info nci, bool verbose)
 {
   (void) verbose;
   uint32_t uid;
@@ -655,7 +655,7 @@
 }
 
 void
-print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose)
+print_nfc_dep_info (const nfc_dep_info ndi, bool verbose)
 {
   (void) verbose;
   printf ("       NFCID3: ");
@@ -671,7 +671,7 @@
 }
 
 const char *
-str_nfc_baud_rate (const nfc_baud_rate_t nbr)
+str_nfc_baud_rate (const nfc_baud_rate nbr)
 {
   switch(nbr) {
     case NBR_UNDEFINED:
@@ -694,7 +694,7 @@
 }
 
 void
-print_nfc_target (const nfc_target_t nt, bool verbose)
+print_nfc_target (const nfc_target nt, bool verbose)
 {
   switch(nt.nm.nmt) {
     case NMT_ISO14443A:
Index: src/mfcuk.c
===================================================================
--- src/mfcuk.c	(revision 62)
+++ src/mfcuk.c	(working copy)
@@ -222,9 +222,9 @@
 uint32_t numSpoofEntries = 0; // Actual number of entries in the arrSpoofEntries
 uint32_t numAuthAttempts = 0; // Number of authentication attempts for Recovery of keys - used to statistics. TODO: implement proper statistics with timings, number of tries, etc.
 bool bfOpts[256] = {false}; // Command line options, indicates their presence, initialize with false
-byte_t verboseLevel = 0; // No verbose level by default
+uint8_t verboseLevel = 0; // No verbose level by default
 
-static const nfc_modulation_t nmMifare = {
+static const nfc_modulation nmMifare = {
   .nmt = NMT_ISO14443A,
   .nbr = NBR_106,
 };
@@ -240,7 +240,7 @@
 }
 
 // TODO: combine mfcuk_verify_key_block() with mfcuk_recover_key_block(), since a lot of code is duplicate
-uint32_t mfcuk_verify_key_block(nfc_device_t* pnd, uint32_t uiUID, uint64_t ui64Key, mifare_key_type bKeyType, byte_t bTagType, uint32_t uiBlock)
+uint32_t mfcuk_verify_key_block(nfc_device* pnd, uint32_t uiUID, uint64_t ui64Key, mifare_key_type bKeyType, uint8_t bTagType, uint32_t uiBlock)
 {
     uint32_t pos;
 
@@ -254,11 +254,11 @@
     uint64_t lfsr;
 
     // Communication related variables
-    byte_t abtAuth[4]        = { 0x00,0x00,0x00,0x00 };
-    byte_t abtArEnc[8]       = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
-    byte_t abtArEncPar[8]    = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
-    byte_t abtRx[MAX_FRAME_LEN];
-    byte_t abtRxPar[MAX_FRAME_LEN];
+    uint8_t abtAuth[4]        = { 0x00,0x00,0x00,0x00 };
+    uint8_t abtArEnc[8]       = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+    uint8_t abtArEncPar[8]    = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+    uint8_t abtRx[MAX_FRAME_LEN];
+    uint8_t abtRxPar[MAX_FRAME_LEN];
     size_t szRx;
     uint32_t nt, nt_orig; // Supplied tag nonce
 
@@ -283,20 +283,20 @@
     iso14443a_crc_append(abtAuth,2);
 
     // Now we take over, first we need full control over the CRC
-    if ( !nfc_configure(pnd,NDO_HANDLE_CRC,false) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_CRC,false) )
     {
         return MFCUK_FAIL_COMM;
     }
 
     // We need to disable EASY_FRAMING feature to talk in "raw" mode
-    nfc_configure (pnd, NDO_EASY_FRAMING, false);
+    nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false);
 
     // Request plain tag-nonce
-    if (!nfc_initiator_transceive_bytes(pnd,abtAuth,4,abtRx,&szRx, NULL))
+    if (!nfc_initiator_transceive_bytes(pnd,abtAuth,4,abtRx,&szRx, 0))
     {
         return MFCUK_FAIL_COMM;
     }
-    nfc_configure (pnd, NDO_EASY_FRAMING, true);
+    nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, true);
 
     // Save the tag nonce (nt)
     nt = bswap_32(*((uint32_t *) abtRx));
@@ -347,12 +347,13 @@
     }
 
     // Finally we want to send arbitrary parity bits
-    if ( !nfc_configure(pnd,NDO_HANDLE_PARITY,false) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_PARITY,false) )
     {
         return MFCUK_FAIL_COMM;
     }
 
-    if ( !nfc_initiator_transceive_bits(pnd,abtArEnc,64,abtArEncPar,abtRx,&szRx,abtRxPar) )
+    szRx = nfc_initiator_transceive_bits(pnd,abtArEnc,64,abtArEncPar,abtRx,abtRxPar);
+    if (szRx <= 0)
     {
         return MFCUK_FAIL_AUTH;
     }
@@ -392,16 +393,16 @@
     return MFCUK_SUCCESS;
 }
 
-uint32_t mfcuk_key_recovery_block(nfc_device_t* pnd, uint32_t uiUID, uint64_t ui64Key, mifare_key_type bKeyType, byte_t bTagType, uint32_t uiBlock, uint64_t *ui64KeyRecovered)
+uint32_t mfcuk_key_recovery_block(nfc_device* pnd, uint32_t uiUID, uint64_t ui64Key, mifare_key_type bKeyType, uint8_t bTagType, uint32_t uiBlock, uint64_t *ui64KeyRecovered)
 {
     // Communication variables
     uint32_t pos, pos2, nt;
     struct Crypto1State* pcs;
-    byte_t abtAuth[4]        = { 0x60,0x00,0x00,0x00 };
-    byte_t abtArEnc[8]       = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
-    byte_t abtArEncPar[8]    = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
-    byte_t abtRx[MAX_FRAME_LEN];
-    byte_t abtRxPar[MAX_FRAME_LEN];
+    uint8_t abtAuth[4]        = { 0x60,0x00,0x00,0x00 };
+    uint8_t abtArEnc[8]       = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+    uint8_t abtArEncPar[8]    = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+    uint8_t abtRx[MAX_FRAME_LEN];
+    uint8_t abtRxPar[MAX_FRAME_LEN];
     size_t szRx;
 
     // zveriu
@@ -414,7 +415,7 @@
     struct Crypto1State *current_state;
     uint32_t i;
     uint64_t key_recovered;
-    byte_t flag_key_recovered = 0; // FIXME: fix the {Nr} iteration properly. This a quick fix for cases when 0xDEADBEEF {Nr} is not working
+    uint8_t flag_key_recovered = 0; // FIXME: fix the {Nr} iteration properly. This a quick fix for cases when 0xDEADBEEF {Nr} is not working
 
     if ( (bKeyType != keyA) && (bKeyType != keyB) )
     {
@@ -437,19 +438,19 @@
     iso14443a_crc_append(abtAuth,2);
 
     // Now we take over, first we need full control over the CRC
-    nfc_configure(pnd,NDO_HANDLE_CRC,false);
+    nfc_device_set_property_bool(pnd,NP_HANDLE_CRC,false);
 
     // We need to disable EASY_FRAMING feature to talk in "raw" mode
-    nfc_configure (pnd, NDO_EASY_FRAMING, false);
+    nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false);
 
     // Request plain tag-nonce
     //printf("Nt: ");
-    if (!nfc_initiator_transceive_bytes(pnd,abtAuth,4,abtRx,&szRx, NULL))
+    if ( !nfc_initiator_transceive_bytes(pnd,abtAuth,4,abtRx,&szRx, 0))
     {
         //printf("\n\nFAILURE - Failed to get TAG NONCE!!!\n\n");
         return MFCUK_FAIL_COMM;
     }
-    nfc_configure (pnd, NDO_EASY_FRAMING, true);
+    nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, true);
 
     //print_hex(abtRx,4);
 
@@ -631,13 +632,14 @@
     }
 
     // Finally we want to send arbitrary parity bits
-    nfc_configure(pnd,NDO_HANDLE_PARITY,false);
+    nfc_device_set_property_bool(pnd,NP_HANDLE_PARITY,false);
 
     // Transmit reader-answer
     //printf(" Ar: ");
     //print_hex_par(abtArEnc,64,abtArEncPar);
 
-    if (!nfc_initiator_transceive_bits(pnd,abtArEnc,64,abtArEncPar,abtRx,&szRx,abtRxPar))
+    szRx = nfc_initiator_transceive_bits(pnd,abtArEnc,64,abtArEncPar,abtRx,abtRxPar);
+    if (szRx <= 0)
     {
         if (sendSpoofAr)
         {
@@ -792,7 +794,7 @@
 void print_mifare_classic_tag_actions(const char *title, mifare_classic_tag *tag)
 {
     uint32_t i, max_blocks, trailer_block;
-    byte_t bTagType;
+    uint8_t bTagType;
     mifare_classic_block_trailer *ptr_trailer = NULL;
 
     if (!tag)
@@ -860,26 +862,26 @@
     return;
 }
 
-bool mfcuk_darkside_reset_advanced(nfc_device_t* pnd)
+bool mfcuk_darkside_reset_advanced(nfc_device* pnd)
 {
-    if ( !nfc_configure(pnd,NDO_HANDLE_CRC,true) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_CRC,true) )
     {
-        //ERR("configuring NDO_HANDLE_CRC");
+        //ERR("configuring NP_HANDLE_CRC");
         //return false;
     }
 
-    if ( !nfc_configure(pnd,NDO_HANDLE_PARITY,true) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_PARITY,true) )
     {
-        //ERR("configuring NDO_HANDLE_PARITY");
+        //ERR("configuring NP_HANDLE_PARITY");
         //return false;
     }
 
     return true;
 }
 
-bool mfcuk_darkside_select_tag(nfc_device_t* pnd, int iSleepAtFieldOFF, int iSleepAfterFieldON, nfc_target_info_t* ti)
+bool mfcuk_darkside_select_tag(nfc_device* pnd, int iSleepAtFieldOFF, int iSleepAfterFieldON, nfc_target_info* ti)
 {
-    nfc_target_t ti_tmp;
+    nfc_target ti_tmp;
 
     if ( !pnd || !ti )
     {
@@ -888,9 +890,9 @@
     }
 
     // Drop the field for a while, so the card can reset
-    if ( !nfc_configure(pnd,NDO_ACTIVATE_FIELD,false) )
+    if ( !nfc_device_set_property_bool(pnd,NP_ACTIVATE_FIELD,false) )
     {
-        ERR("configuring NDO_ACTIVATE_FIELD");
+        ERR("configuring NP_ACTIVATE_FIELD");
         return false;
     }
 
@@ -898,29 +900,29 @@
     sleep(iSleepAtFieldOFF);
 
     // Let the reader only try once to find a tag
-    if ( !nfc_configure(pnd,NDO_INFINITE_SELECT,false) )
+    if ( !nfc_device_set_property_bool(pnd,NP_INFINITE_SELECT,false) )
     {
-        ERR("configuring NDO_INFINITE_SELECT");
+        ERR("configuring NP_INFINITE_SELECT");
         return false;
     }
 
     // Configure the CRC and Parity settings
-    if ( !nfc_configure(pnd,NDO_HANDLE_CRC,true) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_CRC,true) )
     {
-        ERR("configuring NDO_HANDLE_CRC");
+        ERR("configuring NP_HANDLE_CRC");
         return false;
     }
 
-    if ( !nfc_configure(pnd,NDO_HANDLE_PARITY,true) )
+    if ( !nfc_device_set_property_bool(pnd,NP_HANDLE_PARITY,true) )
     {
-        ERR("configuring NDO_HANDLE_PARITY");
+        ERR("configuring NP_HANDLE_PARITY");
         return false;
     }
 
     // Enable field so more power consuming cards can power themselves up
-    if ( !nfc_configure(pnd,NDO_ACTIVATE_FIELD,true) )
+    if ( !nfc_device_set_property_bool(pnd,NP_ACTIVATE_FIELD,true) )
     {
-        ERR("configuring NDO_ACTIVATE_FIELD");
+        ERR("configuring NP_ACTIVATE_FIELD");
         return false;
     }
 
@@ -931,7 +933,7 @@
     if (!nfc_initiator_select_passive_target(pnd, nmMifare,NULL,0,&ti_tmp))
     {
         ERR("connecting to MIFARE Classic tag");
-        //nfc_disconnect(pnd);
+        //nfc_close(pnd);
         return false;
     }
 
@@ -946,15 +948,15 @@
     int ch = 0;
     char strOutputFilename[256] = {0}; // Initialize with '\0' character
     //char extendedDescription[MFCUK_EXTENDED_DESCRIPTION_LENGTH] = {0}; // Initialize with '\0' character
-    byte_t keyOpt[MIFARE_CLASSIC_KEY_BYTELENGTH] = {0};
-    byte_t uidOpt[MIFARE_CLASSIC_UID_BYTELENGTH] = {0};
+    uint8_t keyOpt[MIFARE_CLASSIC_KEY_BYTELENGTH] = {0};
+    uint8_t uidOpt[MIFARE_CLASSIC_UID_BYTELENGTH] = {0};
     mifare_classic_block_trailer *ptr_trailer = NULL;
     mifare_classic_block_trailer *ptr_trailer_dump = NULL;
     int sector = 0;
     uint32_t block = 0;
-    byte_t action = 0;
-    byte_t specific_key_type = 0;
-    byte_t max_sectors = MIFARE_CLASSIC_4K_MAX_SECTORS;
+    uint8_t action = 0;
+    uint8_t specific_key_type = 0;
+    uint8_t max_sectors = MIFARE_CLASSIC_4K_MAX_SECTORS;
     // Defaults, can be overriden by -S and -s command line arguments
     int iSleepAtFieldOFF = SLEEP_AT_FIELD_OFF; // modified with argument -S
     int iSleepAfterFieldON = SLEEP_AFTER_FIELD_ON; // modified with argument -s
@@ -965,8 +967,8 @@
     int iter = 0;
 
     // libnfc related
-    nfc_device_t* pnd;
-    nfc_target_t ti;
+    nfc_device* pnd;
+    nfc_target ti;
 
     // mifare and crapto related
     uint32_t uiErrCode = MFCUK_SUCCESS;
@@ -1004,7 +1006,7 @@
     int i, j, k;
     size_t st;
     int numDefKeys = mfcuk_default_keys_num;
-    byte_t (*current_default_keys)[MIFARE_CLASSIC_KEY_BYTELENGTH];
+    uint8_t (*current_default_keys)[MIFARE_CLASSIC_KEY_BYTELENGTH];
 
     // At runtime, duplicate the mfcuk_default_keys[], and then add at it's bottom the default keys specified via -d command line options
     if ( !(current_default_keys = malloc(numDefKeys * MIFARE_CLASSIC_KEY_BYTELENGTH)) )
@@ -1588,7 +1590,8 @@
 
     // READER INITIALIZATION BLOCK
     // Try to open the NFC reader
-    pnd = nfc_connect(NULL);
+    nfc_init(NULL);
+    pnd = nfc_open(NULL, NULL);
 
     if (pnd == NULL)
     {
@@ -1598,18 +1601,20 @@
 
     if ( !nfc_initiator_init(pnd) )
     {
-        ERR("initializing NFC reader: %s", pnd->acName);
-        nfc_disconnect(pnd);
+        ERR("initializing NFC reader: %s", nfc_device_get_name(pnd));
+        nfc_close(pnd);
+        nfc_exit(NULL);
         return 1;
     }
 
-    printf("\nINFO: Connected to NFC reader: %s\n\n", pnd->acName);
+    printf("\nINFO: Connected to NFC reader: %s\n\n", nfc_device_get_name(pnd));
 
     // Select tag and get tag info
     if ( !mfcuk_darkside_select_tag(pnd, iSleepAtFieldOFF, iSleepAfterFieldON, &ti.nti) )
     {
-        ERR("selecting tag on the reader %s", pnd->acName);
-        nfc_disconnect(pnd);
+        ERR("selecting tag on the reader %s", nfc_device_get_name(pnd));
+        nfc_close(pnd);
+        nfc_exit(NULL);
         return 1;
     }
 
@@ -1654,13 +1659,13 @@
         for (i=0; i<max_sectors; i++)
         {
             uint64_t crntVerifKey = 0;
-            byte_t crntVerifTagType = tag_recover_verify.type;
+            uint8_t crntVerifTagType = tag_recover_verify.type;
             int crntNumVerifKeys = (bfOpts['D'])?(numDefKeys):(1);
             mifare_param mp;
 
             // Depending on which of keyA or keyB the j value is, the checks and actions below will address exactly that keyA or keyB of current sector
-            byte_t action_byte = ACTIONS_KEY_A + 2*(1 - (keyB-k));
-            byte_t result_byte = RESULTS_KEY_A + 2*(1 - (keyB-k));
+            uint8_t action_byte = ACTIONS_KEY_A + 2*(1 - (keyB-k));
+            uint8_t result_byte = RESULTS_KEY_A + 2*(1 - (keyB-k));
 
             printf(" %x", i);
             fflush(stdout);
@@ -1691,7 +1696,8 @@
         /*
                 // TODO: make this kind of key verification as part of option -a - advanced verification of keys with crapto1 rollback for double verification
                 // TEST
-                nfc_disconnect(pnd);
+                nfc_close(pnd);
+		nfc_exit(NULL);
 
                 // Try to open the NFC reader
                 pnd = nfc_connect(NULL);
@@ -1705,7 +1711,8 @@
                 if ( !nfc_initiator_init(pnd) )
                 {
                     ERR("initializing NFC reader: %s", pnd->acName);
-                    nfc_disconnect(pnd);
+                    nfc_close(pnd);
+                    nfc_exit(NULL);
                     return 1;
                 }
                 // TEST
@@ -1775,8 +1782,8 @@
         for (j=keyA; j<=keyB; j++)
         {
             // Depending on which of keyA or keyB the j value is, the checks and actions below will address exactly that keyA or keyB of current sector
-            byte_t action_byte = ACTIONS_KEY_A + 2*(1 - (keyB-j));
-            byte_t result_byte = RESULTS_KEY_A + 2*(1 - (keyB-j));
+            uint8_t action_byte = ACTIONS_KEY_A + 2*(1 - (keyB-j));
+            uint8_t result_byte = RESULTS_KEY_A + 2*(1 - (keyB-j));
 
             // We have a sector and a key-type of that sector marked for recovery and still the key was not either verified nor recovered
             if ( (ptr_trailer->abtAccessBits[action_byte] & ACTIONS_RECOVER) &&
@@ -1789,10 +1796,10 @@
 
                 // TEST
                 // Before starting a new recovery session, disconnect and reconnect to reader and then tag
-                nfc_disconnect(pnd);
+                nfc_close(pnd);
 
                 // Try to open the NFC reader
-                pnd = nfc_connect(NULL);
+                pnd = nfc_open(NULL, NULL);
 
                 if (pnd == NULL)
                 {
@@ -1802,8 +1809,9 @@
 
                 if ( !nfc_initiator_init(pnd) )
                 {
-                    ERR("initializing NFC reader: %s", pnd->acName);
-                    nfc_disconnect(pnd);
+                    ERR("initializing NFC reader: %s", nfc_device_get_name(pnd));
+                    nfc_close(pnd);
+                    nfc_exit(NULL);
                     return 1;
                 }
                 // TEST
@@ -1874,7 +1882,8 @@
     */
 
     // Clean up and release device
-    nfc_disconnect(pnd);
+    nfc_close(pnd);
+    nfc_exit(NULL);
 
     // TODO: think which tag to output and make sure it contains all the retreived data
     // TODO: make this as a function and call it after each key is verified or recovered (because of reader-locking bug)
Index: src/nfc-utils.h
===================================================================
--- src/nfc-utils.h	(revision 62)
+++ src/nfc-utils.h	(working copy)
@@ -79,22 +79,22 @@
 #  define ERR(...)  warnx ("ERROR: " __VA_ARGS__ )
 #endif
 
-byte_t  oddparity (const byte_t bt);
-void    oddparity_byte_ts (const byte_t * pbtData, const size_t szLen, byte_t * pbtPar);
+uint8_t  oddparity (const uint8_t bt);
+void    oddparity_uint8_ts (const uint8_t * pbtData, const size_t szLen, uint8_t * pbtPar);
 
-void    print_hex (const byte_t * pbtData, const size_t szLen);
-void    print_hex_bits (const byte_t * pbtData, const size_t szBits);
-void    print_hex_par (const byte_t * pbtData, const size_t szBits, const byte_t * pbtDataPar);
+void    print_hex (const uint8_t * pbtData, const size_t szLen);
+void    print_hex_bits (const uint8_t * pbtData, const size_t szBits);
+void    print_hex_par (const uint8_t * pbtData, const size_t szBits, const uint8_t * pbtDataPar);
 
-void    print_nfc_iso14443a_info (const nfc_iso14443a_info_t nai, bool verbose);
-void    print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi, bool verbose);
-void    print_nfc_iso14443bi_info (const nfc_iso14443bi_info_t nii, bool verbose);
-void    print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info_t nsi, bool verbose);
-void    print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info_t nci, bool verbose);
-void    print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose);
-void    print_nfc_jewel_info (const nfc_jewel_info_t nji, bool verbose);
-void    print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose);
+void    print_nfc_iso14443a_info (const nfc_iso14443a_info nai, bool verbose);
+void    print_nfc_iso14443b_info (const nfc_iso14443b_info nbi, bool verbose);
+void    print_nfc_iso14443bi_info (const nfc_iso14443bi_info nii, bool verbose);
+void    print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info nsi, bool verbose);
+void    print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info nci, bool verbose);
+void    print_nfc_felica_info (const nfc_felica_info nfi, bool verbose);
+void    print_nfc_jewel_info (const nfc_jewel_info nji, bool verbose);
+void    print_nfc_dep_info (const nfc_dep_info ndi, bool verbose);
 
-void    print_nfc_target (const nfc_target_t nt, bool verbose);
+void    print_nfc_target (const nfc_target nt, bool verbose);
 
 #endif
Index: src/mfcuk.h
===================================================================
--- src/mfcuk.h	(revision 62)
+++ src/mfcuk.h	(working copy)
@@ -95,7 +95,7 @@
 typedef struct tag_nonce_entry
 {
 	uint32_t tagNonce; // Tag nonce we target for fixation
-    byte_t spoofFlag; // No spoofing until we have a successful auth with this tagNonce. Once we have, we want to spoof to get the encrypted 0x5 value
+    uint8_t spoofFlag; // No spoofing until we have a successful auth with this tagNonce. Once we have, we want to spoof to get the encrypted 0x5 value
     uint32_t num_of_appearances; // For statistics, how many times this tag nonce appeared for the given SLEEP_ values
 
     // STAGE1 data for "dark side" and lsfr_common_prefix()
Index: src/mifare.c
===================================================================
--- src/mifare.c	(revision 62)
+++ src/mifare.c	(working copy)
@@ -48,12 +48,12 @@
  * The MIFARE Classic Specification (http://www.nxp.com/acrobat/other/identification/M001053_MF1ICS50_rev5_3.pdf) explains more about this process.
  */
 bool
-nfc_initiator_mifare_cmd (nfc_device_t * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp)
+nfc_initiator_mifare_cmd (nfc_device * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp)
 {
-  byte_t  abtRx[265];
+  uint8_t  abtRx[265];
   size_t  szRx = sizeof(abtRx);
   size_t  szParamLen;
-  byte_t  abtCmd[265];
+  uint8_t  abtCmd[265];
   bool    bEasyFraming;
 
   abtCmd[0] = mc;               // The MIFARE Classic command
@@ -92,16 +92,16 @@
 
   // When available, copy the parameter bytes
   if (szParamLen)
-    memcpy (abtCmd + 2, (byte_t *) pmp, szParamLen);
+    memcpy (abtCmd + 2, (uint8_t *) pmp, szParamLen);
 
-  bEasyFraming = pnd->bEasyFraming;
-  if (!nfc_configure (pnd, NDO_EASY_FRAMING, true)) {
+  bEasyFraming = nfc_device_get_easy_framing(pnd);
+  if (!nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, true)) {
     nfc_perror (pnd, "nfc_configure");
     return false;
   }
   // Fire the mifare command
-  if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx, NULL)) {
-    if (pnd->iLastError == EINVRXFRAM) {
+  if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx, 0)) {
+    if (nfc_device_get_last_error(pnd) == NFC_EINVARG) {
       // "Invalid received frame" AKA EINVRXFRAM,  usual means we are
       // authenticated on a sector but the requested MIFARE cmd (read, write)
       // is not permitted by current acces bytes;
@@ -109,10 +109,10 @@
     } else {
       nfc_perror (pnd, "nfc_initiator_transceive_bytes");
     }
-    nfc_configure (pnd, NDO_EASY_FRAMING, bEasyFraming);
+    nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, bEasyFraming);
     return false;
   }
-  if (!nfc_configure (pnd, NDO_EASY_FRAMING, bEasyFraming)) {
+  if (!nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, bEasyFraming)) {
     nfc_perror (pnd, "nfc_configure");
     return false;
   }
Index: src/mifare.h
===================================================================
--- src/mifare.h	(revision 62)
+++ src/mifare.h	(working copy)
@@ -38,7 +38,7 @@
 
 #  include <nfc/nfc-types.h>
 
-// Compiler directive, set struct alignment to 1 byte_t for compatibility
+// Compiler directive, set struct alignment to 1 uint8_t for compatibility
 #  pragma pack(1)
 
 typedef enum {
@@ -54,16 +54,16 @@
 
 // MIFARE command params
 typedef struct {
-  byte_t  abtKey[6];
-  byte_t  abtUid[4];
+  uint8_t  abtKey[6];
+  uint8_t  abtUid[4];
 } mifare_param_auth;
 
 typedef struct {
-  byte_t  abtData[16];
+  uint8_t  abtData[16];
 } mifare_param_data;
 
 typedef struct {
-  byte_t  abtValue[4];
+  uint8_t  abtValue[4];
 } mifare_param_value;
 
 typedef union {
@@ -75,28 +75,28 @@
 // Reset struct alignment to default
 #  pragma pack()
 
-bool    nfc_initiator_mifare_cmd (nfc_device_t * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp);
+bool    nfc_initiator_mifare_cmd (nfc_device * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp);
 
-// Compiler directive, set struct alignment to 1 byte_t for compatibility
+// Compiler directive, set struct alignment to 1 uint8_t for compatibility
 #  pragma pack(1)
 
 // MIFARE Classic
 typedef struct {
-  byte_t  abtUID[4];
-  byte_t  btBCC;
-  byte_t  btUnknown;
-  byte_t  abtATQA[2];
-  byte_t  abtUnknown[8];
+  uint8_t  abtUID[4];
+  uint8_t  btBCC;
+  uint8_t  btUnknown;
+  uint8_t  abtATQA[2];
+  uint8_t  abtUnknown[8];
 } mifare_classic_block_manufacturer;
 
 typedef struct {
-  byte_t  abtData[16];
+  uint8_t  abtData[16];
 } mifare_classic_block_data;
 
 typedef struct {
-  byte_t  abtKeyA[6];
-  byte_t  abtAccessBits[4];
-  byte_t  abtKeyB[6];
+  uint8_t  abtKeyA[6];
+  uint8_t  abtAccessBits[4];
+  uint8_t  abtKeyB[6];
 } mifare_classic_block_trailer;
 
 typedef union {
@@ -111,17 +111,17 @@
 
 // MIFARE Ultralight
 typedef struct {
-  byte_t  sn0[3];
-  byte_t  btBCC0;
-  byte_t  sn1[4];
-  byte_t  btBCC1;
-  byte_t  internal;
-  byte_t  lock[2];
-  byte_t  otp[4];
+  uint8_t  sn0[3];
+  uint8_t  btBCC0;
+  uint8_t  sn1[4];
+  uint8_t  btBCC1;
+  uint8_t  internal;
+  uint8_t  lock[2];
+  uint8_t  otp[4];
 } mifareul_block_manufacturer;
 
 typedef struct {
-  byte_t  abtData[16];
+  uint8_t  abtData[16];
 } mifareul_block_data;
 
 typedef union {
Index: src/mfcuk_mifare.c
===================================================================
--- src/mfcuk_mifare.c	(revision 62)
+++ src/mfcuk_mifare.c	(working copy)
@@ -53,7 +53,7 @@
 #include "mfcuk_mifare.h"
 
 // Default keys used as a *BIG* mistake in many applications - especially System Integrators should pay attention!
-byte_t mfcuk_default_keys[][MIFARE_CLASSIC_KEY_BYTELENGTH] =
+uint8_t mfcuk_default_keys[][MIFARE_CLASSIC_KEY_BYTELENGTH] =
 {
     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // Place-holder for current key to verify
     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
@@ -68,7 +68,7 @@
 
 int mfcuk_default_keys_num = sizeof(mfcuk_default_keys)/sizeof(mfcuk_default_keys[0]);
 
-bool is_valid_block(byte_t bTagType, uint32_t uiBlock)
+bool is_valid_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( IS_MIFARE_CLASSIC_1K(bTagType) && (uiBlock < MIFARE_CLASSIC_1K_MAX_BLOCKS) )
     {
@@ -83,7 +83,7 @@
     return false;
 }
 
-bool is_valid_sector(byte_t bTagType, uint32_t uiSector)
+bool is_valid_sector(uint8_t bTagType, uint32_t uiSector)
 {
     if ( IS_MIFARE_CLASSIC_1K(bTagType) && (uiSector < MIFARE_CLASSIC_1K_MAX_SECTORS) )
     {
@@ -98,7 +98,7 @@
     return false;
 }
 
-bool is_first_block(byte_t bTagType, uint32_t uiBlock)
+bool is_first_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( !is_valid_block(bTagType, uiBlock) )
     {
@@ -121,7 +121,7 @@
     return false;
 }
 
-bool is_trailer_block(byte_t bTagType, uint32_t uiBlock)
+bool is_trailer_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( !is_valid_block(bTagType, uiBlock) )
     {
@@ -144,7 +144,7 @@
     return false;
 }
 
-uint32_t get_first_block(byte_t bTagType, uint32_t uiBlock)
+uint32_t get_first_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( !is_valid_block(bTagType, uiBlock) )
     {
@@ -167,7 +167,7 @@
     return MIFARE_CLASSIC_INVALID_BLOCK;
 }
 
-uint32_t get_trailer_block(byte_t bTagType, uint32_t uiBlock)
+uint32_t get_trailer_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( !is_valid_block(bTagType, uiBlock) )
     {
@@ -190,7 +190,7 @@
     return MIFARE_CLASSIC_INVALID_BLOCK;
 }
 
-bool is_big_sector(byte_t bTagType, uint32_t uiSector)
+bool is_big_sector(uint8_t bTagType, uint32_t uiSector)
 {
     if ( !is_valid_sector(bTagType, uiSector) )
     {
@@ -205,7 +205,7 @@
     return false;
 }
 
-uint32_t get_first_block_for_sector(byte_t bTagType, uint32_t uiSector)
+uint32_t get_first_block_for_sector(uint8_t bTagType, uint32_t uiSector)
 {
     if ( !is_valid_sector(bTagType, uiSector) )
     {
@@ -228,7 +228,7 @@
     return MIFARE_CLASSIC_INVALID_BLOCK;
 }
 
-uint32_t get_trailer_block_for_sector(byte_t bTagType, uint32_t uiSector)
+uint32_t get_trailer_block_for_sector(uint8_t bTagType, uint32_t uiSector)
 {
     if ( !is_valid_sector(bTagType, uiSector) )
     {
@@ -251,7 +251,7 @@
     return MIFARE_CLASSIC_INVALID_BLOCK;
 }
 
-uint32_t get_sector_for_block(byte_t bTagType, uint32_t uiBlock)
+uint32_t get_sector_for_block(uint8_t bTagType, uint32_t uiBlock)
 {
     if ( !is_valid_block(bTagType, uiBlock) )
     {
@@ -274,44 +274,44 @@
     return MIFARE_CLASSIC_INVALID_BLOCK;
 }
 
-bool is_first_sector(byte_t bTagType, uint32_t uiSector)
+bool is_first_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
-bool is_first_big_sector(byte_t bTagType, uint32_t uiSector)
+bool is_first_big_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
-bool is_first_small_sector(byte_t bTagType, uint32_t uiSector)
+bool is_first_small_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
-bool is_last_sector(byte_t bTagType, uint32_t uiSector)
+bool is_last_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
-bool is_last_big_sector(byte_t bTagType, uint32_t uiSector)
+bool is_last_big_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
-bool is_last_small_sector(byte_t bTagType, uint32_t uiSector)
+bool is_last_small_sector(uint8_t bTagType, uint32_t uiSector)
 {
     // TODO: write code
     return false;
 }
 
 // Test case function for checking correct functionality of the block/sector is_ ang get_ functions
-void test_mifare_classic_blocks_sectors_functions(byte_t bTagType)
+void test_mifare_classic_blocks_sectors_functions(uint8_t bTagType)
 {
     uint32_t i;
     uint32_t max_blocks, max_sectors;
@@ -460,7 +460,7 @@
 void print_mifare_classic_tag_keys(const char *title, mifare_classic_tag *tag)
 {
     uint32_t i, max_blocks, trailer_block;
-    byte_t bTagType;
+    uint8_t bTagType;
     mifare_classic_block_trailer *ptr_trailer = NULL;
 
     if (!tag)
@@ -521,7 +521,7 @@
     return;
 }
 
-bool mfcuk_key_uint64_to_arr(const uint64_t *ui64Key, byte_t *arr6Key)
+bool mfcuk_key_uint64_to_arr(const uint64_t *ui64Key, uint8_t *arr6Key)
 {
     int i;
 
@@ -532,13 +532,13 @@
 
     for (i = 0; i<MIFARE_CLASSIC_KEY_BYTELENGTH; i++)
     {
-        arr6Key[i] = (byte_t) (((*ui64Key) >> 8*(MIFARE_CLASSIC_KEY_BYTELENGTH - i - 1)) & 0xFF);
+        arr6Key[i] = (uint8_t) (((*ui64Key) >> 8*(MIFARE_CLASSIC_KEY_BYTELENGTH - i - 1)) & 0xFF);
     }
 
     return true;
 }
 
-bool mfcuk_key_arr_to_uint64(const byte_t *arr6Key, uint64_t *ui64Key)
+bool mfcuk_key_arr_to_uint64(const uint8_t *arr6Key, uint64_t *ui64Key)
 {
     uint64_t key = 0;
     int i;
Index: src/mfcuk_mifare.h
===================================================================
--- src/mfcuk_mifare.h	(revision 62)
+++ src/mfcuk_mifare.h	(working copy)
@@ -101,7 +101,7 @@
 // Define an extended type of dump, basically a wrapper dump around basic tag dump
 typedef struct {
     uint32_t uid;  // looks redundant, but it is easier to use dmp.uid instead of dmp.amb.mbm.abtUID[0]...[3]
-    byte_t type; // ATS/SAK from ti.tia.btSak, example 0x08h for Mifare 1K, 0x18h for Mifare 4K
+    uint8_t type; // ATS/SAK from ti.tia.btSak, example 0x08h for Mifare 1K, 0x18h for Mifare 4K
     char datetime[14]; // non-zero-terminated date-time of dump in format YYYYMMDDH24MISS, example 20091114231541 - 14 Nov 2009, 11:15:41 PM
     char description[MFCUK_EXTENDED_DESCRIPTION_LENGTH]; // a description of the tag dump, example "RATB_DUMP_BEFORE_PAY"
     mifare_classic_tag tag_basic;
@@ -114,32 +114,32 @@
 } mifare_key_type;
 
 // Default keys used as a *BIG* mistake in many applications - especially System Integrators should pay attention!
-extern byte_t mfcuk_default_keys[][MIFARE_CLASSIC_KEY_BYTELENGTH];
+extern uint8_t mfcuk_default_keys[][MIFARE_CLASSIC_KEY_BYTELENGTH];
 extern int mfcuk_default_keys_num;
 
-bool is_valid_block(byte_t bTagType, uint32_t uiBlock);
-bool is_valid_sector(byte_t bTagType, uint32_t uiSector);
-bool is_first_block(byte_t bTagType, uint32_t uiBlock);
-bool is_trailer_block(byte_t bTagType, uint32_t uiBlock);
-uint32_t get_first_block(byte_t bTagType, uint32_t uiBlock);
-uint32_t get_trailer_block(byte_t bTagType, uint32_t uiBlock);
-bool is_big_sector(byte_t bTagType, uint32_t uiSector);
-uint32_t get_first_block_for_sector(byte_t bTagType, uint32_t uiSector);
-uint32_t get_trailer_block_for_sector(byte_t bTagType, uint32_t uiSector);
-uint32_t get_sector_for_block(byte_t bTagType, uint32_t uiBlock);
-bool is_first_sector(byte_t bTagType, uint32_t uiSector);
-bool is_first_big_sector(byte_t bTagType, uint32_t uiSector);
-bool is_first_small_sector(byte_t bTagType, uint32_t uiSector);
-bool is_last_sector(byte_t bTagType, uint32_t uiSector);
-bool is_last_big_sector(byte_t bTagType, uint32_t uiSector);
-bool is_last_small_sector(byte_t bTagType, uint32_t uiSector);
-void test_mifare_classic_blocks_sectors_functions(byte_t bTagType);
+bool is_valid_block(uint8_t bTagType, uint32_t uiBlock);
+bool is_valid_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_first_block(uint8_t bTagType, uint32_t uiBlock);
+bool is_trailer_block(uint8_t bTagType, uint32_t uiBlock);
+uint32_t get_first_block(uint8_t bTagType, uint32_t uiBlock);
+uint32_t get_trailer_block(uint8_t bTagType, uint32_t uiBlock);
+bool is_big_sector(uint8_t bTagType, uint32_t uiSector);
+uint32_t get_first_block_for_sector(uint8_t bTagType, uint32_t uiSector);
+uint32_t get_trailer_block_for_sector(uint8_t bTagType, uint32_t uiSector);
+uint32_t get_sector_for_block(uint8_t bTagType, uint32_t uiBlock);
+bool is_first_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_first_big_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_first_small_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_last_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_last_big_sector(uint8_t bTagType, uint32_t uiSector);
+bool is_last_small_sector(uint8_t bTagType, uint32_t uiSector);
+void test_mifare_classic_blocks_sectors_functions(uint8_t bTagType);
 bool mfcuk_save_tag_dump(char *filename, mifare_classic_tag *tag);
 bool mfcuk_save_tag_dump_ext(char *filename, mifare_classic_tag_ext *tag_ext);
 bool mfcuk_load_tag_dump(char *filename, mifare_classic_tag *tag);
 bool mfcuk_load_tag_dump_ext(char *filename, mifare_classic_tag_ext *tag_ext);
 void print_mifare_classic_tag_keys(const char *title, mifare_classic_tag *tag);
-bool mfcuk_key_uint64_to_arr(const uint64_t *ui64Key, byte_t *arr6Key);
-bool mfcuk_key_arr_to_uint64(const byte_t *arr6Key, uint64_t *ui64Key);
+bool mfcuk_key_uint64_to_arr(const uint64_t *ui64Key, uint8_t *arr6Key);
+bool mfcuk_key_arr_to_uint64(const uint8_t *arr6Key, uint64_t *ui64Key);
 
 #endif // _MFCUK_MIFARE_H_