Score:0

Problem in matching AES CTR encryption and decryption with two different engines

no flag

I have a problem in combining encryption with a host software tool based on LibTomCrypt sources, then decryption with the hardware BEE (Bus Encryption Engine) of an i.MX RT1062 NXP processor. I am using AES 128 CTR with KEY = 0xdc5301d107837268e68ffc887df29528, IV (nonce) = 0x73793afe52944a1b61fae8bcaa6d3cf9, and for comparison purposes, trying to decode a sequence of 0xff. I have tried also with cryptii. The problem is that I have three different results:

The input for decryption is always:

    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
  1. LibTomCrypt based tool decrypted output:
    01 81 1c 90 e8 13 35 0f 73 c3 eb ba 5d 53 4d 76
    b0 d8 e4 44 15 77 b7 28 f0 73 78 2a 64 42 f9 9d
  1. NXP i.MX RT1062 NXP processor decrypted output:
    a7 7b f9 bf 40 c0 4c 58 88 fd 72 9f 0e 06 5d 8c
    1a 82 88 af e6 d7 8c 4b 60 18 f8 99 f3 7b b9 46
  1. cryptii online decrypted output:
    a0 ec f9 f5 0f 6b 24 f3 42 f1 38 3b 69 fb 0d 74
    6a 71 3d c3 4d 62 c7 32 30 ac b1 34 2a 2b 78 52

I have tried reverting the bytes of the KEY and IV for little/big endian option, but without success. Which of 1, 2, 3 decryption is correct? Any hint to find what parameter does not match? Or hints for another software tool to use for comparison?

swineone avatar
ru flag
My advice is to look for AES test vectors and play around with your implementations until you can get the correct outputs from the test vectors.
swineone avatar
ru flag
For instance, trying the key, IV and Block#1 plaintext from section F.5.1 of [NIST SP 800-38A](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf) produces the correct ciphertext on the cryptii online tool. What happens if you try it on the other implementations?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.