summaryrefslogtreecommitdiff
path: root/lib/nettle/gost/streebog.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nettle/gost/streebog.c')
-rw-r--r--lib/nettle/gost/streebog.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/nettle/gost/streebog.c b/lib/nettle/gost/streebog.c
index 12c5c08362..4d7c131da2 100644
--- a/lib/nettle/gost/streebog.c
+++ b/lib/nettle/gost/streebog.c
@@ -1200,7 +1200,7 @@ static void
streebog512_compress (struct streebog512_ctx *ctx, const uint8_t *input, size_t count)
{
uint64_t M[8];
- uint64_t l;
+ uint64_t l, cf;
int i;
for (i = 0; i < 8; i++, input += 8)
@@ -1219,12 +1219,14 @@ streebog512_compress (struct streebog512_ctx *ctx, const uint8_t *input, size_t
}
}
+ 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]);
+ ctx->sigma[i] += M[i] + cf;
+ }
}
static void