From 1855e10fa994a31e5da15dd5c5a76549578ca849 Mon Sep 17 00:00:00 2001 From: Voev Date: Mon, 13 May 2019 18:03:58 +0300 Subject: [PATCH] =?utf8?q?=D0=9D=D0=B5=20=D1=83=D1=87=D0=B8=D1=82=D1=8B?= =?utf8?q?=D0=B2=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=B7=D0=BD=D0=B0=D1=87?= =?utf8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20carry?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- gost_grasshopper_cipher.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c index 7ae50f5..df58097 100644 --- a/gost_grasshopper_cipher.c +++ b/gost_grasshopper_cipher.c @@ -771,7 +771,7 @@ int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, unsigned char adjusted_iv[16]; unsigned char seq[8]; - int j; + int j, carry; if (mode != EVP_CIPH_CTR_MODE) return -1; @@ -799,10 +799,9 @@ int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, (const unsigned char *)seq) > 0) { memset(adjusted_iv, 0, 16); memcpy(adjusted_iv, EVP_CIPHER_CTX_original_iv(ctx), 8); - for(j=7; j>=0; j--) + for(j=7,carry=0; j>=0; j--) { - int adj_byte, carry = 0; - adj_byte = adjusted_iv[j]+seq[j]+carry; + int adj_byte = adjusted_iv[j]+seq[j]+carry; carry = (adj_byte > 255) ? 1 : 0; adjusted_iv[j] = adj_byte & 0xFF; } -- 2.39.5