[PATCH] Fix encryption/decryption return type for GOST28147

Jussi Kivilinna jussi.kivilinna at iki.fi
Wed Sep 18 17:29:42 CEST 2013


I should have checked email before pushing this patch to repo..

On 18.09.2013 18:18, Dmitry Eremin-Solenikov wrote:
>> +
>> +  return /* burn_stack */ 4*sizeof(void*) /* func call */ +
>> +                          3*sizeof(void*) /* stack */ +
>> +                          max( 4*sizeof(void*) /* gost_val call */,
>> +                               3*sizeof(void*) /* gost_set_subst call */ +
>> +                               2*sizeof(void*) /* gost_set subst stack*/ );
> 
> I think you can be pretty much sure here that 4 is less than 3 + 2, can't you?

It shows where values come from.

> And also it looks like you have forgot those n1 and n2 variables...

"3*sizeof(void*) /* stack */" has ctx, n1 and n2. Sure, I could have had just 'sizeof(void*) + sizeof(int)*2'.

> I would suggest to just select 384 or 512 and don't get into details of stack.
> What do you think?

I'd have stack burn values opened up instead of magic numbers to avoid making mistakes. The above gives 96 bytes with 64-bit pointers and 48 with 32-bit.

-Jussi



More information about the Gcrypt-devel mailing list