Please clarify:
- "The LTC however, resets the IV on every call to decrypt or encrypt"
Do you mean every call to encrypt or decrypt a message? Or a block?
Every call to E/D. I(t calls ltc_symmetric_update(base, key, keySize, kLTC_AlgorithmAES, kLTC_ModeCBC, kLTC_ModeDecrypt); which if you drill down in the LTC it does an all register base->CW = (uint32_t)kLTC_ClearAll . It also call ltc_set_context(base, &iv[0], LTC_AES_IV_SIZE, 0); each call to E/D as well. This is not consistent with libgcrypt either.
This does not seem consistent with libgcrypt which I have to be able to pace on the other end. Likewise, calls to the CBC E/D with more than 16 bytes does not produce the correct results against multiple web based calculators as shown in my first post.
BTW: "This is the output (first 64 bytes) from AES256 in CBC using your key and plain text:" didi you mean 64 bits?
libgcrypt seems to hold those previous run bits between calls to E/D until you call SetIV. At that point they get cleared.
I am using the K82 and the LTC is directly operating on the engine registers of the k82 verified.
"It does look to match with your problem. Therefore you must really mean that IV is being reset "between" blocks, which is of course false for ECB mode." Did you mean false for CBC here? I was under the impression that all AES was 16 byte block size but for CBC, the carry over of those previous sub results were kept in the computation of the next 16 bytes and so on and so on until reset.
Also, according to the K82 reference manual:
42.3.5.1 AES CBC mode use of the Mode Register
The AES CBC mode uses the Mode Register as follows:
• The Encrypt (ENC) field should be 1 for encryption and 0 for decryption.
• The ICV/TEST bit is not used in these modes.
• The Algorithm State (AS) field is used only in CBC mode to prevent IV update in the
context for the last data block when set to "Finalize" (2h). <<<< this is not being set to 2 in the LTC but is being set to 0