I have problems running the Legacy Command with the Volatile Key. I have a working SPI Communication with an ATAES132a. I can read, write the memory and run all kinds of commands. Now I tried to accomplish a simple KeyTransfer to the Volatile Key (0xFF).
I configured the UserZone 0x00 s.t. the VolatileTransferOK flag is True and AuthRead, AuthWrite, EncRead and EncWrite is false. Than I performed the following steps:
1. Write Key and VolUsage to User Memory at address (0x00, 0x00)
0x02 # SPI: Write data to memory (Table 20-2)
0x00 # UserMemory address upper byte (I use the first 32 Byte of UserMemory)
0x00 # UserMemory address lower byte
0x03, ..., 0xf7 # 16 Bytes Key
0x40, 0x00, ..., 0x00 # 16 Bytes (First two bytes VolUsage) 0x40 => LegacyOK = True (VolatileKey Configuration) (Table 4-3)
2. Read Status Register until only RDY Flag is True
3. Read 32 Bytes at address (0x00, 0x00) to confirm that everything was written correctly.
4. Key Transfer Command
0x02 # SPI: Write data to memory (Table 20-2)
0xFE # Lower
0x00 # Upper
0x1A # Opcode KeyTransfer Command
0x00 # Mode always 0x00
0x00 # Always 0x00
0xFF # Key Volatile ID
0x00 # Lower Byte Adress User Memory
0x00 # Upper Byte Adress User Memory
0xB5 # CRC 0
0x84 # CRC 1
The KeyTransfer Command returns 0x00 as Return Code, means it is successfull
0x04 # Length
0x00 # Return Code
0x98 0x03 # CRC
Unfortunately a Legacy Encryption with Key ID 0xFF returns 0x80 as return code, which means KeyErr. If I perform the same chain of commands using KeyID 0x01 everything performs as expected and the ciphertext is returned. I assume that there is a problem while transferring the VolUsage part because 0x40 should allow me to use the VolatileKey with the Legacy Command.
Does anybody know which little flag or configuration I am missing?