[SailfishDevel] OpenSSL AES CTR 128 help needed
Andrey Kozhevnikov
coderusinbox at gmail.com
Sun Mar 1 15:24:45 UTC 2015
Thank you all for suggestions, it works now this way:
https://github.com/CODeRUS/aes-test/blob/master/aestest.cpp
01.03.2015 19:54, Sander van Grieken пишет:
> On Sunday 01 March 2015 14:35:47 Ove Kåven wrote:
>> 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.)
> Also in OpenSSL the value of ctr is directly used in pointer arithmetic, so pointing to invalid memory where ctr >= 16.
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
More information about the Devel
mailing list