[PATCH] gostr3411-94: fix the iteration count for length filling loop

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Mon Jan 5 17:57:22 CET 2015


2014-12-28 12:05 GMT+03:00 Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>:
> The maximum iteration count for filling the l (bit length) array was
> incrrectly set to 32 (missed that in u8->u32 refactoring). This was not
> resulting in stack corruption, since nblocks variable would be exausted
> earlier compared to 8 32-bit values (the size of the array).
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
> ---
>  cipher/gostr3411-94.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

What about this patch?

>
> diff --git a/cipher/gostr3411-94.c b/cipher/gostr3411-94.c
> index 91e5b4c..7b16e61 100644
> --- a/cipher/gostr3411-94.c
> +++ b/cipher/gostr3411-94.c
> @@ -307,7 +307,7 @@ gost3411_final (void *context)
>    l[0] |= nblocks << 8;
>    nblocks >>= 24;
>
> -  for (i = 1; i < 32 && nblocks != 0; i++)
> +  for (i = 1; i < 8 && nblocks != 0; i++)
>      {
>        l[i] = nblocks;
>        nblocks >>= 24;
> --
> 2.1.4
>



-- 
With best wishes
Dmitry



More information about the Gcrypt-devel mailing list