]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Accept key number from command line
authorBlaine Forbort <b.forbort@gmail.com>
Sat, 20 Dec 2014 05:37:06 +0000 (21:37 -0800)
committerBlaine Forbort <b.forbort@gmail.com>
Sat, 20 Dec 2014 05:37:06 +0000 (21:37 -0800)
armsrc/mifaredesfire.c

index 66fe00bddf0fa52e1df3b7e273669d36fa082f4e..d46d293178fb288b73b503d8d6f356b1c726b446 100644 (file)
@@ -226,7 +226,7 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno,  uint8_t *datain
             }
             
             cmd[0] = AUTHENTICATE;
-            cmd[1] = 0x00;  //keynumber
+            cmd[1] = keyno;  //keynumber
             len = DesfireAPDU(cmd, 2, resp);
             if ( !len ) {
                 if (MF_DBGLEVEL >= 1) {
@@ -236,6 +236,13 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno,  uint8_t *datain
                 return;
             }
             
+            if ( resp[2] == 0xaf ){
+            } else {
+                DbpString("Authetication failed. Invalid key number.");
+                OnError();
+                return;
+            }
+            
             memcpy( encRndB, resp+3, 8);
             
             des_dec(&decRndB, &encRndB, &keybytes);
@@ -277,7 +284,7 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno,  uint8_t *datain
                 return;
             }
             
-                // TOD: Optionally, confirm ek0RndA' = RndA' to varify PICC
+                // TODO: Optionally, confirm ek0RndA' = RndA' to varify PICC
             
             }
                        break;
Impressum, Datenschutz