From 09490070b7ce29a510759f0f058a65e97be089c2 Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Fri, 9 Oct 2020 16:57:03 +1000 Subject: [PATCH] fix_cbc_281 --- gost_crypt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gost_crypt.c b/gost_crypt.c index 4e22145..e9f311e 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -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; -- 2.39.5