[gnutls-devel] GnuTLS | lib/nettle: fix carry flag in Streebog code (!992)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue May 7 15:05:33 CEST 2019




Tim Rühsen started a new discussion on lib/nettle/gost/streebog.c: https://gitlab.com/gnutls/gnutls/merge_requests/992#note_167527141

>          }
>      }
>  
> +  cf = 0;
>    ctx->sigma[0] += M[0];
>    for (i = 1; i < 8; i++)
> -    if (ctx->sigma[i-1] < M[i-1])
> -      ctx->sigma[i] += M[i] + 1;
> -    else
> -      ctx->sigma[i] += M[i];
> +    {
> +      if (ctx->sigma[i-1] != M[i-1])
> +	cf = (ctx->sigma[i-1] < M[i-1]);

Is it correct that `cf` never gets back to 0 once it has been set ? Somehow seems wrong... it would 0x00000001 + 0x000000FF would result in 0x01010100 instead of 0x00000100.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/992#note_167527141
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190507/fd875475/attachment.html>


More information about the Gnutls-devel mailing list