[Remops] Zax: 2 small mixmaster problems...
Richard Christman
richard at quicksilvermail.net
Wed Oct 15 05:57:56 BST 2014
On 10/14/2014 8:12 PM, lists at notatla.org.uk wrote:
>> line 567
>> // AES CTR mode is identical for encrypt/decrypt
>> int buf_aes_ctr128(BUFFER *buf, BUFFER *key, BUFFER *iv)
>> {
>> unsigned int n = 0;
>> unsigned char ecount[AES_BLOCK_SIZE];
>> memset(ecount, 0, sizeof(ecount));
>> AES_KEY ks;
>>
>> Here, AES_KEY is placed wrong. You have it _after_ the memset function.
>> It needs to be before any functions are called.
>
> Starting with C99 that seems to be no longer true.
> https://stackoverflow.com/questions/8474100/where-you-can-and-cannot-declare-new-variables-in-c
>
That makes sense. It's always been that way for C++ as far as I know. I
agree with the answer provided by your link; declaring variables close
to where they are used is best. I much prefer that, myself.
Working with mixmaster is my only case where I'm looking at C language.
VC6 files are dated 1998! At least it still works! The error did go away
when I moved the AES_KEY to the top.
Thanks for letting me know of the change. My apology to Steve for
calling him out on that.
Richard
More information about the Remops
mailing list