mifare_cypher_blocks_chained (NULL, key, ivect, buffer, len, MCD_SEND, MCO_ENCYPHER);
memcpy (cmac, ivect, kbs);
+ free(buffer);
}
size_t key_block_size (const desfirekey_t key) {
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;
{
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: