From: Vitaly Chikunov Date: Sat, 9 May 2020 22:20:40 +0000 (+0300) Subject: gost_crypt: Fix Magma CBC in-place decryption X-Git-Tag: v3.0.0~122^2~1 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=491b0c7c15e5a343cadabdf9cb7560956c9bb077;p=openssl-gost%2Fengine.git gost_crypt: Fix Magma CBC in-place decryption Simplest fix not concerned with performance, still should not impact it too much. --- diff --git a/gost_crypt.c b/gost_crypt.c index ffb577d..33dc668 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -774,10 +774,11 @@ int magma_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, d[7 - i] = in_ptr[i]; } gostdecrypt(&(c->cctx), d, b); + memcpy(d, in_ptr, 8); for (i = 0; i < 8; i++) { out_ptr[i] = iv[i] ^ b[7 - i]; } - memcpy(iv, in_ptr, 8); + memcpy(iv, d, 8); out_ptr += 8; in_ptr += 8; inl -= 8;