return padded_data_length (nbytes + crc_length, block_size);
}
-void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes, off_t offset, int communication_settings) {
+void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes, size_t offset, int communication_settings) {
uint8_t *res = data;
uint8_t mac[4];
size_t edl;
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;
}
-void* mifare_cryto_postprocess_data (desfiretag_t tag, void *data, ssize_t *nbytes, int communication_settings)
+void* mifare_cryto_postprocess_data (desfiretag_t tag, void *data, size_t *nbytes, int communication_settings)
{
void *res = data;
size_t edl;
{
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: