]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/desfire_crypto.c
CHG: FpgaSetupDMA can fail and returns NULL. Added a check for it.
[proxmark3-svn] / armsrc / desfire_crypto.c
index 469a8ec46761a807978d376066269840a586a150..18ed67f65393434952bfdd59914f273a1e288bf4 100644 (file)
@@ -226,8 +226,8 @@ void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes
             cmac (key, DESFIRE (tag)->ivect, res, *nbytes, DESFIRE (tag)->cmac);
 
             if (append_mac) {
-                maced_data_length (key, *nbytes);
-
+                size_t len = maced_data_length (key, *nbytes);
+                               ++len;
                 memcpy (res, data, *nbytes);
                 memcpy (res + *nbytes, DESFIRE (tag)->cmac, CMAC_LENGTH);
                 *nbytes += CMAC_LENGTH;
@@ -580,7 +580,7 @@ void mifare_cypher_single_block (desfirekey_t key, uint8_t *data, uint8_t *ivect
                        {
                                AesCtx ctx;
                                AesCtxIni(&ctx, ivect, key->data, KEY128,CBC); 
-                               AesEncrypt(&ctx, data, edata, sizeof(data) );
+                               AesEncrypt(&ctx, data, edata, sizeof(edata) );
                                break;
                        }
                        case MCO_DECYPHER:
Impressum, Datenschutz