[SailfishDevel] OpenSSL AES CTR 128 help needed
Ove Kåven
ovek at arcticnet.no
Sun Mar 1 13:35:47 UTC 2015
Den 23. feb. 2015 18:00, skrev Andrey Kozhevnikov:
> Hello Sailors!
>
> I need help in debugging issue in my simple test project:
> https://github.com/CODeRUS/aes-test
> In any platform/device it gives at least one failure during iterations.
> I googled and tried everything and have no ideas anymore.
> Any help/ideas/suggestions are appreciated.
The problem is probably that, in your calls to AES_ctr128_encrypt, the
last argument is &ctr, but ctr isn't always zero here. The last argument
is supposed to be stream state and *must* be initialized to zero before
encrypting/decrypting the first block of the stream (which, in your
case, is also the only block).
(By the way, your intToByteArray seems to take a signed int value, you
should probably change it to unsigned, as the % operator won't work the
way you want on negative numbers.)
More information about the Devel
mailing list