]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
fix_cbc_281
authorWolfgang Beck <beck.wolfgang@oracle.com>
Fri, 9 Oct 2020 06:57:03 +0000 (16:57 +1000)
committerDmitry Belyavskiy <beldmit@gmail.com>
Sat, 31 Oct 2020 10:39:17 +0000 (13:39 +0300)
gost_crypt.c

index 4e22145a46d27097ec4aa44d98b7a5e0c9c9cff4..e9f311eb35c411adc6ccf154c34be3b3b00b2071 100644 (file)
@@ -610,11 +610,13 @@ int gost_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out,
         }
     } else {
         while (inl > 0) {
+            unsigned char tmpiv[8];
             gostdecrypt(&(c->cctx), in_ptr, b);
+            memcpy(tmpiv, in_ptr, 8);
             for (i = 0; i < 8; i++) {
                 out_ptr[i] = iv[i] ^ b[i];
             }
-            memcpy(iv, in_ptr, 8);
+            memcpy(iv, tmpiv, 8);
             out_ptr += 8;
             in_ptr += 8;
             inl -= 8;