Topic: Value blocks

Hello,
I'm currently working at next release of the MiCmd utility and want to finally implement value block operations as well.

However, I'm stuck at the TRANSFER command.

According to API

bool nfc_initiator_mifare_cmd(const dev_info* pdi,
                              const mifare_cmd mc,
                              const ui8 ui8Block,
                              mifare_param* pmp);

I firstly perform INCREMENT command, which returns true(success). Then, I want to 'commit' the change with the TRANSFER command. Here I'm confused a bit, regarding it's parameters.
What should go to the mifare_param structure, passed to the ...mifare_cmd function in this case? I guess ui8block should be the block I want to commit the value in the register to. I've tried setting the pmp.mpv.abtValue to 00 00 00 00 (have also tried different possibilities) but the TRANSFER always returns false, resulting in halt.

(My AC bits allow value operations on that block, moreover, Increment and Decrement return true, and I'm obviously trying to TRANSFER to the same block that has just been incremented.  I'm using key B, which has complete access over that block)

Re: Value blocks

It already works, seems like the data originally written in the block were wrong, so the block was not recognized as value block, however, those Addresses are still a bit strange... didn't find anything useful about them in any specification I've read sad
When I set the Address to 00 (last 4 bytes of the block are 00 FF 00 FF), I can use only last two bytes of the value. When I set FF, I can _theoretically_ use all 4 bytes as a block value (00000000 to FFFFFFFF)
Theoretically, because for some strange reason, when the initial state is 00000000 and I increment it by FFFFFFFF, the final result is FFFFFFF7 ( :-o )

Last edited by whitewash (2009-12-05 19:05:23)

Re: Value blocks

Hi,

I'm using a MIFARE 1K card and i want to increment / decrement a block but that block still a plain read/write block not a value block. What is the APDU that i can use to let it act as a value block?

Thanks

Re: Value blocks

Rym wrote:

What is the APDU that i can use to let it act as a value block?

IHMO, you should have a look to libfreefare, this library provide functions to build, read and write value blocks.

http://code.google.com/p/nfc-tools/wiki/libfreefare

Romuald Conty