@@ -64,44 +64,44 @@ constexpr classic::Key keyA = classic::DEFAULT_KEY; // Default as 0xFFFFFFFFFFF
6464// If it's a different key value, change it
6565constexpr plus::AESKey aesKeyA = plus::DEFAULT_FF_KEY ; // all 0xFF
6666
67- constexpr int8_t kAccessDenied {-1 };
68- constexpr int8_t kAccessFree {-2 };
67+ constexpr int8_t access_denied {-1 };
68+ constexpr int8_t access_free {-2 };
6969int8_t required_key_no_for_read (const uint16_t access_rights)
7070{
7171 const uint8_t read_key = (access_rights >> 12 ) & 0x0F ; // Read
7272 const uint8_t rw_key = (access_rights >> 4 ) & 0x0F ; // Read/Write
7373 if (read_key == 0x0E ) {
74- return kAccessFree ;
74+ return access_free ;
7575 }
7676 if (read_key != 0x0F ) {
7777 return read_key;
7878 }
7979 if (rw_key == 0x0E ) {
80- return kAccessFree ;
80+ return access_free ;
8181 }
8282 if (rw_key != 0x0F ) {
8383 return rw_key;
8484 }
85- return kAccessDenied ;
85+ return access_denied ;
8686}
8787
8888int8_t required_key_no_for_write (const uint16_t access_rights)
8989{
9090 const uint8_t write_key = (access_rights >> 8 ) & 0x0F ; // Write
9191 const uint8_t rw_key = (access_rights >> 4 ) & 0x0F ; // Read/Write
9292 if (write_key == 0x0E ) {
93- return kAccessFree ;
93+ return access_free ;
9494 }
9595 if (write_key != 0x0F ) {
9696 return write_key;
9797 }
9898 if (rw_key == 0x0E ) {
99- return kAccessFree ;
99+ return access_free ;
100100 }
101101 if (rw_key != 0x0F ) {
102102 return rw_key;
103103 }
104- return kAccessDenied ;
104+ return access_denied ;
105105}
106106
107107constexpr char long_msg[] =
@@ -339,7 +339,7 @@ bool read_write_desfire()
339339 }
340340
341341 // PICC Auth
342- const uint8_t * default_key = m5::nfc::ndef::type4 ::DESFIRE_DEFAULT_KEY ;
342+ const uint8_t * default_key = desfire ::DESFIRE_DEFAULT_KEY ;
343343 bool picc_auth_des = dfs.authenticateDES (0x00 , default_key);
344344 bool picc_auth_iso = !picc_auth_des && dfs.authenticateISO (0x00 , default_key);
345345 bool picc_auth_aes = (!picc_auth_des && !picc_auth_iso) && dfs.authenticateAES (0x00 , default_key);
@@ -483,7 +483,7 @@ bool read_write_desfire_light()
483483
484484 desfire::DESFireFileSystem dfs (nfc_a);
485485
486- const uint8_t * default_key = m5::nfc::ndef::type4 ::DESFIRE_DEFAULT_KEY ;
486+ const uint8_t * default_key = desfire ::DESFIRE_DEFAULT_KEY ;
487487 desfire::Ev2Context ev2_ctx{};
488488 bool ev2_ok = false ;
489489 uint8_t ev2_key_no = 0x00 ;
@@ -506,8 +506,7 @@ bool read_write_desfire_light()
506506 }
507507 if (!settings_ok) {
508508 if (!dfs.selectDfNameAuto (m5::nfc::ndef::type4::NDEF_AID , sizeof (m5::nfc::ndef::type4::NDEF_AID ))) {
509- dfs.selectDfNameAuto (m5::nfc::ndef::type4::DESFIRE_LIGHT_DF_NAME ,
510- sizeof (m5::nfc::ndef::type4::DESFIRE_LIGHT_DF_NAME ));
509+ dfs.selectDfNameAuto (desfire::DESFIRE_LIGHT_DF_NAME , sizeof (desfire::DESFIRE_LIGHT_DF_NAME ));
511510 }
512511 ev2_ok = false ;
513512 if (ensure_ev2 ()) {
@@ -537,19 +536,19 @@ bool read_write_desfire_light()
537536 const bool use_full = fs.comm_mode == 3 ;
538537 const int8_t read_key = required_key_no_for_read (fs.access_rights );
539538 const int8_t write_key = required_key_no_for_write (fs.access_rights );
540- if (read_key == kAccessDenied || write_key == kAccessDenied ) {
539+ if (read_key == access_denied || write_key == access_denied ) {
541540 M5_LOGE (" Access denied for file (read=%d write=%d)" , read_key, write_key);
542541 return false ;
543542 }
544543
545544 auto auth_with_key = [&](const int8_t key) -> bool {
546- if (key == kAccessDenied ) {
545+ if (key == access_denied ) {
547546 return false ;
548547 }
549- if (key == kAccessFree && !use_ev2) {
548+ if (key == access_free && !use_ev2) {
550549 return true ;
551550 }
552- const uint8_t desired_key = (key == kAccessFree ) ? 0x00 : static_cast <uint8_t >(key);
551+ const uint8_t desired_key = (key == access_free ) ? 0x00 : static_cast <uint8_t >(key);
553552 if (!ev2_ok || ev2_key_no != desired_key) {
554553 ev2_ok = false ;
555554 ev2_key_no = desired_key;
@@ -715,7 +714,7 @@ void loop()
715714 M5 .Log .printf (" This example is not supported\n " );
716715 }
717716 } else if (held) {
718- nfc_a.dump ();
717+ // nfc_a.dump();
719718 M5 .Speaker .tone (4000 , 30 );
720719 if (picc.isMifareClassic ()) {
721720 read_write_sector_structure (picc.blocks - 2 );
0 commit comments